SQLite

Check-in [b5e85deb5a]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix to check-in (4005). A call to sqlite3_column_blob() should not make subsequent calls to sqlite3_column_type() return SQLITE_BLOB. Sqlite3_column_type() returns the initial type. (CVS 4006)
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: b5e85deb5a0316781a6f39d6085b9fcfb9f88c6d
User & Date: drh 2007-05-15 14:10:40.000
Context
2007-05-15
14:17
Change the documentation to clearly state that the result of sqlite3_column_type() is undefined following a type conversion. (CVS 4007) (check-in: 960be575e2 user: drh tags: trunk)
14:10
Fix to check-in (4005). A call to sqlite3_column_blob() should not make subsequent calls to sqlite3_column_type() return SQLITE_BLOB. Sqlite3_column_type() returns the initial type. (CVS 4006) (check-in: b5e85deb5a user: drh tags: trunk)
13:27
Clarification on the best practices for using the _bytes() APIs. Change sqlite3_value_blob() to force the representation to be purely a BLOB and not a dual BLOB/String. Ticket #2360. (CVS 4005) (check-in: cf2dd45b58 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/vdbeapi.c.
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
*/
const void *sqlite3_value_blob(sqlite3_value *pVal){
  Mem *p = (Mem*)pVal;
  if( p->flags & (MEM_Blob|MEM_Str) ){
    sqlite3VdbeMemExpandBlob(p);
    p->flags &= ~MEM_Str;
    p->flags |= MEM_Blob;
    p->type = SQLITE_BLOB;
    return p->z;
  }else{
    return sqlite3_value_text(pVal);
  }
}
int sqlite3_value_bytes(sqlite3_value *pVal){
  return sqlite3ValueBytes(pVal, SQLITE_UTF8);







<







36
37
38
39
40
41
42

43
44
45
46
47
48
49
*/
const void *sqlite3_value_blob(sqlite3_value *pVal){
  Mem *p = (Mem*)pVal;
  if( p->flags & (MEM_Blob|MEM_Str) ){
    sqlite3VdbeMemExpandBlob(p);
    p->flags &= ~MEM_Str;
    p->flags |= MEM_Blob;

    return p->z;
  }else{
    return sqlite3_value_text(pVal);
  }
}
int sqlite3_value_bytes(sqlite3_value *pVal){
  return sqlite3ValueBytes(pVal, SQLITE_UTF8);