On 1/6/15, Nelson, Erik - 2 <erik.l.nel...@bankofamerica.com> wrote: > This is part of a larger application, but what I *think* is happening is > using a table definition like > > create table tester(id text collate nocase) > > and a prepared statement like > > insert into tester values(?) > > then calling bind something like this pseudocode > > sqlite3_bind_text(stmt, column, "1000000000000000000000000", len, > SQLITE_TRANSIENT) > > converts the value to a textual scientific notation representation, like
Nope. SQLite is not doing this. Something else is going on. sqlite3_bind_text() does not do conversions when inserting into a column with TEXT affinity. > > select typeof(id) from tester --> text > select * from tester --> 1.0e+24 > > so it looks like the column affinity is text, but the original string has > been destroyed. > > I know that the datatype page mentions that numerical data is converted to > text form before being stored, so I'm guessing that the text is being > identified as a number. > > From poking about on the net, it seems like the viable options are to > > 1. use bind_blob > 2. use bind_text but with some hack to the text so it's not identified as a > number > > Is there any way to force the bind_text() to store the input text verbatim? > Looking through the amalgamation, it looks like the coercion might be > happening around sqlite3_value_numeric_type and applyNumericAffinity - might > it a practical to make the numeric conversion fail if it doesn't round-trip > to the original text? Or is that going to cause other problems? > > > > > > > > ---------------------------------------------------------------------- > This message, and any attachments, is for the intended recipient(s) only, > may contain information that is privileged, confidential and/or proprietary > and subject to important terms and conditions available at > http://www.bankofamerica.com/emaildisclaimer. If you are not the intended > recipient, please delete this message. > _______________________________________________ > sqlite-users mailing list > sqlite-users@sqlite.org > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- D. Richard Hipp d...@sqlite.org _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users