Creating an Invalid Tcl_Obj via SQLite

Difference between version 4 and 5 - Previous - Next
if 0 {

'''Creating an Invalid [Tcl_Obj] via [SQLite]''' explores 
the interactions of [SQLite] and [Tcl].

** Description **

According to [SQLite] documentation, a '''blob''' that is '''`cast''' to
'''text''' is "interpreted" as text encoded in the database encoding.  What
that means is that SQLite '''assumes''' that the '''blob''' value is
properly-encoded, and assigns the type '''text''' to it.  Because it doesn't
verify that the value is properly encoded, it is possible store into the
database a value of type "text" invalid,  I.e. that is not properly encoded.
Later on, [SQLite] may create an invalid [Tcl_Obj] by storing the invalid text
into "bytes" field of a [Tcl_Obj].  The "bytes" field is supposed to store a
string encoded in modified utf-8.  If the data in "bytes" is not modified
utf-8, various Tcl routines fail in a variety of ways. The following example
illustrates some of that behaviour.First, some setup:


}