/ Check-in [6ab76c5f]
Login

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

Overview
Comment:Change the name of the _texte64() interfaces to just _test64(), without the "e".
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | 64-bit-lengths
Files: files | file ages | folders
SHA1: 6ab76c5fedfe568b0f0f34a600f9135bf6558148
User & Date: drh 2014-09-09 20:30:24
Context
2014-09-11
18:44
Add new APIs that take 64-bit length parameters: sqlite3_malloc64(), sqlite3_realloc64(), sqlite3_bind_blob64(), sqlite3_bind_text64(), sqlite3_result_blob64(), and sqlite3_result_text64(). Add the sqlite3_msize() interface. Internal memory allocation routines now use 64-bit unsigned length parameters for safety. Fix the sqlite3_get_table() to use sqlite3_realloc64() to avoid a integer overflow problem. check-in: 7e4978c0 user: drh tags: trunk
2014-09-09
20:30
Change the name of the _texte64() interfaces to just _test64(), without the "e". Closed-Leaf check-in: 6ab76c5f user: drh tags: 64-bit-lengths
18:41
Add new interfaces to the loadable extension mechanism. check-in: 18d80cbc user: drh tags: 64-bit-lengths
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/func.c.

   321    321       while( *z && p1 ){
   322    322         SQLITE_SKIP_UTF8(z);
   323    323         p1--;
   324    324       }
   325    325       for(z2=z; *z2 && p2; p2--){
   326    326         SQLITE_SKIP_UTF8(z2);
   327    327       }
   328         -    sqlite3_result_text(context, (char*)z, (int)(z2-z), SQLITE_TRANSIENT);
          328  +    sqlite3_result_text64(context, (char*)z, z2-z, SQLITE_TRANSIENT,
          329  +                          SQLITE_UTF8);
   329    330     }else{
   330    331       if( p1+p2>len ){
   331    332         p2 = len-p1;
   332    333         if( p2<0 ) p2 = 0;
   333    334       }
   334         -    sqlite3_result_blob(context, (char*)&z[p1], (int)p2, SQLITE_TRANSIENT);
          335  +    sqlite3_result_blob64(context, (char*)&z[p1], (u64)p2, SQLITE_TRANSIENT);
   335    336     }
   336    337   }
   337    338   
   338    339   /*
   339    340   ** Implementation of the round() function
   340    341   */
   341    342   #ifndef SQLITE_OMIT_FLOATING_POINT
