Previous 199869 Revisions Next

r35133 Thursday 19th February, 2015 at 14:52:12 UTC by Miodrag Milanović
Make sqllite3 compile use CCOMFLAGS as well (nw)
[3rdparty/sqlite3]sqlite3.c
[src/lib]lib.mak

trunk/3rdparty/sqlite3/sqlite3.c
r243644r243645
1085610856*/
1085710857#define FUNCTION(zName, nArg, iArg, bNC, xFunc) \
1085810858  {nArg, SQLITE_FUNC_CONSTANT|SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \
10859   SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, #zName, 0, 0}
10859   SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, (char*)#zName, 0, 0}
1086010860#define VFUNCTION(zName, nArg, iArg, bNC, xFunc) \
1086110861  {nArg, SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \
10862   SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, #zName, 0, 0}
10862   SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, (char*)#zName, 0, 0}
1086310863#define FUNCTION2(zName, nArg, iArg, bNC, xFunc, extraFlags) \
1086410864  {nArg,SQLITE_FUNC_CONSTANT|SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL)|extraFlags,\
10865   SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, #zName, 0, 0}
10865   SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, (char*)#zName, 0, 0}
1086610866#define STR_FUNCTION(zName, nArg, pArg, bNC, xFunc) \
1086710867  {nArg, SQLITE_FUNC_CONSTANT|SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \
10868   pArg, 0, xFunc, 0, 0, #zName, 0, 0}
10868   pArg, 0, xFunc, 0, 0, (char*)#zName, 0, 0}
1086910869#define LIKEFUNC(zName, nArg, arg, flags) \
1087010870  {nArg, SQLITE_FUNC_CONSTANT|SQLITE_UTF8|flags, \
10871   (void *)arg, 0, likeFunc, 0, 0, #zName, 0, 0}
10871   (void *)arg, 0, likeFunc, 0, 0, (char*)#zName, 0, 0}
1087210872#define AGGREGATE(zName, nArg, arg, nc, xStep, xFinal) \
1087310873  {nArg, SQLITE_UTF8|(nc*SQLITE_FUNC_NEEDCOLL), \
10874   SQLITE_INT_TO_PTR(arg), 0, 0, xStep,xFinal,#zName,0,0}
10874   SQLITE_INT_TO_PTR(arg), 0, 0, xStep,xFinal,(char*)#zName,0,0}
1087510875#define AGGREGATE2(zName, nArg, arg, nc, xStep, xFinal, extraFlags) \
1087610876  {nArg, SQLITE_UTF8|(nc*SQLITE_FUNC_NEEDCOLL)|extraFlags, \
10877   SQLITE_INT_TO_PTR(arg), 0, 0, xStep,xFinal,#zName,0,0}
10877   SQLITE_INT_TO_PTR(arg), 0, 0, xStep,xFinal,(char*)#zName,0,0}
1087810878
1087910879/*
1088010880** All current savepoints are stored in a linked list starting at
r243644r243645
2120221202        /* Normalize realvalue to within 10.0 > realvalue >= 1.0 */
2120321203        exp = 0;
2120421204        if( sqlite3IsNaN((double)realvalue) ){
21205          bufpt = "NaN";
21205          bufpt = (char *)"NaN";
2120621206          length = 3;
2120721207          break;
2120821208        }
r243644r243645
2121721217          while( realvalue<1.0 ){ realvalue *= 10.0; exp--; }
2121821218          if( exp>350 ){
2121921219            if( prefix=='-' ){
21220              bufpt = "-Inf";
21220              bufpt = (char *)"-Inf";
2122121221            }else if( prefix=='+' ){
21222              bufpt = "+Inf";
21222              bufpt =(char *) "+Inf";
2122321223            }else{
21224              bufpt = "Inf";
21224              bufpt = (char *)"Inf";
2122521225            }
2122621226            length = sqlite3Strlen30(bufpt);
2122721227            break;
r243644r243645
2137521375          bufpt = va_arg(ap,char*);
2137621376        }
2137721377        if( bufpt==0 ){
21378          bufpt = "";
21378          bufpt = (char *)"";
2137921379        }else if( xtype==etDYNSTRING && !bArgList ){
2138021380          zExtra = bufpt;
2138121381        }
r243644r243645
2140021400          escarg = va_arg(ap,char*);
2140121401        }
2140221402        isnull = escarg==0;
21403        if( isnull ) escarg = (xtype==etSQLESCAPE2 ? "NULL" : "(NULL)");
21403        if( isnull ) escarg = (char *)(xtype==etSQLESCAPE2 ? "NULL" : "(NULL)");
2140421404        k = precision;
2140521405        for(i=n=0; k!=0 && (ch=escarg[i])!=0; i++, k--){
2140621406          if( ch==q )  n++;
r243644r243645
6431264312        sqlite3_snprintf(nTemp, zTemp, "NULL");
6431364313      }else{
6431464314        assert( pMem->flags & MEM_Blob );
64315        zP4 = "(blob)";
64315        zP4 = (char *)"(blob)";
6431664316      }
6431764317      break;
6431864318    }
r243644r243645
8631186311  statInit,        /* xFunc */
8631286312  0,               /* xStep */
8631386313  0,               /* xFinalize */
86314  "stat_init",     /* zName */
86314  (char*)"stat_init",     /* zName */
8631586315  0,               /* pHash */
8631686316  0                /* pDestructor */
8631786317};
r243644r243645
8661286612  statPush,        /* xFunc */
8661386613  0,               /* xStep */
8661486614  0,               /* xFinalize */
86615  "stat_push",     /* zName */
86615  (char*)"stat_push",     /* zName */
8661686616  0,               /* pHash */
8661786617  0                /* pDestructor */
8661886618};
r243644r243645
8675986759  statGet,         /* xFunc */
8676086760  0,               /* xStep */
8676186761  0,               /* xFinalize */
86762  "stat_get",      /* zName */
86762  (char*)"stat_get",      /* zName */
8676386763  0,               /* pHash */
8676486764  0                /* pDestructor */
8676586765};
r243644r243645
8810588105    detachFunc,       /* xFunc */
8810688106    0,                /* xStep */
8810788107    0,                /* xFinalize */
88108    "sqlite_detach",  /* zName */
88108    (char*)"sqlite_detach",  /* zName */
8810988109    0,                /* pHash */
8811088110    0                 /* pDestructor */
8811188111  };
r243644r243645
8812688126    attachFunc,       /* xFunc */
8812788127    0,                /* xStep */
8812888128    0,                /* xFinalize */
88129    "sqlite_attach",  /* zName */
88129    (char*)"sqlite_attach",  /* zName */
8813088130    0,                /* pHash */
8813188131    0                 /* pDestructor */
8813288132  };
r243644r243645
9008290082static char *createTableStmt(sqlite3 *db, Table *p){
9008390083  int i, k, n;
9008490084  char *zStmt;
90085  char *zSep, *zSep2, *zEnd;
90085  const char *zSep, *zSep2, *zEnd;
9008690086  Column *pCol;
9008790087  n = 0;
9008890088  for(pCol = p->aCol, i=0; i<p->nCol; i++, pCol++){
r243644r243645
9031790317      if( !hasColumn(pPk->aiColumn, j, i) ){
9031890318        assert( j<pPk->nColumn );
9031990319        pPk->aiColumn[j] = i;
90320        pPk->azColl[j] = "BINARY";
90320        pPk->azColl[j] = (char *)"BINARY";
9032190321        j++;
9032290322      }
9032390323    }
r243644r243645
9041890418  if( !db->init.busy ){
9041990419    int n;
9042090420    Vdbe *v;
90421    char *zType;    /* "view" or "table" */
90422    char *zType2;   /* "VIEW" or "TABLE" */
90421    const char *zType;    /* "view" or "table" */
90422    const char *zType2;   /* "VIEW" or "TABLE" */
9042390423    char *zStmt;    /* Text of the CREATE TABLE or CREATE VIEW statement */
9042490424
9042590425    v = sqlite3GetVdbe(pParse);
r243644r243645
9164291642      nExtra -= nColl;
9164391643    }else{
9164491644      zColl = pTab->aCol[j].zColl;
91645      if( !zColl ) zColl = "BINARY";
91645      if( !zColl ) zColl = (char *)"BINARY";
9164691646    }
9164791647    if( !db->init.busy && !sqlite3LocateCollSeq(pParse, zColl) ){
9164891648      goto exit_create_index;
r243644r243645
9166791667    assert( i==pIndex->nColumn );
9166891668  }else{
9166991669    pIndex->aiColumn[i] = -1;
91670    pIndex->azColl[i] = "BINARY";
91670    pIndex->azColl[i] = (char *)"BINARY";
9167191671  }
9167291672  sqlite3DefaultRowEst(pIndex);
9167391673  if( pParse->pNewTable==0 ) estimateIndexWidth(pIndex);
r243644r243645
9621996219          ** unusable. Bail out early in this case.  */
9622096220          zDfltColl = pParent->aCol[iCol].zColl;
9622196221          if( !zDfltColl ){
96222            zDfltColl = "BINARY";
96222            zDfltColl = (char *)"BINARY";
9622396223          }
9622496224          if( sqlite3StrICmp(pIdx->azColl[i], zDfltColl) ) break;
9622596225
r243644r243645
101462101462** journal-mode name.
101463101463*/
101464101464SQLITE_PRIVATE const char *sqlite3JournalModename(int eMode){
101465  static char * const azModeName[] = {
101465  static const char * azModeName[] = {
101466101466    "delete", "persist", "off", "truncate", "memory"
101467101467#ifndef SQLITE_OMIT_WAL
101468101468     , "wal"
r243644r243645
102832102832  */
102833102833  case PragTyp_ENCODING: {
102834102834    static const struct EncName {
102835      char *zName;
102835      const char *zName;
102836102836      u8 enc;
102837102837    } encnames[] = {
102838102838      { "UTF8",     SQLITE_UTF8        },
r243644r243645
105140105140** Name of the connection operator, used for error messages.
105141105141*/
105142105142static const char *selectOpName(int id){
105143  char *z;
105143  const char *z;
105144105144  switch( id ){
105145105145    case TK_ALL:       z = "UNION ALL";   break;
105146105146    case TK_INTERSECT: z = "INTERSECT";   break;
r243644r243645
105607105607      if( iCol<0 ) iCol = pTab->iPKey;
105608105608      assert( iCol==-1 || (iCol>=0 && iCol<pTab->nCol) );
105609105609      if( iCol<0 ){
105610        zCol = "rowid";
105610        zCol = (char*)"rowid";
105611105611      }else{
105612105612        zCol = pTab->aCol[iCol].zName;
105613105613      }
r243644r243645
111848111848  */
111849111849  nDb = db->nDb;
111850111850  if( sqlite3TempInMemory(db) ){
111851    zSql = "ATTACH ':memory:' AS vacuum_db;";
111851    zSql = (char*)"ATTACH ':memory:' AS vacuum_db;";
111852111852  }else{
111853    zSql = "ATTACH '' AS vacuum_db;";
111853    zSql = (char*)"ATTACH '' AS vacuum_db;";
111854111854  }
111855111855  rc = execSql(db, pzErrMsg, zSql);
111856111856  if( db->nDb>nDb ){
r243644r243645
115270115270  pIdx = sqlite3AllocateIndexObject(pParse->db, nKeyCol+1, 0, &zNotUsed);
115271115271  if( pIdx==0 ) return;
115272115272  pLoop->u.btree.pIndex = pIdx;
115273  pIdx->zName = "auto-index";
115273  pIdx->zName = (char*)"auto-index";
115274115274  pIdx->pTable = pTable;
115275115275  n = 0;
115276115276  idxCols = 0;
r243644r243645
115285115285        idxCols |= cMask;
115286115286        pIdx->aiColumn[n] = pTerm->u.leftColumn;
115287115287        pColl = sqlite3BinaryCompareCollSeq(pParse, pX->pLeft, pX->pRight);
115288        pIdx->azColl[n] = ALWAYS(pColl) ? pColl->zName : "BINARY";
115288        pIdx->azColl[n] = ALWAYS(pColl) ? pColl->zName : (char*)"BINARY";
115289115289        n++;
115290115290      }
115291115291    }
r243644r243645
115297115297  for(i=0; i<mxBitCol; i++){
115298115298    if( extraCols & MASKBIT(i) ){
115299115299      pIdx->aiColumn[n] = i;
115300      pIdx->azColl[n] = "BINARY";
115300      pIdx->azColl[n] = (char*)"BINARY";
115301115301      n++;
115302115302    }
115303115303  }
115304115304  if( pSrc->colUsed & MASKBIT(BMS-1) ){
115305115305    for(i=BMS-1; i<pTable->nCol; i++){
115306115306      pIdx->aiColumn[n] = i;
115307      pIdx->azColl[n] = "BINARY";
115307      pIdx->azColl[n] = (char*)"BINARY";
115308115308      n++;
115309115309    }
115310115310  }
115311115311  assert( n==nKeyCol );
115312115312  pIdx->aiColumn[n] = -1;
115313  pIdx->azColl[n] = "BINARY";
115313  pIdx->azColl[n] = (char*)"BINARY";
115314115314
115315115315  /* Create the automatic index */
115316115316  assert( pLevel->iIdxCur>=0 );
r243644r243645
116377116377  if( nEq==0 && (pLoop->wsFlags&(WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))==0 ) return;
116378116378  sqlite3StrAccumAppend(pStr, " (", 2);
116379116379  for(i=0; i<nEq; i++){
116380    char *z = aiColumn[i] < 0 ? "rowid" : aCol[aiColumn[i]].zName;
116380    char *z = aiColumn[i] < 0 ? (char*)"rowid" : aCol[aiColumn[i]].zName;
116381116381    if( i>=nSkip ){
116382116382      explainAppendTerm(pStr, i, z, "=");
116383116383    }else{
r243644r243645
116388116388
116389116389  j = i;
116390116390  if( pLoop->wsFlags&WHERE_BTM_LIMIT ){
116391    char *z = aiColumn[j] < 0 ? "rowid" : aCol[aiColumn[j]].zName;
116391    char *z = aiColumn[j] < 0 ? (char*)"rowid" : aCol[aiColumn[j]].zName;
116392116392    explainAppendTerm(pStr, i++, z, ">");
116393116393  }
116394116394  if( pLoop->wsFlags&WHERE_TOP_LIMIT ){
116395    char *z = aiColumn[j] < 0 ? "rowid" : aCol[aiColumn[j]].zName;
116395    char *z = aiColumn[j] < 0 ? (char*)"rowid" : aCol[aiColumn[j]].zName;
116396116396    explainAppendTerm(pStr, i, z, "<");
116397116397  }
116398116398  sqlite3StrAccumAppend(pStr, ")", 1);
r243644r243645
127315127315          mask = SQLITE_OPEN_SHAREDCACHE|SQLITE_OPEN_PRIVATECACHE;
127316127316          aMode = aCacheMode;
127317127317          limit = mask;
127318          zModeType = "cache";
127318          zModeType = (char*)"cache";
127319127319        }
127320127320        if( nOpt==4 && memcmp("mode", zOpt, 4)==0 ){
127321127321          static struct OpenMode aOpenMode[] = {
r243644r243645
127330127330                   | SQLITE_OPEN_CREATE | SQLITE_OPEN_MEMORY;
127331127331          aMode = aOpenMode;
127332127332          limit = mask & flags;
127333          zModeType = "access";
127333          zModeType = (char*)"access";
127334127334        }
127335127335
127336127336        if( aMode ){
r243644r243645
127559127559  /* The default safety_level for the main database is 'full'; for the temp
127560127560  ** database it is 'NONE'. This matches the pager layer defaults. 
127561127561  */
127562  db->aDb[0].zName = "main";
127562  db->aDb[0].zName = (char*)"main";
127563127563  db->aDb[0].safety_level = 3;
127564  db->aDb[1].zName = "temp";
127564  db->aDb[1].zName = (char*)"temp";
127565127565  db->aDb[1].safety_level = 1;
127566127566
127567127567  db->magic = SQLITE_MAGIC_OPEN;
trunk/src/lib/lib.mak
r243644r243645
598598
599599$(LIBOBJ)/sqlite3/sqlite3.o: $(3RDPARTY)/sqlite3/sqlite3.c | $(OSPREBUILD)
600600   @echo Compiling $<...
601   $(CC) $(CDEFS) $(CONLYFLAGS) -Wno-bad-function-cast -I$(3RDPARTY)/sqlite3 $(SQLITE3_FLAGS) -c $< -o $@
601   $(CC) $(CDEFS) $(CCOMFLAGS) $(CONLYFLAGS) -Wno-bad-function-cast -Wno-undef -Wno-unused-but-set-variable -I$(3RDPARTY)/sqlite3 $(SQLITE3_FLAGS) -c $< -o $@
602602
603603#-------------------------------------------------
604604# BGFX library objects


Previous 199869 Revisions Next


© 1997-2024 The MAME Team