Kevin M. <athlo...@yahoo.com> wrote: >> Why is 99 a 16-bit integer value and not, say, an 8-bit or a 32-bit >> one? How is SQLite supposed to know? > > How would SQLite know if "99" is 16-bit, 8-bit, 32-bit, etc... using > the CREATE TABLE specified data types as a hint.
INT1, INT2 and so on don't have any special meaning to SQLite. You are engaging in wishful thinking. See also http://sqlite.org/datatype3.html >> sqlite3_column_bytes is really only meaningful for strings and blobs, > not for numbers. > > Perhaps, but I know for SQLITE_INTEGER type it gives me either 1, 2, > or 4 for various inputs I've tried. It's just not always the same as > the original value used. What do you mean, "original value used"? What original value, used where and how? SQLite doesn't provide any way to specify how many bytes of storage you want reserved for a number. >>> E.g.: >>> >>> CREATE TABLE test ( val1 > INTEGER, val2 INT2, val3 INT1 ... ); >>> >>> Here val1 > is always 4-bytes, val2 is always 2 bytes, and val3 is >>> > always 1 byte. > >> Well, if you want to invent a naming > convention like that, why don't you act on it yourself? Retrieve the > type name with sqlite3_column_decltype, handle it as you see fit. > > That was just an example, not an actual table declaration for this > app. I'm confused. Do you, or don't you, want to use type names like INT1 or INT2 to indicate the width in bytes of an integer field? If you do, you can act on them yourself using sqlite3_column_decltype. If you don't, the question remains: how do you plan to indicate the width of the field? > So, basically I either store everything as a blob and lose the > ability to query individual columns, or I have to rework a lot of > existing code (the app uses MySQL now) to work with SQLite's own > nuances? Yes. -- Igor Tandetnik _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users