Created attachment 38545 [details] lua file for connect to db, query and output results. Column with null value does not collect in lua table. To reproduce the result : 1. Create a testlua database, create a test table. 2. Insert few rows, some contains null values. 3. Compare output with mysql, lua. Tested with : System 1 : Package: apache2, Version: 2.4.54-1~deb11u1 System 2 : Server version: Apache/2.4.55 (Win64) Server built: Jan 15 2023 10:24:46 Distributed by: The Apache Haus Compiled with: Visual Studio 2022 (VS17) Details in attachment. Regards, TC Ang
text/plain; charset=utf-8 result : test_DBSelect0 : ---------- row 1 : 1 : 3 2 : Insert date into table 3 : 2018-01-09 4 : 2018-09-15 5 : 8 ---------- row 2 : 1 : 4 2 : Use current date for the task 3 : 2023-04-20 4 : 2023-12-31 5 : 7 ---------- row 3 : 1 : 5 2 : My first task 5 : 1 ---------- row 4 : 1 : 6 2 : It is the second task 5 : 2 ---------- row 5 : 1 : 7 2 : This is the third task of the week 5 : 3 ========== ========== test_DBSelect1 : ---------- row 1 : task_id : 4 priority : 7 title : Use current date for the task start_date : 2023-04-20 due_date : 2023-12-31 ---------- row 2 : task_id : 5 priority : 1 title : My first task ---------- row 3 : task_id : 6 priority : 2 title : It is the second task ---------- row 4 : task_id : 7 priority : 3 title : This is the third task of the week ========== ========== test_PrepareSelect : ---------- row 1 : 1 : 1 = 1 1 : 2 = Learn MySQL INSERT Statement 1 : 5 = 9 ---------- row 2 : 2 : 1 = 2 2 : 2 = Understanding DEFAULT keyword in INSERT statement 2 : 5 = 3 ---------- row 3 : 3 : 1 = 3 3 : 2 = Insert date into table 3 : 3 = 2018-01-09 3 : 4 = 2018-09-15 3 : 5 = 8 ---------- row 4 : 4 : 1 = 4 4 : 2 = Use current date for the task 4 : 3 = 2023-04-20 4 : 4 = 2023-12-31 4 : 5 = 7 ---------- row 5 : 5 : 1 = 5 5 : 2 = My first task 5 : 5 = 1 ---------- row 6 : 6 : 1 = 6 6 : 2 = It is the second task 6 : 5 = 2 ---------- row 7 : 7 : 1 = 7 7 : 2 = This is the third task of the week 7 : 5 = 3 ========== ========== test_PrepareSelectN : statement:select() table, err nil ---------- row 1 : 1 : 1 = 3 1 : 2 = Insert date into table 1 : 3 = 2018-01-09 1 : 4 = 2018-09-15 1 : 5 = 8 ---------- row 2 : 2 : 1 = 4 2 : 2 = Use current date for the task 2 : 3 = 2023-04-20 2 : 4 = 2023-12-31 2 : 5 = 7 ---------- row 3 : 3 : 1 = 5 3 : 2 = My first task 3 : 5 = 1 ---------- row 4 : 4 : 1 = 6 4 : 2 = It is the second task 4 : 5 = 2 ---------- row 5 : 5 : 1 = 7 5 : 2 = This is the third task of the week 5 : 5 = 3 ========== ==========
MariaDB [testlua]> select * from tasks; +---------+---------------------------------------------------+------------+------------+----------+-------------+ | task_id | title | start_date | due_date | priority | description | +---------+---------------------------------------------------+------------+------------+----------+-------------+ | 1 | Learn MySQL INSERT Statement | NULL | NULL | 9 | NULL | | 2 | Understanding DEFAULT keyword in INSERT statement | NULL | NULL | 3 | NULL | | 3 | Insert date into table | 2018-01-09 | 2018-09-15 | 8 | NULL | | 4 | Use current date for the task | 2023-04-20 | 2023-12-31 | 7 | NULL | | 5 | My first task | NULL | NULL | 1 | NULL | | 6 | It is the second task | NULL | NULL | 2 | NULL | | 7 | This is the third task of the week | NULL | NULL | 3 | NULL | +---------+---------------------------------------------------+------------+------------+----------+-------------+ 7 rows in set (0.001 sec)