Home | History | Annotate | Download | only in dist

Lines Matching defs:mem

3416 typedef struct Mem sqlite3_value;
9124 typedef struct Mem Mem;
9148 Mem *pMem; /* Used when p4type is P4_MEM */
9203 #define P4_MEM (-8) /* P4 is a pointer to a Mem* structure */
9221 ** The Vdbe.aColName array contains 5n Mem structures, where n is the
9501 SQLITE_PRIVATE int sqlite3MemCompare(const Mem*, const Mem*, const CollSeq*);
11125 Mem *aMem; /* Values */
13994 Mem *aMem; /* Array of memory cells for parent frame */
14009 #define VdbeFrameMem(p) ((Mem *)&((u8 *)p)[ROUND8(sizeof(VdbeFrame))])
14017 ** Internally, the vdbe manipulates nearly all SQL values as Mem
14018 ** structures. Each Mem struct may cache multiple representations (string,
14021 struct Mem {
14036 Mem *pScopyFrom; /* This Mem is a shallow copy of pScopyFrom */
14037 void *pFiller; /* So that sizeof(Mem) is a multiple of 8 */
14039 void (*xDel)(void *); /* If not null, call this function to delete Mem.z */
14044 ** representations of the value stored in the Mem struct.
14049 ** If the MEM_Str flag is set then Mem.z points at a string representation.
14068 /* Whenever Mem contains a valid string or blob representation, one of
14070 ** policy for Mem.z. The MEM_Term flag tells us whether or not the
14074 #define MEM_Dyn 0x0400 /* Need to call Mem.xDel() on Mem.z */
14075 #define MEM_Static 0x0800 /* Mem.z points to a static string */
14076 #define MEM_Ephem 0x1000 /* Mem.z points to an ephemeral string */
14077 #define MEM_Agg 0x2000 /* Mem.z points to an agg function context */
14078 #define MEM_Zero 0x4000 /* Mem.i contains count of 0s appended to blob */
14085 ** Clear any existing type flags from a Mem and replace them with f
14124 ** (Mem) which are only defined there.
14128 Mem s; /* The return value is stored here */
14129 Mem *pMem; /* Memory cell used to store aggregate context */
14173 Mem *aMem; /* The memory locations */
14174 Mem **apArg; /* Arguments to currently executing user function */
14175 Mem *aColName; /* Column names to return */
14176 Mem *pResultSet; /* Pointer to an array of results */
14185 Mem *aVar; /* Values for the OP_Variable opcode. */
14251 SQLITE_PRIVATE u32 sqlite3VdbeSerialType(Mem*, int);
14252 SQLITE_PRIVATE u32 sqlite3VdbeSerialPut(unsigned char*, Mem*, u32);
14253 SQLITE_PRIVATE u32 sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*);
14262 SQLITE_PRIVATE int sqlite3VdbeChangeEncoding(Mem *, int);
14263 SQLITE_PRIVATE int sqlite3VdbeMemTooBig(Mem*);
14264 SQLITE_PRIVATE int sqlite3VdbeMemCopy(Mem*, const Mem*);
14265 SQLITE_PRIVATE void sqlite3VdbeMemShallowCopy(Mem*, const Mem*, int);
14266 SQLITE_PRIVATE void sqlite3VdbeMemMove(Mem*, Mem*);
14267 SQLITE_PRIVATE int sqlite3VdbeMemNulTerminate(Mem*);
14268 SQLITE_PRIVATE int sqlite3VdbeMemSetStr(Mem*, const char*, int, u8, void(*)(void*));
14269 SQLITE_PRIVATE void sqlite3VdbeMemSetInt64(Mem*, i64);
14273 SQLITE_PRIVATE void sqlite3VdbeMemSetDouble(Mem*, double);
14275 SQLITE_PRIVATE void sqlite3VdbeMemSetNull(Mem*);
14276 SQLITE_PRIVATE void sqlite3VdbeMemSetZeroBlob(Mem*,int);
14277 SQLITE_PRIVATE void sqlite3VdbeMemSetRowSet(Mem*);
14278 SQLITE_PRIVATE int sqlite3VdbeMemMakeWriteable(Mem*);
14279 SQLITE_PRIVATE int sqlite3VdbeMemStringify(Mem*, int);
14280 SQLITE_PRIVATE i64 sqlite3VdbeIntValue(Mem*);
14281 SQLITE_PRIVATE int sqlite3VdbeMemIntegerify(Mem*);
14282 SQLITE_PRIVATE double sqlite3VdbeRealValue(Mem*);
14283 SQLITE_PRIVATE void sqlite3VdbeIntegerAffinity(Mem*);
14284 SQLITE_PRIVATE int sqlite3VdbeMemRealify(Mem*);
14285 SQLITE_PRIVATE int sqlite3VdbeMemNumerify(Mem*);
14286 SQLITE_PRIVATE int sqlite3VdbeMemFromBtree(BtCursor*,u32,u32,int,Mem*);
14287 SQLITE_PRIVATE void sqlite3VdbeMemRelease(Mem *p);
14288 SQLITE_PRIVATE void sqlite3VdbeMemReleaseExternal(Mem *p);
14293 SQLITE_PRIVATE int sqlite3VdbeMemFinalize(Mem*, FuncDef*);
14295 SQLITE_PRIVATE int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve);
14304 SQLITE_PRIVATE int sqlite3VdbeSorterRowkey(const VdbeCursor *, Mem *);
14307 Mem *);
14308 SQLITE_PRIVATE int sqlite3VdbeSorterCompare(const VdbeCursor *, Mem *, int, int *);
14319 SQLITE_PRIVATE void sqlite3VdbeMemAboutToChange(Vdbe*,Mem*);
14320 SQLITE_PRIVATE int sqlite3VdbeCheckMemInvariants(Mem*);
14329 SQLITE_PRIVATE int sqlite3VdbeMemTranslate(Mem*, u8);
14332 SQLITE_PRIVATE void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf);
14334 SQLITE_PRIVATE int sqlite3VdbeMemHandleBom(Mem *pMem);
14337 SQLITE_PRIVATE int sqlite3VdbeMemExpandBlob(Mem *);
16650 ** into a single structure named "mem". This is to keep the
16695 } mem;
16707 mem.nAlloc[i]++;
16708 mem.nCurrent[i]++;
16709 if( mem.nCurrent[i]>mem.mxCurrent[i] ){
16710 mem.mxCurrent[i] = mem.nCurrent[i];
16713 mem.nCurrent[i]--;
16714 assert( mem.nCurrent[i]>=0 );
16766 mem.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);
16776 mem.mutex = 0;
16822 sqlite3_mutex_enter(mem.mutex);
16823 assert( mem.disallow==0 );
16826 mem.nBacktrace*sizeof(void*) + mem.nTitle;
16830 pBt = (void**)&z[mem.nTitle];
16831 pHdr = (struct MemBlockHdr*)&pBt[mem.nBacktrace];
16833 pHdr->pPrev = mem.pLast;
16834 if( mem.pLast ){
16835 mem.pLast->pNext = pHdr;
16837 mem.pFirst = pHdr;
16839 mem.pLast = pHdr;
16842 pHdr->nBacktraceSlots = mem.nBacktrace;
16843 pHdr->nTitle = mem.nTitle;
16844 if( mem.nBacktrace ){
16846 pHdr->nBacktrace = backtrace(aAddr, mem.nBacktrace+1)-1;
16849 if( mem.xBacktrace ){
16850 mem.xBacktrace(nByte, pHdr->nBacktrace-1, &aAddr[1]);
16855 if( mem.nTitle ){
16856 memcpy(z, mem.zTitle, mem.nTitle);
16866 sqlite3_mutex_leave(mem.mutex);
16878 || mem.mutex!=0 );
16882 sqlite3_mutex_enter(mem.mutex);
16887 assert( mem.pFirst==pHdr );
16888 mem.pFirst = pHdr->pNext;
16894 assert( mem.pLast==pHdr );
16895 mem.pLast = pHdr->pPrev;
16903 sqlite3_mutex_leave(mem.mutex);
16918 assert( mem.disallow==0 );
17015 mem.nBacktrace = depth;
17019 mem.xBacktrace = xBacktrace;
17027 sqlite3_mutex_enter(mem.mutex);
17028 if( n>=sizeof(mem.zTitle) ) n = sizeof(mem.zTitle)-1;
17029 memcpy(mem.zTitle, zTitle, n);
17030 mem.zTitle[n] = 0;
17031 mem.nTitle = ROUND8(n);
17032 sqlite3_mutex_leave(mem.mutex);
17037 for(pHdr=mem.pFirst; pHdr; pHdr=pHdr->pNext){
17040 mem.xBacktrace((int)pHdr->iSize, pHdr->nBacktrace-1, &pBt[1]);
17059 for(pHdr=mem.pFirst; pHdr; pHdr=pHdr->pNext){
17074 if( mem.nAlloc[i] ){
17076 i*8, mem.nAlloc[i], mem.nCurrent[i], mem.mxCurrent[i]);
17079 if( mem.nAlloc[NCSIZE-1] ){
17081 NCSIZE*8-8, mem.nAlloc[NCSIZE-1],
17082 mem.nCurrent[NCSIZE-1], mem.mxCurrent[NCSIZE-1]);
17094 nTotal += mem.nAlloc[i];
21897 ** If the TRANSLATE_TRACE macro is defined, the value of each Mem is
21908 SQLITE_PRIVATE int sqlite3VdbeMemTranslate(Mem *pMem, u8 desiredEnc){
22044 ** the encoding of the Mem adjusted. This routine does not do any
22045 ** byte-swapping, it just sets Mem.enc appropriately.
22047 ** The allocation (static, dynamic etc.) and encoding of the Mem may be
22050 SQLITE_PRIVATE int sqlite3VdbeMemHandleBom(Mem *pMem){
22143 Mem m;
60854 ** This file contains code use to manipulate "Mem" structure. A "Mem"
60855 ** stores a single value in the VDBE. Mem is an opaque structure visible
60856 ** only within the VDBE. Interface routines refer to a Mem using the
60862 ** Check invariants on a Mem object.
60867 SQLITE_PRIVATE int sqlite3VdbeCheckMemInvariants(Mem *p){
60868 /* The MEM_Dyn bit is set if and only if Mem.xDel is a non-NULL destructor
60869 ** function for Mem.z
60874 /* If p holds a string or blob, the Mem.z must point to exactly
60877 ** (1) Memory in Mem.zMalloc and managed by the Mem object
60878 ** (2) Memory to be freed using Mem.xDel
60909 SQLITE_PRIVATE int sqlite3VdbeChangeEncoding(Mem *pMem, int desiredEnc){
60944 SQLITE_PRIVATE int sqlite3VdbeMemGrow(Mem *pMem, int n, int bPreserve){
60985 ** Make the given Mem object MEM_Dyn. In other words, make it so
60992 SQLITE_PRIVATE int sqlite3VdbeMemMakeWriteable(Mem *pMem){
61014 ** If the given Mem* has a zero-filled tail, turn it into an ordinary
61018 SQLITE_PRIVATE int sqlite3VdbeMemExpandBlob(Mem *pMem){
61044 ** Make sure the given Mem is \u0000 terminated.
61046 SQLITE_PRIVATE int sqlite3VdbeMemNulTerminate(Mem *pMem){
61061 ** Add MEM_Str to the set of representations for the given Mem. Numbers
61073 SQLITE_PRIVATE int sqlite3VdbeMemStringify(Mem *pMem, int enc){
61117 SQLITE_PRIVATE int sqlite3VdbeMemFinalize(Mem *pMem, FuncDef *pFunc){
61140 ** does not free any Mem.zMalloc buffer.
61142 SQLITE_PRIVATE void sqlite3VdbeMemReleaseExternal(Mem *p){
61161 ** Release any memory held by the Mem. This may leave the Mem in an
61162 ** inconsistent state, for example with (Mem.z==0) and
61163 ** (Mem.flags==MEM_Str).
61165 SQLITE_PRIVATE void sqlite3VdbeMemRelease(Mem *p){
61217 SQLITE_PRIVATE i64 sqlite3VdbeIntValue(Mem *pMem){
61243 SQLITE_PRIVATE double sqlite3VdbeRealValue(Mem *pMem){
61262 ** The MEM structure is already a MEM_Real. Try to also make it a
61265 SQLITE_PRIVATE void sqlite3VdbeIntegerAffinity(Mem *pMem){
61294 SQLITE_PRIVATE int sqlite3VdbeMemIntegerify(Mem *pMem){
61308 SQLITE_PRIVATE int sqlite3VdbeMemRealify(Mem *pMem){
61325 SQLITE_PRIVATE int sqlite3VdbeMemNumerify(Mem *pMem){
61345 SQLITE_PRIVATE void sqlite3VdbeMemSetNull(Mem *pMem){
61357 sqlite3VdbeMemSetNull((Mem*)p);
61364 SQLITE_PRIVATE void sqlite3VdbeMemSetZeroBlob(Mem *pMem, int n){
61385 SQLITE_PRIVATE void sqlite3VdbeMemSetInt64(Mem *pMem, i64 val){
61396 SQLITE_PRIVATE void sqlite3VdbeMemSetDouble(Mem *pMem, double val){
61411 SQLITE_PRIVATE void sqlite3VdbeMemSetRowSet(Mem *pMem){
61429 ** Return true if the Mem object contains a TEXT or BLOB that is
61432 SQLITE_PRIVATE int sqlite3VdbeMemTooBig(Mem *p){
61453 SQLITE_PRIVATE void sqlite3VdbeMemAboutToChange(Vdbe *pVdbe, Mem *pMem){
61455 Mem *pX;
61467 ** Size of struct Mem not including the Mem.zMalloc member.
61469 #define MEMCELLSIZE offsetof(Mem,zMalloc)
61477 SQLITE_PRIVATE void sqlite3VdbeMemShallowCopy(Mem *pTo, const Mem *pFrom, int srcType){
61493 SQLITE_PRIVATE int sqlite3VdbeMemCopy(Mem *pTo, const Mem *pFrom){
61518 SQLITE_PRIVATE void sqlite3VdbeMemMove(Mem *pTo, Mem *pFrom){
61524 memcpy(pTo, pFrom, sizeof(Mem));
61531 ** Change the value of a Mem to be a string or a BLOB.
61536 ** Mem structure. Otherwise, any existing buffer is freed and the
61546 Mem *pMem, /* Memory cell to set to string value */
61581 /* The following block sets the new values of Mem.z and Mem.xDel. It
61626 ** Move data out of a btree key or data field and into a Mem structure.
61643 Mem *pMem /* OUT: Return data in this Mem structure. */
61735 Mem *p = sqlite3DbMallocZero(db, sizeof(*p));
61776 nByte = sizeof(Mem) * nCol + ROUND8(sizeof(UnpackedRecord));
61783 pRec->aMem = (Mem *)((u8*)pRec + ROUND8(sizeof(UnpackedRecord)));
62029 sqlite3VdbeMemSetNull((Mem*)pVal);
62040 rc = sqlite3VdbeMemCopy((Mem*)pVal, &v->aVar[iBindVar-1]);
62151 Mem *pMem = *ppVal; /* Write result into this Mem object */
62186 Mem *aMem = pRec->aMem;
62207 if( v ) sqlite3VdbeMemSetStr((Mem *)v, z, n, enc, xDel);
62215 sqlite3VdbeMemRelease((Mem *)v);
62216 sqlite3DbFree(((Mem*)v)->db, v);
62224 Mem *p = (Mem*)pVal;
62934 Mem *p = (Mem*)p4;
63307 Mem *pMem = pOp->p4.pMem;
63459 ** Release an array of N Mem elements
63461 static void releaseMemArray(Mem *p, int N){
63463 Mem *pEnd;
63511 Mem *aMem = VdbeFrameMem(p);
63542 Mem *pSub = 0; /* Memory cell hold array of subprogs */
63546 Mem *pMem = &p->aMem[1]; /* First Mem of result set */
63926 p->aMem = allocSpace(p->aMem, nMem*sizeof(Mem), &zCsr, zEnd, &nByte);
63927 Mem), &zCsr, zEnd, &nByte);
63928 p->apArg = allocSpace(p->apArg, nArg*sizeof(Mem*), &zCsr, zEnd, &nByte);
64086 Mem *pColName;
64094 p->aColName = pColName = (Mem*)sqlite3DbMallocZero(db, sizeof(Mem)*n );
64121 Mem *pColName;
65037 SQLITE_PRIVATE u32 sqlite3VdbeSerialType(Mem *pMem, int file_format){
65155 SQLITE_PRIVATE u32 sqlite3VdbeSerialPut(u8 *buf, Mem *pMem, u32 serial_type){
65205 Mem *pMem /* Memory cell to write value into */
65324 nByte = ROUND8(sizeof(UnpackedRecord)) + sizeof(Mem)*(pKeyInfo->nField+1);
65334 p->aMem = (Mem*)&((char*)p)[ROUND8(sizeof(UnpackedRecord))];
65357 Mem *pMem = p->aMem;
65400 Mem mem1;
65478 const Mem *pMem1,
65479 const Mem *pMem2,
65490 Mem c1;
65491 Mem c2;
65516 SQLITE_PRIVATE int sqlite3MemCompare(const Mem *pMem1, const Mem *pMem2, const CollSeq *pColl){
65670 Mem *pRhs = pPKey2->aMem; /* Next field of pPKey2 to compare */
65673 Mem mem1;
66068 Mem m, v;
66150 Mem m;
66224 Mem *pMem = &v->aVar[iVar-1];
66228 sqlite3VdbeMemCopy((Mem *)pRet, pMem);
66396 ** The following routines extract information from a Mem or sqlite3_value
66400 Mem *p = (Mem*)pVal;
66416 return sqlite3VdbeRealValue((Mem*)pVal);
66419 return (int)sqlite3VdbeIntValue((Mem*)pVal);
66422 return sqlite3VdbeIntValue((Mem*)pVal);
66878 Mem *pMem;
66997 static const Mem *columnNullValue(void){
66998 /* Even though the Mem structure contains an element
67000 ** switches (-Os), gcc may align this Mem object on a 4-byte boundary
67003 ** that a Mem structure is located on an 8-byte boundary. To prevent
67007 static const Mem nullMem
67021 ** it is, return a pointer to the Mem for the value of that column.
67022 ** If iCol is not valid, return a pointer to a Mem which has a value
67025 static Mem *columnMem(sqlite3_stmt *pStmt, int i){
67027 Mem *pOut;
67038 pOut = (Mem*)columnNullValue();
67120 Mem *pOut = columnMem(pStmt, i);
67160 const void *(*xFunc)(Mem*),
67193 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_NAME);
67198 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_NAME);
67218 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_DECLTYPE);
67223 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_DECLTYPE);
67236 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_DATABASE);
67241 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_DATABASE);
67252 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_TABLE);
67257 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_TABLE);
67268 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_COLUMN);
67273 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_COLUMN);
67295 Mem *pVar;
67347 Mem *pVar;
67703 Mem *pVar; /* Value of a host parameter */
67756 Mem utf8;
68004 static void updateMaxBlobsize(Mem *p){
68121 Mem *pMem = &p->aMem[p->nMem-iCur];
68154 static void applyNumericAffinity(Mem *pRec){
68190 Mem *pRec, /* The value to apply affinity to */
68222 Mem *pMem = (Mem*)pVal;
68231 ** not the internal Mem* type.
68238 applyAffinity((Mem *)pVal, affinity, enc);
68248 static u16 numericType(Mem *pMem){
68269 SQLITE_PRIVATE void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf){
68351 static void memTracePrint(Mem *p){
68372 static void registerTrace(int iReg, Mem *p){
68525 Mem
68526 Mem *pIn1 = 0; /* 1st input operand */
68527 Mem *pIn2 = 0; /* 2nd input operand */
68528 Mem *pIn3 = 0; /* 3rd input operand */
68529 Mem *pOut = 0; /* Output operand */
68622 ** external allocations out of mem[p2] and set mem[p2] to be
68624 ** value or convert mem[p2] to a different type.
69116 Mem *pVar; /* Value being transferred */
69159 memcpy(pOut, pIn1, sizeof(Mem));
69238 Mem *pMem;
69528 Mem *pArg;
69559 memcpy(&ctx.s, pOut, sizeof(Mem));
69598 memcpy(pOut, &ctx.s, sizeof(Mem));
70340 Mem *pDest; /* Where to write the extracted value */
70341 Mem sMem; /* For storing the record being decoded */
70349 Mem *pReg; /* PseudoTable input register */
70626 Mem *pRec; /* The new record */
70633 Mem *pData0; /* First field to be combined into the record */
70634 Mem *pLast; /* Last field of the record */
71825 char aTempRec[ROUND8(sizeof(UnpackedRecord)) + sizeof(Mem)*4 + 7];
71986 Mem *pMem; /* Register holding largest rowid for AUTOINCREMENT */
72060 assert( (pMem->flags & MEM_Int)!=0 ); /* mem(P3) holds an integer */
72159 Mem *pData; /* MEM cell holding data for the record to be inserted */
72160 Mem *pKey; /* MEM cell holding key for the record */
73241 Mem *pnErr; /* Register keeping track of errors remaining */
73401 Mem *pRt; /* Register to allocate runtime space */
73402 Mem *pMem; /* Used to iterate through memory cells */
73403 Mem *pEnd; /* Last memory cell in new array */
73447 + nMem * sizeof(Mem)
73518 Mem *pIn;
73668 Mem *pMem;
73669 Mem *pRec;
73731 Mem *pMem;
73752 ** or RESTART. Write 1 or 0 into mem[P3] if the checkpoint returns
73754 ** WAL after the checkpoint into mem[P3+1] and the number of pages
73756 ** completes into mem[P3+2]. However on an error, mem[P3+1] and
73757 ** mem[P3+2] are initialized to -1.
73762 Mem *pMem; /* Write results here */
74086 Mem *pQuery;
74087 Mem *pArgc;
74093 Mem **apArg;
74147 Mem *pDest;
74180 ** dynamic allocation in sContext.s (a Mem struct) is released.
74248 Mem *pName;
74304 Mem **apArg;
74305 Mem *pX;
75797 Mem *pVal /* Memory cell containing record */
76077 SQLITE_PRIVATE int sqlite3VdbeSorterRowkey(const VdbeCursor *pCsr, Mem *pOut){
76104 Mem *pVal, /* Value to compare to current sorter key */
93155 Mem *pArg = (Mem *)argv[0];
93156 Mem *pBest;
93159 pBest = (Mem *)sqlite3_aggregate_context(context, sizeof(*pBest));
98827 int mem = ++pParse->nMem;
98832 sqlite3VdbeAddOp4(v, OP_Int64, 0, mem, 0, (char*)pI64, P4_INT64);
98835 sqlite3VdbeAddOp2(v, OP_ResultRow, mem, 1);
98988 int mem = ++pParse->nMem;
98989 sqlite3VdbeAddOp4(v, OP_String8, 0, mem, 0, aFcntl[0], 0);
98992 sqlite3VdbeAddOp2(v, OP_ResultRow, mem, 1);
103891 ** records the previous output. mem[regPrev] is a flag that is false
106304 int iAMem; /* First Mem address for storing current GROUP BY */
106305 int iBMem; /* First Mem address for previous GROUP BY */
106306 int iUseFlag; /* Mem address holding flag indicating that at least
106309 int iAbortFlag; /* Mem address which causes query abort if positive */