extralite-bundle 3.0.1 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  /******************************************************************************
2
2
  ** This file is an amalgamation of many separate C source files from SQLite
3
- ** version 3.53.3. By combining all the individual C code files into this
3
+ ** version 3.53.4. By combining all the individual C code files into this
4
4
  ** single large file, the entire code can be compiled as a single translation
5
5
  ** unit. This allows many compilers to do optimizations that would not be
6
6
  ** possible if the files were compiled separately. Performance improvements
@@ -18,7 +18,7 @@
18
18
  ** separate file. This file contains only code for the core SQLite library.
19
19
  **
20
20
  ** The content in this amalgamation comes from Fossil check-in
21
- ** d4c0e51e4aeb96955b99185ab9cde75c339e with changes in files:
21
+ ** bf7c7f30031888f4e796e429ab3978879485 with changes in files:
22
22
  **
23
23
  **
24
24
  */
@@ -467,12 +467,12 @@ extern "C" {
467
467
  ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
468
468
  ** [sqlite_version()] and [sqlite_source_id()].
469
469
  */
470
- #define SQLITE_VERSION "3.53.3"
471
- #define SQLITE_VERSION_NUMBER 3053003
472
- #define SQLITE_SOURCE_ID "2026-06-26 20:14:12 d4c0e51e4aeb96955b99185ab9cde75c339e2c29c3f3f12428d364a10d782c62"
470
+ #define SQLITE_VERSION "3.53.4"
471
+ #define SQLITE_VERSION_NUMBER 3053004
472
+ #define SQLITE_SOURCE_ID "2026-07-24 19:02:57 bf7c7f30031888f4e796e429ab3978879485813aaca6f641c7b33e4e09459bcc"
473
473
  #define SQLITE_SCM_BRANCH "branch-3.53"
474
- #define SQLITE_SCM_TAGS "release version-3.53.3"
475
- #define SQLITE_SCM_DATETIME "2026-06-26T20:14:12.354Z"
474
+ #define SQLITE_SCM_TAGS "release version-3.53.4"
475
+ #define SQLITE_SCM_DATETIME "2026-07-24T19:02:57.525Z"
476
476
 
477
477
  /*
478
478
  ** CAPI3REF: Run-Time Library Version Numbers
@@ -27591,7 +27591,7 @@ SQLITE_PRIVATE int sqlite3OsCurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_int64 *p
27591
27591
  }else{
27592
27592
  double r;
27593
27593
  rc = pVfs->xCurrentTime(pVfs, &r);
27594
- *pTimeOut = (sqlite3_int64)(r*86400000.0);
27594
+ *pTimeOut = sqlite3RealToI64(r*86400000.0);
27595
27595
  }
27596
27596
  return rc;
27597
27597
  }
@@ -60969,7 +60969,7 @@ static int readSuperJournal(sqlite3_file *pJrnl, u64 nSuper, char **pzSuper){
60969
60969
  cksum -= zOut[u];
60970
60970
  }
60971
60971
  }
60972
- if( rc!=SQLITE_OK || cksum ){
60972
+ if( rc!=SQLITE_OK || cksum || zOut[0]==0 ){
60973
60973
  /* If the checksum doesn't add up, then one or more of the disk sectors
60974
60974
  ** containing the super-journal filename is corrupted. This means
60975
60975
  ** definitely roll back, so just return SQLITE_OK and report a (nul)
@@ -111437,11 +111437,20 @@ static SQLITE_NOINLINE void resolveSetExprSubtypeArg(ExprList *pList){
111437
111437
  nn = pList ? pList->nExpr : 0;
111438
111438
  for(ii=0; ii<nn; ii++){
111439
111439
  Expr *pExpr = pList->a[ii].pExpr;
111440
- ExprSetProperty(pExpr, EP_SubtArg);
111441
- if( pExpr->op==TK_SELECT ){
111442
- assert( ExprUseXSelect(pExpr) );
111443
- assert( pExpr->x.pSelect!=0 );
111444
- resolveSetExprSubtypeArg(pExpr->x.pSelect->pEList);
111440
+ while( 1 /*exit-by-break*/ ){
111441
+ ExprSetProperty(pExpr, EP_SubtArg);
111442
+ if( pExpr->op==TK_SELECT ){
111443
+ assert( ExprUseXSelect(pExpr) );
111444
+ assert( pExpr->x.pSelect!=0 );
111445
+ resolveSetExprSubtypeArg(pExpr->x.pSelect->pEList);
111446
+ break;
111447
+ }
111448
+ if( pExpr->op==TK_UPLUS ){
111449
+ pExpr = pExpr->pLeft;
111450
+ assert( pExpr!=0 );
111451
+ }else{
111452
+ break;
111453
+ }
111445
111454
  }