................................................................................
  1037   1038       }else{
  1038   1039         *zOut++ = 0xF0 + (u8)((c>>18) & 0x07);
  1039   1040         *zOut++ = 0x80 + (u8)((c>>12) & 0x3F);
  1040   1041         *zOut++ = 0x80 + (u8)((c>>6) & 0x3F);
  1041   1042         *zOut++ = 0x80 + (u8)(c & 0x3F);
  1042   1043       }                                                    \
  1043   1044     }
  1044         -  sqlite3_result_text(context, (char*)z, (int)(zOut-z), sqlite3_free);
         1045  +  sqlite3_result_text64(context, (char*)z, zOut-z, sqlite3_free, SQLITE_UTF8);
  1045   1046   }
  1046   1047   
  1047   1048   /*
  1048   1049   ** The hex() function.  Interpret the argument as a blob.  Return
  1049   1050   ** a hexadecimal rendering as text.
  1050   1051   */
  1051   1052   static void hexFunc(

Changes to src/loadext.c.

   390    390     sqlite3_uri_int64,
   391    391     sqlite3_uri_parameter,
   392    392     sqlite3_vsnprintf,
   393    393     sqlite3_wal_checkpoint_v2,
   394    394     /* Version 3.8.7 and later */
   395    395     sqlite3_auto_extension,
   396    396     sqlite3_bind_blob64,
   397         -  sqlite3_bind_texte64,
          397  +  sqlite3_bind_text64,
   398    398     sqlite3_cancel_auto_extension,
   399    399     sqlite3_load_extension,
   400    400     sqlite3_malloc64,
   401    401     sqlite3_msize,
   402    402     sqlite3_realloc64,
   403    403     sqlite3_reset_auto_extension,
   404    404     sqlite3_result_blob64,
   405         -  sqlite3_result_texte64,
          405  +  sqlite3_result_text64,
   406    406     sqlite3_strglob
   407    407   };
   408    408   
   409    409   /*
   410    410   ** Attempt to load an SQLite extension library contained in the file
   411    411   ** zFile.  The entry point is zProc.  zProc may be 0 in which case a
   412    412   ** default entry point name (sqlite3_extension_init) is used.  Use

Changes to src/sqlite.h.in.

  3381   3381   ** number of <u>bytes</u> in the value, not the number of characters.)^
  3382   3382   ** ^If the fourth parameter to sqlite3_bind_text() or sqlite3_bind_text16()
  3383   3383   ** is negative, then the length of the string is
  3384   3384   ** the number of bytes up to the first zero terminator.
  3385   3385   ** If the fourth parameter to sqlite3_bind_blob() is negative, then
  3386   3386   ** the behavior is undefined.
  3387   3387   ** If a non-negative fourth parameter is provided to sqlite3_bind_text()
  3388         -** or sqlite3_bind_text16() or sqlite3_bind_texte64() then
         3388  +** or sqlite3_bind_text16() or sqlite3_bind_text64() then
  3389   3389   ** that parameter must be the byte offset
  3390   3390   ** where the NUL terminator would occur assuming the string were NUL
  3391   3391   ** terminated.  If any NUL characters occur at byte offsets less than 
  3392   3392   ** the value of the fourth parameter then the resulting string value will
  3393   3393   ** contain embedded NULs.  The result of expressions involving strings
  3394   3394   ** with embedded NULs is undefined.
  3395   3395   **
................................................................................
  3401   3401   ** ^If the fifth argument is
  3402   3402   ** the special value [SQLITE_STATIC], then SQLite assumes that the
  3403   3403   ** information is in static, unmanaged space and does not need to be freed.
  3404   3404   ** ^If the fifth argument has the value [SQLITE_TRANSIENT], then
  3405   3405   ** SQLite makes its own private copy of the data immediately, before
  3406   3406   ** the sqlite3_bind_*() routine returns.
  3407   3407   **
  3408         -** ^The sixth argument to sqlite3_bind_texte64() must be one of
         3408  +** ^The sixth argument to sqlite3_bind_text64() must be one of
  3409   3409   ** [SQLITE_UTF8], [SQLITE_UTF16], [SQLITE_UTF16BE], or [SQLITE_UTF16LE]
  3410   3410   ** to specify the encoding of the text in the third parameter.  If
  3411         -** the sixth argument to sqlite3_bind_texte64() is not how of the
         3411  +** the sixth argument to sqlite3_bind_text64() is not how of the
  3412   3412   ** allowed values shown above, or if the text encoding is different
  3413   3413   ** from the encoding specified by the sixth parameter, then the behavior
  3414   3414   ** is undefined.
  3415   3415   **
  3416   3416   ** ^The sqlite3_bind_zeroblob() routine binds a BLOB of length N that
  3417   3417   ** is filled with zeroes.  ^A zeroblob uses a fixed amount of memory
  3418   3418   ** (just an integer to hold its size) while it is being processed.
................................................................................
  3447   3447                           void(*)(void*));
  3448   3448   int sqlite3_bind_double(sqlite3_stmt*, int, double);
  3449   3449   int sqlite3_bind_int(sqlite3_stmt*, int, int);
  3450   3450   int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64);
  3451   3451   int sqlite3_bind_null(sqlite3_stmt*, int);
  3452   3452   int sqlite3_bind_text(sqlite3_stmt*,int,const char*,int,void(*)(void*));
  3453   3453   int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*));
  3454         -int sqlite3_bind_texte64(sqlite3_stmt*, int, const char*, sqlite3_uint64,
         3454  +int sqlite3_bind_text64(sqlite3_stmt*, int, const char*, sqlite3_uint64,
  3455   3455                            void(*)(void*), unsigned char encoding);
  3456   3456   int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
  3457   3457   int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
  3458   3458   
  3459   3459   /*
  3460   3460   ** CAPI3REF: Number Of SQL Parameters
  3461   3461   **
................................................................................
  4444   4444   ** of the application-defined function to be NULL.
  4445   4445   **
  4446   4446   ** ^The sqlite3_result_text(), sqlite3_result_text16(),
  4447   4447   ** sqlite3_result_text16le(), and sqlite3_result_text16be()
  4448   4448   ** set the return value of the application-defined function to be
  4449   4449   ** a text string which is represented as UTF-8, UTF-16 native byte order,
  4450   4450   ** UTF-16 little endian, or UTF-16 big endian, respectively.
  4451         -** ^The sqlite3_result_texte64() interface sets the return value of an
         4451  +** ^The sqlite3_result_text64() interface sets the return value of an
  4452   4452   ** application-defined function to be a text string in an encoding
  4453   4453   ** specified by the fifth (and last) parameter, which must be one
  4454   4454   ** of [SQLITE_UTF8], [SQLITE_UTF16], [SQLITE_UTF16BE], or [SQLITE_UTF16LE].
  4455   4455   ** ^SQLite takes the text result from the application from
  4456   4456   ** the 2nd parameter of the sqlite3_result_text* interfaces.
  4457   4457   ** ^If the 3rd parameter to the sqlite3_result_text* interfaces
  4458   4458   ** is negative, then SQLite takes result text from the 2nd parameter
................................................................................
  4502   4502   void sqlite3_result_error_toobig(sqlite3_context*);
  4503   4503   void sqlite3_result_error_nomem(sqlite3_context*);
  4504   4504   void sqlite3_result_error_code(sqlite3_context*, int);
  4505   4505   void sqlite3_result_int(sqlite3_context*, int);
  4506   4506   void sqlite3_result_int64(sqlite3_context*, sqlite3_int64);
  4507   4507   void sqlite3_result_null(sqlite3_context*);
  4508   4508   void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*));
  4509         -void sqlite3_result_texte64(sqlite3_context*, const char*,sqlite3_uint64,
  4510         -                            void(*)(void*), unsigned char encoding);
         4509  +void sqlite3_result_text64(sqlite3_context*, const char*,sqlite3_uint64,
         4510  +                           void(*)(void*), unsigned char encoding);
  4511   4511   void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*));
  4512   4512   void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));
  4513   4513   void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*));
  4514   4514   void sqlite3_result_value(sqlite3_context*, sqlite3_value*);
  4515   4515   void sqlite3_result_zeroblob(sqlite3_context*, int n);
  4516   4516   
  4517   4517   /*

Changes to src/sqlite3ext.h.

   250    250     const char *(*uri_parameter)(const char*,const char*);
   251    251     char *(*vsnprintf)(int,char*,const char*,va_list);
   252    252     int (*wal_checkpoint_v2)(sqlite3*,const char*,int,int*,int*);
   253    253     /* Version 3.8.7 and later */
   254    254     int (*auto_extension)(void(*)(void));
   255    255     int (*bind_blob64)(sqlite3_stmt*,int,const void*,sqlite3_uint64,
   256    256                        void(*)(void*));
   257         -  int (*bind_texte64)(sqlite3_stmt*,int,const char*,sqlite3_uint64,
          257  +  int (*bind_text64)(sqlite3_stmt*,int,const char*,sqlite3_uint64,
   258    258                         void(*)(void*),unsigned char);
   259    259     int (*cancel_auto_extension)(void(*)(void));
   260    260     int (*load_extension)(sqlite3*,const char*,const char*,char**);
   261    261     void *(*malloc64)(sqlite3_uint64);
   262    262     sqlite3_uint64 (*msize)(void*);
   263    263     void *(*realloc64)(void*,sqlite3_uint64);
   264    264     void (*reset_auto_extension)(void);
   265    265     void (*result_blob64)(sqlite3_context*,const void*,sqlite3_uint64,
   266    266                           void(*)(void*));
   267         -  void (*result_texte64)(sqlite3_context*,const char*,sqlite3_uint64,
          267  +  void (*result_text64)(sqlite3_context*,const char*,sqlite3_uint64,
   268    268                            void(*)(void*), unsigned char);
   269    269     int (*strglob)(const char*,const char*);
   270    270   };
   271    271   
   272    272   /*
   273    273   ** The following macros redefine the API routines so that they are
   274    274   ** redirected through the global sqlite3_api structure.
................................................................................
   483    483   #define sqlite3_uri_int64              sqlite3_api->uri_int64
   484    484   #define sqlite3_uri_parameter          sqlite3_api->uri_parameter
   485    485   #define sqlite3_uri_vsnprintf          sqlite3_api->vsnprintf
   486    486   #define sqlite3_wal_checkpoint_v2      sqlite3_api->wal_checkpoint_v2
   487    487   /* Version 3.8.7 and later */
   488    488   #define sqlite3_auto_extension         sqlite3_api->auto_extension
   489    489   #define sqlite3_bind_blob64            sqlite3_api->bind_blob64
   490         -#define sqlite3_bind_texte64           sqlite3_api->bind_texte64
          490  +#define sqlite3_bind_text64            sqlite3_api->bind_text64
   491    491   #define sqlite3_cancel_auto_extension  sqlite3_api->cancel_auto_extension
   492    492   #define sqlite3_load_extension         sqlite3_api->load_extension
   493    493   #define sqlite3_malloc64               sqlite3_api->malloc64
   494    494   #define sqlite3_msize                  sqlite3_api->msize
   495    495   #define sqlite3_realloc64              sqlite3_api->realloc64
   496    496   #define sqlite3_reset_auto_extension   sqlite3_api->reset_auto_extension
   497    497   #define sqlite3_result_blob64          sqlite3_api->result_blob64
   498         -#define sqlite3_result_texte64         sqlite3_api->result_texte64
          498  +#define sqlite3_result_text64          sqlite3_api->result_text64
   499    499   #define sqlite3_strglob                sqlite3_api->strglob
   500    500   #endif /* SQLITE_CORE */
   501    501   
   502    502   #ifndef SQLITE_CORE
   503    503     /* This case when the file really is being compiled as a loadable 
   504    504     ** extension */
   505    505   # define SQLITE_EXTENSION_INIT1     const sqlite3_api_routines *sqlite3_api=0;

Changes to src/vdbeapi.c.

   305    305     const char *z, 
   306    306     int n,
   307    307     void (*xDel)(void *)
   308    308   ){
   309    309     assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
   310    310     setResultStrOrError(pCtx, z, n, SQLITE_UTF8, xDel);
   311    311   }
   312         -void sqlite3_result_texte64(
          312  +void sqlite3_result_text64(
   313    313     sqlite3_context *pCtx, 
   314    314     const char *z, 
   315    315     sqlite3_uint64 n,
   316    316     void (*xDel)(void *),
   317    317     unsigned char enc
   318    318   ){
   319    319     assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
................................................................................
  1222   1222     int i, 
  1223   1223     const char *zData, 
  1224   1224     int nData, 
  1225   1225     void (*xDel)(void*)
  1226   1226   ){
  1227   1227     return bindText(pStmt, i, zData, nData, xDel, SQLITE_UTF8);
  1228   1228   }
  1229         -int sqlite3_bind_texte64( 
         1229  +int sqlite3_bind_text64( 
  1230   1230     sqlite3_stmt *pStmt, 
  1231   1231     int i, 
  1232   1232     const char *zData, 
  1233   1233     sqlite3_uint64 nData, 
  1234   1234     void (*xDel)(void*),
  1235   1235     unsigned char enc
  1236   1236   ){