Skip Menu |

This queue is for tickets about the DBD-SQLite CPAN distribution.

Report information
The Basics
Id: 96878
Status: resolved
Priority: 0/
Queue: DBD-SQLite

People
Owner: Nobody in particular
Requestors: DAMI [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: fts4 with contentless table : bind values not supported
Fts4 now supports virtual tables with "external content" (only the fulltext index is stored within sqlite). But there is a surprising bug : inserting with a prepare/execute combination does not work, while an insert without bind values works properly. See example below. my $sql = qq{CREATE VIRTUAL TABLE ft9 USING fts4(content="", x)}; $dbh->do($sql); $sql = "INSERT INTO ft9(docid, x) VALUES (?, ?)"; print STDERR $sql, "\n"; my $sth = $dbh->prepare($sql); my $docid = 13; # this code generates an error "constraint failed" for my $v ('U O N X G', 'C J J U B', 'N J Y G X', 'R Y D O R', 'I Y T Q O') { print STDERR "$v\n"; $sth->execute($docid++, $v); } # this code works # $dbh->do("INSERT INTO ft9(docid, x) VALUES (13, 'U O N X G')"); # $dbh->do("INSERT INTO ft9(docid, x) VALUES (14, 'C J J U B')"); # $dbh->do("INSERT INTO ft9(docid, x) VALUES (15, 'N J Y G X')"); # $dbh->do("INSERT INTO ft9(docid, x) VALUES (16, 'R Y D O R')"); print STDERR "done\n";
Le Mer 02 Jui 2014 03:26:44, DAMI a écrit : Show quoted text
> Fts4 now supports virtual tables with "external content" (only the > fulltext index is stored within sqlite). > > But there is a surprising bug : inserting with a prepare/execute > combination does not work, while an insert without bind values works > properly.
The problem was that bind_param() could not infer the type of docid, which is a hidden column. Client code can solve this with an explicit CAST. The FTS documentation has been updated with an example