SQLite User Forum

endian question
Login

endian question

(1) By skolson5903 on 2022-03-10 01:02:47 [source]

I've created a Sqlite 3.37.2 database with pragma UTF-16BE. Using the query encoding pragma confirms that the database encoding is BE. If I then create a table, query sqlite_master, and use sqlite_column_bytes16 to get the table name from the appropriate column, the bytes retrieved are little endian. If I create a database with encoding UTF-16LE, doing the same sequence also returns the results encoded little endian. The machine the database is running on is little endian hardware. Is this expected behavior of sqlite_column_bytes16? The doc makes it sound like if the DB encoding is big endian, then sqlite_column_bytes16 should return big endian. Is sqlite_column_bytes16 returning little endian regardless of the db encoding, because it is running on a little endian machine (an auto-conversion)? Thanks in advance for any info...

(2) By Richard Hipp (drh) on 2022-03-10 01:15:10 in reply to 1 [link] [source]

The "text16" interface always return results in the native byte-order of the platform. I thought the documentation said this, but I just now looked and couldn't find it. Apparently, that detail was omitted. I'll try to get it corrected.

(3) By skolson5903 on 2022-03-10 01:42:59 in reply to 2 [link] [source]

Thanks!