SyuTingSong / phpliteadmin

Automatically exported from code.google.com/p/phpliteadmin
0 stars 0 forks source link

phpliteadmin does not respect sqlite3 type affinity rules #171

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Create a table outside of phpliteadmin:
CREATE TABLE TEST (
    test_id integer NOT NULL PRIMARY KEY,
    test_value smallint NOT NULL
);
2. Try to insert a row into this table using phpliteadmin

What is the expected output? What do you see instead?
You cannot get the auto integer primary key behavior on the test_id, because 
you cannot insert a default value for that column (if there was a way to omit 
that column from the INSERT, sqlite would work correctly).  The smallint field 
shows up like a text field (with a textarea) rather than an integer field (with 
an input type=text).

It seems that type comparisons are a little off in phpliteadmin.  Specifically, 
sometimes it does case-sensitive comparisons on type name, and also it seems to 
ignore sqlite3's type affinity rules (detailed in 
http://www.sqlite.org/datatype3.html section 2.1).

I have made a quick patch against 1.9.3.3 which addresses my issues.  I have 
not given it a lot of testing in other scenarios (specifically I am concerned 
about BLOB behavior).

Original issue reported on code.google.com by jeremydr...@eacceleration.com on 8 Feb 2013 at 12:52

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for your issue report and sorry for the late reply.

Also thanks for your patch. Looks good at first sight.
I will have a closer look at it and type handling in general.

Original comment by crazy4ch...@gmail.com on 22 Feb 2013 at 9:11

GoogleCodeExporter commented 9 years ago

Original comment by crazy4ch...@gmail.com on 9 Mar 2013 at 3:20

GoogleCodeExporter commented 9 years ago
Unfortunately I did not find the time for this to make it into 1.9.4.

Original comment by crazy4ch...@gmail.com on 18 Mar 2013 at 1:22

GoogleCodeExporter commented 9 years ago
I just fixed this issue with r447.

Original comment by crazy4ch...@gmail.com on 2 Jan 2014 at 3:17