111446
111455
  }
111447
111456
  }
@@ -176954,7 +176963,7 @@ static void nth_valueStepFunc(
176954
176963
  break;
176955
176964
  case SQLITE_FLOAT: {
176956
176965
  double fVal = sqlite3_value_double(apArg[1]);
176957
- if( ((i64)fVal)!=fVal ) goto error_out;
176966
+ if( sqlite3RealToI64(fVal)!=fVal ) goto error_out;
176958
176967
  iVal = (i64)fVal;
176959
176968
  break;
176960
176969
  }
@@ -210776,8 +210785,8 @@ static int fts3StringAppend(
210776
210785
  ** to grow the buffer until so that it is big enough to accommodate the
210777
210786
  ** appended data.
210778
210787
  */
210779
- if( pStr->n+nAppend+1>=pStr->nAlloc ){
210780
- sqlite3_int64 nAlloc = pStr->nAlloc+(sqlite3_int64)nAppend+100;
210788
+ if( (i64)pStr->n+(i64)nAppend+1>=(i64)pStr->nAlloc ){
210789
+ i64 nAlloc = pStr->nAlloc+(i64)nAppend+100;
210781
210790
  char *zNew = sqlite3_realloc64(pStr->z, nAlloc);
210782
210791
  if( !zNew ){
210783
210792
  return SQLITE_NOMEM;
@@ -214981,7 +214990,8 @@ static u32 jsonTranslateBlobToText(
214981
214990
  if( sz==0 ) goto malformed_jsonb;
214982
214991
  if( zIn[0]=='-' ){
214983
214992
  jsonAppendChar(pOut, '-');
214984
- k++;
214993
+ if( sz<=1 ) goto malformed_jsonb;
214994
+ k = 1;
214985
214995
  }
214986
214996
  if( zIn[k]=='.' ){
214987
214997
  jsonAppendChar(pOut, '0');
@@ -217945,7 +217955,9 @@ static int jsonSkipLabel(JsonEachCursor *p){
217945
217955
  if( p->eType==JSONB_OBJECT ){
217946
217956
  u32 sz = 0;
217947
217957
  u32 n = jsonbPayloadSize(&p->sParse, p->i, &sz);
217948
- return p->i + n + sz;
217958
+ sz += p->i + n;
217959
+ if( sz >= p->sParse.nBlob ) sz = p->i;
217960
+ return sz;
217949
217961
  }else{
217950
217962
  return p->i;
217951
217963
  }
@@ -226906,8 +226918,8 @@ static int rbuDeltaApply(
226906
226918
  int lenDelta, /* Length of the delta */
226907
226919
  char *zOut /* Write the output into this preallocated buffer */
226908
226920
  ){
226909
- unsigned int limit;
226910
- unsigned int total = 0;
226921
+ sqlite3_uint64 limit;
226922
+ sqlite3_uint64 total = 0;
226911
226923
  #if RBU_ENABLE_DELTA_CKSUM
226912
226924
  char *zOrigOut = zOut;
226913
226925
  #endif
@@ -226917,8 +226929,8 @@ static int rbuDeltaApply(
226917
226929
  /* ERROR: size integer not terminated by "\n" */
226918
226930
  return -1;
226919
226931
  }
226920
- zDelta++; lenDelta--;
226921
- while( *zDelta && lenDelta>0 ){
226932
+ zDelta++; lenDelta--; /* Skip the \n */
226933
+ while( lenDelta>0 && zDelta[0] ){
226922
226934
  unsigned int cnt, ofst;
226923
226935
  cnt = rbuDeltaGetInt(&zDelta, &lenDelta);
226924
226936
  if( lenDelta<=0 ) return -1;
@@ -226926,7 +226938,7 @@ static int rbuDeltaApply(
226926
226938
  case '@': {
226927
226939
  zDelta++; lenDelta--;
226928
226940
  ofst = rbuDeltaGetInt(&zDelta, &lenDelta);
226929
- if( lenDelta>0 || zDelta[0]!=',' ){
226941
+ if( lenDelta>0 && zDelta[0]!=',' ){
226930
226942
  /* ERROR: copy command not terminated by ',' */
226931
226943
  return -1;
226932
226944
  }
@@ -226951,7 +226963,7 @@ static int rbuDeltaApply(
226951
226963
  /* ERROR: insert command gives an output larger than predicted */
226952
226964
  return -1;
226953
226965
  }
226954
- if( (i64)cnt>(i64)lenDelta ){
226966
+ if( cnt>lenDelta ){
226955
226967
  /* ERROR: insert count exceeds size of delta */
226956
226968
  return -1;
226957
226969
  }
@@ -228964,13 +228976,13 @@ static int rbuGetUpdateStmt(
228964
228976
  char *zUpdate = 0;
228965
228977
 
228966
228978
  pUp->zMask = (char*)&pUp[1];
228967
- memcpy(pUp->zMask, zMask, pIter->nTblCol);
228968
228979
  pUp->pNext = pIter->pRbuUpdate;
228969
228980
  pIter->pRbuUpdate = pUp;
228970
228981
 
228971
228982
  if( zSet ){
228972
228983
  const char *zPrefix = "";
228973
-
228984
+ assert( p->rc==SQLITE_OK );
228985
+ memcpy(pUp->zMask, zMask, pIter->nTblCol);
228974
228986
  if( pIter->eType!=RBU_PK_VTAB ) zPrefix = "rbu_imp_";
228975
228987
  zUpdate = sqlite3_mprintf("UPDATE \"%s%w\" SET %s WHERE %s",
228976
228988
  zPrefix, pIter->zTbl, zSet, zWhere
@@ -229060,6 +229072,9 @@ static RbuState *rbuLoadState(sqlite3rbu *p){
229060
229072
 
229061
229073
  case RBU_STATE_ROW:
229062
229074
  pRet->nRow = sqlite3_column_int(pStmt, 1);
229075
+ if( pRet->nRow<0 ){
229076
+ rc = SQLITE_CORRUPT;
229077
+ }
229063
229078
  break;
229064
229079
 
229065
229080
  case RBU_STATE_PROGRESS:
@@ -240296,7 +240311,12 @@ static int sessionChangesetToHash(
240296
240311
 
240297
240312
  pIter->in.bNoDiscard = 1;
240298
240313
  while( SQLITE_ROW==(sessionChangesetNext(pIter, &aRec, &nRec, 0)) ){
240299
- rc = sessionOneChangeIterToHash(pGrp, pIter, bRebase);
240314
+ if( bRebase && pIter->bPatchset ){
240315
+ /* A patchset may not be used as a rebase */
240316
+ rc = SQLITE_ERROR;
240317
+ }else{
240318
+ rc = sessionOneChangeIterToHash(pGrp, pIter, bRebase);
240319
+ }
240300
240320
  if( rc!=SQLITE_OK ) break;
240301
240321
  }
240302
240322
 
@@ -240673,13 +240693,14 @@ static void sessionAppendPartialUpdate(
240673
240693
  int i;
240674
240694
  u8 *a1 = aRec;
240675
240695
  u8 *a2 = aChange;
240696
+ u8 *a2Eof = &a2[nChange];
240676
240697
 
240677
240698
  *pOut++ = SQLITE_UPDATE;
240678
240699
  *pOut++ = pIter->bIndirect;
240679
240700
  for(i=0; i<pIter->nCol; i++){
240680
240701
  int n1 = sessionSerialLen(a1);
240681
- int n2 = sessionSerialLen(a2);
240682
- if( pIter->abPK[i] || a2[0]==0 ){
240702
+ int n2 = (a2>=a2Eof) ? 0 : sessionSerialLen(a2);
240703
+ if( n2<=0 || pIter->abPK[i] || a2[0]==0 ){
240683
240704
  if( !pIter->abPK[i] && a1[0] ) bData = 1;
240684
240705
  memcpy(pOut, a1, n1);
240685
240706
  pOut += n1;
@@ -240880,8 +240901,8 @@ SQLITE_API int sqlite3rebaser_configure(
240880
240901
  sqlite3_rebaser *p,
240881
240902
  int nRebase, const void *pRebase
240882
240903
  ){
240883
- sqlite3_changeset_iter *pIter = 0; /* Iterator opened on pData/nData */
240884
240904
  int rc; /* Return code */
240905
+ sqlite3_changeset_iter *pIter = 0; /* Iterator opened on pData/nData */
240885
240906
  rc = sqlite3changeset_start(&pIter, nRebase, (void*)pRebase);
240886
240907
  if( rc==SQLITE_OK ){
240887
240908
  rc = sessionChangesetToHash(pIter, &p->grp, 1);
@@ -251701,6 +251722,7 @@ static Fts5Data *fts5DataRead(Fts5Index *p, i64 iRowid){
251701
251722
  pRet = (Fts5Data*)sqlite3_malloc64(nAlloc);
251702
251723
  if( pRet ){
251703
251724
  pRet->nn = nByte;
251725
+ pRet->szLeaf = 0;
251704
251726
  aOut = pRet->p = (u8*)pRet + szData;
251705
251727
  }else{
251706
251728
  rc = SQLITE_NOMEM;
@@ -251713,10 +251735,8 @@ static Fts5Data *fts5DataRead(Fts5Index *p, i64 iRowid){
251713
251735
  sqlite3_free(pRet);
251714
251736
  pRet = 0;
251715
251737
  }else{
251716
- /* TODO1: Fix this */
251717
251738
  pRet->p[nByte] = 0x00;
251718
251739
  pRet->p[nByte+1] = 0x00;
251719
- pRet->szLeaf = fts5GetU16(&pRet->p[2]);
251720
251740
  }
251721
251741
  }
251722
251742
  p->rc = rc;
@@ -251737,9 +251757,17 @@ static void fts5DataRelease(Fts5Data *pData){
251737
251757
  sqlite3_free(pData);
251738
251758
  }
251739
251759
 
251760
+ /*
251761
+ ** Read a leaf-page record. This is similar to fts5DataRead(), except that
251762
+ ** it fills in the Fts5Data.szLeaf value before returning.
251763
+ */
251740
251764
  static Fts5Data *fts5LeafRead(Fts5Index *p, i64 iRowid){
251741
251765
  Fts5Data *pRet = fts5DataRead(p, iRowid);
251742
251766
  if( pRet ){
251767
+ assert( pRet->szLeaf==0 );
251768
+ if( pRet->nn>=4 ){
251769
+ pRet->szLeaf = fts5GetU16(&pRet->p[2]);
251770
+ }
251743
251771
  if( pRet->szLeaf<4 || pRet->szLeaf>pRet->nn ){
251744
251772
  FTS5_CORRUPT_ROWID(p, iRowid);
251745
251773
  fts5DataRelease(pRet);
@@ -253649,6 +253677,10 @@ static void fts5SegIterNextInit(
253649
253677
 
253650
253678
  pIter->iPgidxOff = pIter->pLeaf->szLeaf;
253651
253679
  pIter->iPgidxOff += fts5GetVarint32(&a[pIter->iPgidxOff], iTermOff);
253680
+ if( iTermOff > pIter->pLeaf->szLeaf ){
253681
+ p->rc = FTS5_CORRUPT;
253682
+ return;
253683
+ }
253652
253684
  pIter->iLeafOffset = iTermOff;
253653
253685
  fts5SegIterLoadTerm(p, pIter, 0);
253654
253686
  fts5SegIterLoadNPos(p, pIter);
@@ -255975,7 +256007,7 @@ static void fts5SecureDeleteOverflow(
255975
256007
  int iNext = 0;
255976
256008
  u8 *aPg = 0;
255977
256009
 
255978
- pLeaf = fts5DataRead(p, iRowid);
256010
+ pLeaf = fts5LeafRead(p, iRowid);
255979
256011
  if( pLeaf==0 ) break;
255980
256012
  aPg = pLeaf->p;
255981
256013
 
@@ -255983,7 +256015,7 @@ static void fts5SecureDeleteOverflow(
255983
256015
  if( iNext!=0 ){
255984
256016
  *pbLastInDoclist = 0;
255985
256017
  }
255986
- if( iNext==0 && pLeaf->szLeaf!=pLeaf->nn ){
256018
+ if( iNext==0 && pLeaf->szLeaf<pLeaf->nn ){
255987
256019
  fts5GetVarint32(&aPg[pLeaf->szLeaf], iNext);
255988
256020
  }
255989
256021
 
@@ -256270,7 +256302,7 @@ static void fts5DoSecureDelete(
256270
256302
  /* The entry being removed may be the only position list in
256271
256303
  ** its doclist. */
256272
256304
  for(iPgno=pSeg->iLeafPgno-1; iPgno>pSeg->iTermLeafPgno; iPgno-- ){
256273
- Fts5Data *pPg = fts5DataRead(p, FTS5_SEGMENT_ROWID(iSegid, iPgno));
256305
+ Fts5Data *pPg = fts5LeafRead(p, FTS5_SEGMENT_ROWID(iSegid, iPgno));
256274
256306
  int bEmpty = (pPg && pPg->nn==4);
256275
256307
  fts5DataRelease(pPg);
256276
256308
  if( bEmpty==0 ) break;
@@ -256278,7 +256310,7 @@ static void fts5DoSecureDelete(
256278
256310
 
256279
256311
  if( iPgno==pSeg->iTermLeafPgno ){
256280
256312
  i64 iId = FTS5_SEGMENT_ROWID(iSegid, pSeg->iTermLeafPgno);
256281
- Fts5Data *pTerm = fts5DataRead(p, iId);
256313
+ Fts5Data *pTerm = fts5LeafRead(p, iId);
256282
256314
  if( pTerm && pTerm->szLeaf==pSeg->iTermLeafOffset ){
256283
256315
  u8 *aTermIdx = &pTerm->p[pTerm->szLeaf];
256284
256316
  int nTermIdx = pTerm->nn - pTerm->szLeaf;
@@ -259230,7 +259262,7 @@ static void fts5IndexIntegrityCheckEmpty(
259230
259262
  /* Now check that the iter.nEmpty leaves following the current leaf
259231
259263
  ** (a) exist and (b) contain no terms. */
259232
259264
  for(i=iFirst; p->rc==SQLITE_OK && i<=iLast; i++){
259233
- Fts5Data *pLeaf = fts5DataRead(p, FTS5_SEGMENT_ROWID(pSeg->iSegid, i));
259265
+ Fts5Data *pLeaf = fts5LeafRead(p, FTS5_SEGMENT_ROWID(pSeg->iSegid, i));
259234
259266
  if( pLeaf ){
259235
259267
  if( !fts5LeafIsTermless(pLeaf)
259236
259268
  || (i>=iNoRowid && 0!=fts5LeafFirstRowidOff(pLeaf))
@@ -259358,7 +259390,7 @@ static void fts5IndexIntegrityCheckSegment(
259358
259390
  FTS5_CORRUPT_ROWID(p, iRow);
259359
259391
  }else{
259360
259392
  iOff += fts5GetVarint32(&pLeaf->p[iOff], nTerm);
259361
- if( iOff+nTerm>pLeaf->szLeaf ){
259393
+ if( (i64)iOff+(i64)nTerm>(i64)pLeaf->szLeaf ){
259362
259394
  FTS5_CORRUPT_ROWID(p, iRow);
259363
259395
  }else{
259364
259396
  res = fts5Memcmp(&pLeaf->p[iOff], zIdxTerm, MIN(nTerm, nIdxTerm));
@@ -263086,19 +263118,23 @@ static int fts5ApiPhraseFirstColumn(
263086
263118
 
263087
263119
  if( pConfig->eDetail==FTS5_DETAIL_COLUMNS ){
263088
263120
  Fts5Sorter *pSorter = pCsr->pSorter;
263089
- int n;
263090
- if( pSorter ){
263091
- int i1 = (iPhrase==0 ? 0 : pSorter->aIdx[iPhrase-1]);
263092
- n = pSorter->aIdx[iPhrase] - i1;
263093
- pIter->a = &pSorter->aPoslist[i1];
263121
+ if( iPhrase<0 || iPhrase>=sqlite3Fts5ExprPhraseCount(pCsr->pExpr) ){
263122
+ rc = SQLITE_RANGE;
263094
263123
  }else{
263095
- rc = sqlite3Fts5ExprPhraseCollist(pCsr->pExpr, iPhrase, &pIter->a, &n);
263096
- }
263097
- if( rc==SQLITE_OK ){
263098
- assert( pIter->a || n==0 );
263099
- pIter->b = (pIter->a ? &pIter->a[n] : 0);
263100
- *piCol = 0;
263101
- fts5ApiPhraseNextColumn(pCtx, pIter, piCol);
263124
+ int n;
263125
+ if( pSorter ){
263126
+ int i1 = (iPhrase==0 ? 0 : pSorter->aIdx[iPhrase-1]);
263127
+ n = pSorter->aIdx[iPhrase] - i1;
263128
+ pIter->a = &pSorter->aPoslist[i1];
263129
+ }else{
263130
+ rc = sqlite3Fts5ExprPhraseCollist(pCsr->pExpr, iPhrase, &pIter->a, &n);
263131
+ }
263132
+ if( rc==SQLITE_OK ){
263133
+ assert( pIter->a || n==0 );
263134
+ pIter->b = (pIter->a ? &pIter->a[n] : 0);
263135
+ *piCol = 0;
263136
+ fts5ApiPhraseNextColumn(pCtx, pIter, piCol);
263137
+ }
263102
263138
  }
263103
263139
  }else{
263104
263140
  int n;
@@ -264006,7 +264042,7 @@ static void fts5SourceIdFunc(
264006
264042
  ){
264007
264043
  assert( nArg==0 );
264008
264044
  UNUSED_PARAM2(nArg, apUnused);
264009
- sqlite3_result_text(pCtx, "fts5: 2026-06-26 20:14:12 d4c0e51e4aeb96955b99185ab9cde75c339e2c29c3f3f12428d364a10d782c62", -1, SQLITE_TRANSIENT);
264045
+ sqlite3_result_text(pCtx, "fts5: 2026-07-24 19:02:57 bf7c7f30031888f4e796e429ab3978879485813aaca6f641c7b33e4e09459bcc", -1, SQLITE_TRANSIENT);
264010
264046
  }
264011
264047
 
264012
264048
  /*
@@ -146,12 +146,12 @@ extern "C" {
146
146
  ** [sqlite3_libversion_number()], [sqlite3_sourceid()],
147
147
  ** [sqlite_version()] and [sqlite_source_id()].
148
148
  */
149
- #define SQLITE_VERSION "3.53.3"
150
- #define SQLITE_VERSION_NUMBER 3053003
151
- #define SQLITE_SOURCE_ID "2026-06-26 20:14:12 d4c0e51e4aeb96955b99185ab9cde75c339e2c29c3f3f12428d364a10d782c62"
149
+ #define SQLITE_VERSION "3.53.4"
150
+ #define SQLITE_VERSION_NUMBER 3053004
151
+ #define SQLITE_SOURCE_ID "2026-07-24 19:02:57 bf7c7f30031888f4e796e429ab3978879485813aaca6f641c7b33e4e09459bcc"
152
152
  #define SQLITE_SCM_BRANCH "branch-3.53"
153
- #define SQLITE_SCM_TAGS "release version-3.53.3"
154
- #define SQLITE_SCM_DATETIME "2026-06-26T20:14:12.354Z"
153
+ #define SQLITE_SCM_TAGS "release version-3.53.4"
154
+ #define SQLITE_SCM_DATETIME "2026-07-24T19:02:57.525Z"
155
155
 
156
156
  /*
157
157
  ** CAPI3REF: Run-Time Library Version Numbers
@@ -1,4 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Extralite
2
- # Extralite version
3
- VERSION = '3.0.1'
4
+ VERSION = '3.1.0'
4
5
  end
data/lib/extralite.rb CHANGED
@@ -304,7 +304,8 @@ module Extralite
304
304
 
305
305
  def pragma_set(values)
306
306
  sql = values.inject(+'') { |s, (k, v)| s += "pragma #{k}=#{v}; " }
307
- query(sql)
307
+ execute(sql)
308
+ self
308
309
  end
309
310
 
310
311
  def pragma_get(key)
@@ -86,15 +86,15 @@ module Sequel
86
86
 
87
87
  class Database < Sequel::Database
88
88
  include ::Sequel::SQLite::DatabaseMethods
89
-
89
+
90
90
  set_adapter_scheme :extralite
91
-
91
+
92
92
  # Mimic the file:// uri, by having 2 preceding slashes specify a relative
93
93
  # path, and 3 preceding slashes specify an absolute path.
94
94
  def self.uri_to_options(uri) # :nodoc:
95
95
  { :database => (uri.host.nil? && uri.path == '/') ? nil : "#{uri.host}#{uri.path}" }
96
96
  end
97
-
97
+
98
98
  private_class_method :uri_to_options
99
99
 
100
100
  # The conversion procs to use for this database
@@ -129,12 +129,12 @@ module Sequel
129
129
  func.result = Regexp.new(regexp_str).match(string) ? 1 : 0
130
130
  end
131
131
  end
132
-
132
+
133
133
  class << db
134
134
  attr_reader :prepared_statements
135
135
  end
136
136
  db.instance_variable_set(:@prepared_statements, {})
137
-
137
+
138
138
  db
139
139
  end
140
140
 
@@ -148,7 +148,7 @@ module Sequel
148
148
  def disconnect_connection(c)
149
149
  c.close
150
150
  end
151
-
151
+
152
152
  # Run the given SQL with the given arguments and yield each row.
153
153
  def execute(sql, opts=OPTS, &block)
154
154
  _execute(:select, sql, opts, &block)
@@ -158,7 +158,7 @@ module Sequel
158
158
  def execute_dui(sql, opts=OPTS)
159
159
  _execute(:update, sql, opts)
160
160
  end
161
-
161
+
162
162
  # Drop any prepared statements on the connection when executing DDL. This is because
163
163
  # prepared statements lock the table in such a way that you can't drop or alter the
164
164
  # table while a prepared statement that references it still exists.
@@ -169,11 +169,11 @@ module Sequel
169
169
  super
170
170
  end
171
171
  end
172
-
172
+
173
173
  def execute_insert(sql, opts=OPTS)
174
174
  _execute(:insert, sql, opts)
175
175
  end
176
-
176
+
177
177
  def freeze
178
178
  @conversion_procs.freeze
179
179
  super
@@ -194,13 +194,13 @@ module Sequel
194
194
  end
195
195
 
196
196
  private
197
-
197
+
198
198
  def adapter_initialize
199
199
  @conversion_procs = SQLITE_TYPES.dup
200
200
  @conversion_procs['datetime'] = @conversion_procs['timestamp'] = method(:to_application_timestamp)
201
201
  set_integer_booleans
202
202
  end
203
-
203
+
204
204
  # Yield an available connection. Rescue
205
205
  # any Extralite::Errors and turn them into DatabaseErrors.
206
206
  def _execute(type, sql, opts, &block)
@@ -228,7 +228,7 @@ module Sequel
228
228
  rescue ::Extralite::Error => e
229
229
  raise_error(e)
230
230
  end
231
-
231
+
232
232
  # The Extralite adapter does not need the pool to convert exceptions.
233
233
  # Also, force the max connections to 1 if a memory database is being
234
234
  # used, as otherwise each connection gets a separate database.
@@ -239,7 +239,7 @@ module Sequel
239
239
  o[:max_connections] = 1 if @opts[:database] == ':memory:' || blank_object?(@opts[:database])
240
240
  o
241
241
  end
242
-
242
+
243
243
  def prepared_statement_argument(arg)
244
244
  case arg
245
245
  when Date, DateTime, Time
@@ -295,7 +295,7 @@ module Sequel
295
295
  end
296
296
  end
297
297
  end
298
-
298
+
299
299
  def database_error_classes
300
300
  [::Extralite::Error]
301
301
  end
@@ -308,15 +308,15 @@ module Sequel
308
308
  exception.code if exception.respond_to?(:code)
309
309
  end
310
310
  end
311
-
311
+
312
312
  class Dataset < Sequel::Dataset
313
313
  include ::Sequel::SQLite::DatasetMethods
314
314
 
315
315
  module ArgumentMapper
316
316
  include Sequel::Dataset::ArgumentMapper
317
-
317
+
318
318
  protected
319
-
319
+
320
320
  # Return a hash with the same values as the given hash,
321
321
  # but with the keys converted to strings.
322
322
  def map_to_prepared_args(hash)
@@ -324,16 +324,16 @@ module Sequel
324
324
  hash.each{|k,v| args[k.to_s.gsub('.', '__')] = v}
325
325
  args
326
326
  end
327
-
327
+
328
328
  private
329
-
329
+
330
330
  # Extralite uses a : before the name of the argument for named
331
331
  # arguments.
332
332
  def prepared_arg(k)
333
333
  LiteralString.new("#{prepared_arg_placeholder}#{k.to_s.gsub('.', '__')}")
334
334
  end
335
335
  end
336
-
336
+
337
337
  BindArgumentMethods = prepared_statements_module(:bind, ArgumentMapper)
338
338
  PreparedStatementMethods = prepared_statements_module(:prepare, BindArgumentMethods)
339
339
 
@@ -371,9 +371,9 @@ module Sequel
371
371
  def supports_regexp?
372
372
  db.allow_regexp?
373
373
  end
374
-
374
+
375
375
  private
376
-
376
+
377
377
  # The base type name for a given type, without any parenthetical part.
378
378
  def base_type_name(t)
379
379
  (t =~ /^(.*?)\(/ ? $1 : t).downcase if t