Hello.

----------------------------------------------------------------------

#!/usr/bin/perl -w
use strict;
use DBI;

my $db_name = "test.db";
unlink $db_name;

my $dbh = DBI->connect( "dbi:SQLite:dbname=$db_name", "", "" );
my $table = "test";
$dbh->do( "CREATE TABLE $table ( foo LONGBLOB )" );

my $sth = $dbh->prepare("REPLACE INTO $table (foo) VALUES (?)");

my $data = pack ("H12s", "stringstring", 2);
print "Before: " . length($data) . "\n";
$sth->execute( $data );

my $test = $dbh->selectrow_array( "SELECT foo FROM $table" );
print "After: " . (length $test) . "\n";

----------------------------------------------------------------------

This code gives before: 5, after: 8.  The equivalent code with MySQL
gives 8 both before and after.  Printing out $data and $test reveals
that with the SQLite code, $test is missing something that vim renders
as '^@' off the end.  Is there a way of making SQLite behave in the
same way as MySQL?

Kake
PS Yes I know sqlite is typeless; replace LONGBLOB in the above with
whatever you like, same problem.

Reply via email to