On 2016-08-02 00:44, Markus Hoenicka wrote:
> Hi,
> 
> unfortunately I didn't find the time to actually reproduce your
> problem. However, I've found the following conspicuous line in
> dbd_sqlite3.c (line 1236 in my copy):
> 
> || strstr(curr_type, "INTEGER PRIMARY KEY") /* BAD BAD HACK */
> 
> It is quite possible that the "bad bad" part of this hack came to life
> in your example. Could you please test your code again with a slightly
> modified table definition like this:
> 
>    inode integer primary key not null autoincrement,
> 
> Please let me know if this helps.
> 
> regards,
> Markus

Hi Markus,

thanks for your reply. I've wrote a small fragment to do some tests.
I've put it on Gist:

   
https://gist.github.com/StrumentiResistenti/58943f64c7e702dc4f77c15a120619ea

This is the output (I think it's quite self explanatory):

  ---> QUERY: [create table if not exists objects (
     inode integer primary key autoincrement not null,
     objectname text(255) not null,
     last_autotag timestamp not null default current_timestamp,
     checksum text(40) not null default '',
     symlink text(1024) not null default '')]
no tables in statement !
  ---> QUERY: [insert into objects (objectname) values ('testname1'), 
('testname2'), ('testname3')]
no tables in statement !
  ---> QUERY: [select last_insert_rowid()]
no tables in statement !
  <--- callback got a ___STRING___ field: "3"
no tables in statement !
  ---> QUERY: [select cast(last_insert_rowid() as int)]
no tables in statement !
  <--- callback got a ___STRING___ field: "3"
Last inserted sequence number is 3

Clearly there are two problems to solve. The first one is why, inside
Tagsistant, I'm not able to fetch the right number, provided that the
Gist fragment succeeds. The second one is (I suppose) internal to the
DBI driver: why the sequence number is returned as a string instead
of a integer?

I'll address the first one. I hope DBD developers could do something
about the second one.

Btw. at line 1198 of dbd_sqlite3.c there's a printf() call that should
be commented out:

   printf("no tables in statement !\n");

It prints this message every time the dbi_conn_ping() function is called
on SQLite.

Thanks again.
Ciao!
-- 
Tx0 - GNU/Linux hacker
Author of http://www.tagsistant.net/

------------------------------------------------------------------------------
_______________________________________________
libdbi-users mailing list
libdbi-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libdbi-users

Reply via email to