-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

MikeW wrote:
> I note that in the codebase, sqlite3IsNumber() will return False if an
> otherwise numeric value has leading and/or trailing whitespace,
> overriding the table schema.
> Such is dynamic typing !

Your dynamic typing statement is wrong.  SQLite is dynamically typed in
that it allows the same column in different rows to have a different
data type.  For example in one row the column 'id' could have an integer
stored and in the next row it could be a blob.  Other SQL databases
force you to have the same type for all rows.

sqlite3_column_type reports the type you put in the column in the first
place.  With some exceptions(*) what you put in is what you get out.
However you can ask for the value to be converted for you.  For example
if you call sqlite3_result_text then SQLite will attempt to convert the
value to text for you.  Similarly sqlite3_result_int will attempt to
convert it to integer.

It does not attempt to look at your strings to see if they could pass as
integers and report them as that.  Trying to do so would be harmful as
for example text phone numbers would be mangled to integers.

In your case you put in text values with leading/trailing whitespace.
So SQLite recorded them as type text.  If you want them treated as
integers then insert them as integers and don't include whitespace!

(*) http://www.sqlite.org/datatype3.html

Roger
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkl4VWUACgkQmOOfHg372QQOcgCeN4j0BCfVpSqfYP2OY1zFjz6q
30wAoMERLgVrh4MWWI1i7pulk8DG2m1A
=HNQX
-----END PGP SIGNATURE-----
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to