Alexey Pechnikov
unread,May 24, 2009, 8:35:56 AM5/24/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to SpatiaLite Users
I did download new spatialite and found some problems.
1. As I did write some times ago using "illegalSqlName" is bad because
this is not standart behaviour. You did rewrite code as:
if (gaiaIllegalSqlName (*(text->titles + i))
|| gaiaIsReservedSqlName (*(text->titles + i))
|| gaiaIsReservedSqliteName (*(text->titles + i)))
sprintf (dummyName, "\"%s\"", *(text->titles + i));
else
strcpy (dummyName, *(text->titles + i));
But it's not needed. For example:
sqlite> create table "test" (a);
sqlite> select count(*) from test;
0
As you can see name test is equal to "test" and it's corresponding to
SQL standart.
So you can simplify code as (patched 2.3beta)
/*
if (illegalSqlName (*(text->titles + i))
|| isReservedSqlName (*(text->titles + i))
|| isReservedSqliteName (*(text->titles + i)))
sprintf (dummyName, "COL_%d", seed++);
else
strcpy (dummyName, *(text->titles + i));
*/
sprintf (dummyName, "\"%s\"", *(text->titles + i));
Your code is more complex but is identical!
2. Integer overflow with sqlite3_result_int was reported in the user
list but doesn't fixed in new version.
/*
sqlite3_result_int (pContext,
atoi (*(row->cells + i)));*/
sqlite3_result_int64 (pContext,
atol (*(row->cells + i)));
3. I did rename module from "my_text_module" to "virtualtext_module"
and rename function "gaiaConvertToUTF8" to iconvConvertToUTF8. I'm
think that "gaiaConvertToUTF8" is non-informative because it's wrapper
for iconv interface.
I'm update module virtualtext to upstream version and can sent to your
(but my version may compiling with original SQLite sources as common
SQLite extension in /ext source tree directory).
P.S. VirtualText module is very useful and I'm using this often and
often. Thanks!