MySQL Forums
Forum List  »  Router & Proxy

How mysql-proxy deals with NULL in lua script?
Posted by: zheng zhiyong
Date: June 23, 2010 09:42PM

Here is the script, I want to print every field in row, but when lua encounters NULL in row, it ignore the following NOT NULL field. How can I print them?


if (inj.resultset.rows) then
for row in inj.resultset.rows do
for i=1,table.maxn(row) do
print(i .. " " .. row)
end
rown = tonumber(row[9])
end
end

I run sql, desc inotice;
+--------+--------------+------+-----+-------------------+-----------------------------+
| Field | Type | Null | Key | Default | Extra |
+--------+--------------+------+-----+-------------------+-----------------------------+
| id | bigint(20) | NO | PRI | NULL | auto_increment |
| akey | char(10) | NO | MUL | NULL | |
| notice | varchar(256) | NO | | NULL | |
| sc | tinyint(4) | NO | | NULL | |
| status | tinyint(4) | NO | | 0 | |
| ntime | timestamp | NO | | CURRENT_TIMESTAMP | on update CURRENT_TIMESTAMP |
+--------+--------------+------+-----+-------------------+-----------------------------+

but lua print
1 id
2 bigint(20)
3 NO
4 PRI
1 akey
2 char(10)
3 NO
4 MUL
1 notice
2 varchar(256)
3 NO
4
1 sc
2 tinyint(4)
3 NO
4
1 status
2 tinyint(4)
3 NO
4
5 0
6
1 ntime
2 timestamp
3 NO
4
5 CURRENT_TIMESTAMP
6 on update CURRENT_TIMESTAMP

only the last row is right, other row only print 4 fields. when they encounter NULL, lua stoped. How can I print all of them?

Thanks,
zhiyong

Options: ReplyQuote


Subject
Views
Written By
Posted
How mysql-proxy deals with NULL in lua script?
3333
June 23, 2010 09:42PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.