On Monday, 13 January, 2020 06:36, Dominique Devienne <ddevie...@gmail.com> 
wrote:

> Please remind me, is the encoding a "client-side" setting, or also a
> "server-side" (i.e. stored) setting?

"pragma encoding " sets the internal storage format for text encoding in a 
database (on the "inside SQLite" side of the API demarcation).  It is 
persistent (a database attribute) and cannot be changed once the database has 
been created.

The boundary between "internal" and "external" is the SQLite3 API.  Thus you 
send "external" text into SQLite using the sqlite3_bind_text* 
sqlite3_result_text* interfaces.  The call specifies the format you are using 
for the "external" representation.  When the text gets "internal" (to the other 
side of the API) it is stored (and converted if necessary to) the "pragma 
encoding" setting of the database.  You retrieve the "internal" values into 
your external program using sqlite3_column_text* and sqlite3_value_text* 
interfaces, which converts (if necessary) the data from the "internal" encoding 
to the external encoding you requested.

https://sqlite.org/pragma.html#pragma_encoding

The length() function is an external function (as in on the "exernal" side of 
the demarcation).  It retrieves its arguments using the "sqlite3_value" 
interfaces from the internal storage format into the requested external storage 
format, does its thing, and then returns an external result back into the 
"internal" part of SQLite using the sqlite3_result* interface.

Contrast this with a function such as cast(...) which is strictly internal.  It 
operates entirely internally to SQLite directly on the internal data and does 
not retrieve the "internal data" into an external format then send the 
converted external data back into SQLite.

-- 
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.




_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to