/ Check-in [ab7805fb]
Login

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

Overview
Comment:Comment changes in vdbeapi.c (CVS 2465)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: ab7805fb2fb29abc1311e23a93ba03883db7b30e
User & Date: drh 2005-05-20 19:36:01
Context
2005-05-20
20:01
Do not allow the pagesize of :memory: databases to be changed. Silently ignore PRAGMA page_size=N requests for :memory: databases. Ticket #1144 and #1252. (CVS 2466) check-in: f29a1d88 user: drh tags: trunk
19:36
Comment changes in vdbeapi.c (CVS 2465) check-in: ab7805fb user: drh tags: trunk
09:40
Fix memory leaks in Tcl user function interface. (CVS 2464) check-in: f5d9a806 user: danielk1977 tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbeapi.c.

   379    379   int sqlite3_column_type(sqlite3_stmt *pStmt, int i){
   380    380     return sqlite3_value_type( columnMem(pStmt,i) );
   381    381   }
   382    382   
   383    383   /*
   384    384   ** Convert the N-th element of pStmt->pColName[] into a string using
   385    385   ** xFunc() then return that string.  If N is out of range, return 0.
   386         -** If useType is 1, then use the second set of N elements (the datatype
   387         -** names) instead of the first set.
          386  +**
          387  +** There are up to 5 names for each column.  useType determines which
          388  +** name is returned.  Here are the names:
          389  +**
          390  +**    0      The column name as it should be displayed for output
          391  +**    1      The datatype name for the column
          392  +**    2      The name of the database that the column derives from
          393  +**    3      The name of the table that the column derives from
          394  +**    4      The name of the table column that the result column derives from
          395  +**
          396  +** If the result is not a simple column reference (if it is an expression
          397  +** or a constant) then useTypes 2, 3, and 4 return NULL.
   388    398   */
   389    399   static const void *columnName(
   390    400     sqlite3_stmt *pStmt,
   391    401     int N,
   392    402     const void *(*xFunc)(Mem*),
   393    403     int useType
   394    404   ){
   395    405     Vdbe *p = (Vdbe *)pStmt;
   396    406     int n = sqlite3_column_count(pStmt);
   397    407   
   398    408     if( p==0 || N>=n || N<0 ){
   399    409       return 0;
   400    410     }
   401         -  if( useType ){
   402         -    N += n;
   403         -  }
          411  +  N += useType*n;
   404    412     return xFunc(&p->aColName[N]);
   405    413   }
   406    414   
   407    415   
   408    416   /*
   409    417   ** Return the name of the Nth column of the result set returned by SQL
   410    418   ** statement pStmt.
   411    419   */
   412    420   const char *sqlite3_column_name(sqlite3_stmt *pStmt, int N){
   413    421     return columnName(pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, 0);
   414    422   }
          423  +#ifndef SQLITE_OMIT_UTF16
          424  +const void *sqlite3_column_name16(sqlite3_stmt *pStmt, int N){
          425  +  return columnName(pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, 0);
          426  +}
          427  +#endif
   415    428   
   416    429   /*
   417    430   ** Return the column declaration type (if applicable) of the 'i'th column
   418         -** of the result set of SQL statement pStmt, encoded as UTF-8.
          431  +** of the result set of SQL statement pStmt.
   419    432   */
   420    433   const char *sqlite3_column_decltype(sqlite3_stmt *pStmt, int N){
   421    434     return columnName(pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, 1);
   422    435   }
   423         -
   424    436   #ifndef SQLITE_OMIT_UTF16
   425         -/*
   426         -** Return the name of the 'i'th column of the result set of SQL statement
   427         -** pStmt, encoded as UTF-16.
   428         -*/
   429         -const void *sqlite3_column_name16(sqlite3_stmt *pStmt, int N){
   430         -  return columnName(pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, 0);
   431         -}
   432         -
   433         -/*
   434         -** Return the column declaration type (if applicable) of the 'i'th column
   435         -** of the result set of SQL statement pStmt, encoded as UTF-16.
   436         -*/
   437    437   const void *sqlite3_column_decltype16(sqlite3_stmt *pStmt, int N){
   438    438     return columnName(pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, 1);
   439    439   }
   440    440   #endif /* SQLITE_OMIT_UTF16 */
          441  +
          442  +#if !defined(SQLITE_OMIT_ORIGIN_NAMES) && 0
          443  +/*
          444  +** Return the name of the database from which a result column derives.
          445  +** NULL is returned if the result column is an expression or constant or
          446  +** anything else which is not an unabiguous reference to a database column.
          447  +*/
          448  +const char *sqlite3_column_database_name(sqlite3_stmt *pStmt, int N){
          449  +  return columnName(pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, 2);
          450  +}
          451  +#ifndef SQLITE_OMIT_UTF16
          452  +const void *sqlite3_column_database_name16(sqlite3_stmt *pStmt, int N){
          453  +  return columnName(pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, 2);
          454  +}
          455  +#endif /* SQLITE_OMIT_UTF16 */
          456  +
          457  +/*
          458  +** Return the name of the table from which a result column derives.
          459  +** NULL is returned if the result column is an expression or constant or
          460  +** anything else which is not an unabiguous reference to a database column.
          461  +*/
          462  +const char *sqlite3_column_table_name(sqlite3_stmt *pStmt, int N){
          463  +  return columnName(pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, 3);
          464  +}
          465  +#ifndef SQLITE_OMIT_UTF16
          466  +const void *sqlite3_column_table_name16(sqlite3_stmt *pStmt, int N){
          467  +  return columnName(pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, 3);
          468  +}
          469  +#endif /* SQLITE_OMIT_UTF16 */
          470  +
          471  +/*
          472  +** Return the name of the table column from which a result column derives.
          473  +** NULL is returned if the result column is an expression or constant or
          474  +** anything else which is not an unabiguous reference to a database column.
          475  +*/
          476  +const char *sqlite3_column_origin_name(sqlite3_stmt *pStmt, int N){
          477  +  return columnName(pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, 4);
          478  +}
          479  +#ifndef SQLITE_OMIT_UTF16
          480  +const void *sqlite3_column_origin_name16(sqlite3_stmt *pStmt, int N){
          481  +  return columnName(pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, 4);
          482  +}
          483  +#endif /* SQLITE_OMIT_UTF16 */
          484  +#endif /* SQLITE_OMIT_ORIGIN_NAMES */
          485  +
          486  +
          487  +
   441    488   
   442    489   /******************************* sqlite3_bind_  ***************************
   443    490   ** 
   444    491   ** Routines used to attach values to wildcards in a compiled SQL statement.
   445    492   */
   446    493   /*
   447    494   ** Unbind the value bound to variable i in virtual machine p. This is the