[EMAIL PROTECTED] wrote:
I have textual data that may look like integers (eg. "0325763213").
On insertion, any leading "0" will vanish. How do I prevent this
and make the data be inserted verbatim?
Simple illustration:
sqlite3 test 'create table t ( k text unique, v text);'
perl -e 'use DBI; $db = DBI->connect( "dbi:SQLite:dbname=test" );
$db->do( qq[REPLACE INTO t VALUES(?,?);], undef, "key", "0325763213");'
sqlite3 test 'select * from t;'
returns:
key|325763213
I am using the sqlite3_3.2.1-1 and libdbd-sqlite3-perl_1.08-1 packages
from Debian, in case it matters.
Perhaps it matters, because I don't get the results you get...
D:\testers>sqlite3 test
SQLite version 3.2.1
Enter ".help" for instructions
sqlite> create table t (k text unique, v text);
sqlite> .q
---test.pl------------
#!perl -w
use DBI;
$db = DBI->connect("dbi:SQLite:dbname=test");
$db->do(qq[REPLACE INTO t VALUES (?, ?);], undef, "key", "0325763213");
---------------
D:\testers>test.pl
D:\testers>sqlite3 test
SQLite version 3.2.1
Enter ".help" for instructions
sqlite> select * from t;
key|0325763213
sqlite>
I am using the latest DBI and DBD::SQLite