ext/pdo_sqlite/sqlite/src/prepare.c
/*
** Compile the UTF-16 encoded SQL statement zSql into a statement handle.
*/
Compile the UTF-16 encoded SQL statement zSql into a statement handle.
Compile the UTF - 16 encoded SQL statement zSql into a statement handle .
static int sqlite3Prepare16(
  sqlite3 *db,               
  const void *zSql,         
  int nBytes,               
  int saveSqlFlag,          
  sqlite3_stmt **ppStmt,    
  const void **pzTail       
){
  char *zSql8;
  const char *zTail8 = 0;
  int rc = SQLITE_OK;
  if( sqlite3SafetyCheck(db) ){
    return SQLITE_MISUSE;
  }
  zSql8 = sqlite3utf16to8(zSql, nBytes);
  if( zSql8 ){
    rc = sqlite3Prepare(db, zSql8, -1, saveSqlFlag, ppStmt, &zTail8);
  }
  if( zTail8 && pzTail ){
    int chars_parsed = sqlite3utf8CharLen(zSql8, zTail8-zSql8);
    *pzTail = (u8 *)zSql + sqlite3utf16ByteLen(zSql, chars_parsed);
  }
  sqliteFree(zSql8); 
  return sqlite3ApiExit(db, rc);
}
static int sqlite3Prepare16 ( sqlite3 * db , const void * zSql , int nBytes , int saveSqlFlag , sqlite3_stmt * * ppStmt , const void * * pzTail ) { char * zSql8 ; const char * zTail8 = 0 ; int rc = SQLITE_OK ; if ( sqlite3SafetyCheck ( db ) ) { return SQLITE_MISUSE ; } zSql8 = sqlite3utf16to8 ( zSql , nBytes ) ; if ( zSql8 ) { rc = sqlite3Prepare ( db , zSql8 , -1 , saveSqlFlag , ppStmt , & zTail8 ) ; } if ( zTail8 && pzTail ) { int chars_parsed = sqlite3utf8CharLen ( zSql8 , zTail8 - zSql8 ) ; * pzTail = ( u8 * ) zSql + sqlite3utf16ByteLen ( zSql , chars_parsed ) ; } sqliteFree ( zSql8 ) ; return sqlite3ApiExit ( db , rc ) ; }
Compile the UTF-16 encoded SQL statement zSql into a statement handle.
Compile the UTF - 16 encoded SQL statement zSql into a statement handle .
/* Database handle. */ /* UTF-8 encoded SQL statement. */ /* Length of zSql in bytes. */ /* True to save SQL text into the sqlite3_stmt */ /* OUT: A pointer to the prepared statement */ /* OUT: End of parsed string */ /* This function currently works by first transforming the UTF-16
  ** encoded string to UTF-8, then invoking sqlite3_prepare(). The
  ** tricky bit is figuring out the pointer to return in *pzTail.
  */ /* If sqlite3_prepare returns a tail pointer, we calculate the
    ** equivalent pointer into the UTF-16 string by counting the unicode
    ** characters between zSql8 and zTail8, and then returning a pointer
    ** the same number of characters into the UTF-16 string.
    */