And do you want to do the blob_bind when the column type is blob?  Or when the 
field is X'' format?.



I can imagine an extension where you use the column type and then have URL 
qualifiers available too.





Added:            unsigned char * blobBuffer = NULL;

                 else if( nColType[i] == SQLITE_BLOB )
                 {

                    if (strncasecmp(azCol[i],"'X",2)==0) {
                     textLen = strlen(azCol[i]);
                     // Convert from Hex to Binary.
                     blobLen = HexToByte(&blobBuffer,    azCol[i], textLen );
                     // Have sqlite make an internal copy since we may have 
multiple blobs...
                     rc = sqlite3_bind_blob(pStmt, i+1, blobBuffer, blobLen, 
SQLITE_TRANSIENT);

                     }

                     else if (strncasecmp(azCol[i],"file:",5)==0) {

                       // read file and insert as blob

                     }

                     else if (strncasecmp(azCol[i],"http:",5)==0) {

                       // read web link and insert as blob (possible image or 
such?)

                     }

                     else {

                       // unknown field type

                     }
                 }

Michael D. Black

Senior Scientist

Advanced Analytics Directorate

Advanced GEOINT Solutions Operating Unit

Northrop Grumman Information Systems

________________________________
From: [email protected] [[email protected]] on 
behalf of Black, Michael (IS) [[email protected]]
Sent: Monday, May 14, 2012 12:28 PM
To: General Discussion of SQLite Database
Subject: EXT :Re: [sqlite] Trouble importing hex encoded blob

Looks like it goes inside this loop in 3.7.12 at line 1883 of shell.c.  Could 
we get maybe a pragma ".mode csvblob" or such and have this made a permanet 
part of the shell?



      for(i=0; i<nCol; i++){
        if( azCol[i][0]=='"' ){
          int k;
          for(z=azCol[i], j=1, k=0; z[j]; j++){
            if( z[j]=='"' ){ j++; if( z[j]==0 ) break; }
            z[k++] = z[j];
          }
          z[k] = 0;
        }
        sqlite3_bind_text(pStmt, i+1, azCol[i], -1, SQLITE_STATIC);
      }



_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to