Home | History | Annotate | Download | only in dist

Lines Matching refs:Mem

3028 typedef struct Mem sqlite3_value;
7106 typedef struct Mem Mem;
7131 Mem *pMem; /* Used when p4type is P4_MEM */
7182 #define P4_MEM (-8) /* P4 is a pointer to a Mem* structure */
7203 ** The Vdbe.aColName array contains 5n Mem structures, where n is the
8913 Mem *aMem; /* Values */
12728 ** into a single structure named "mem". This is to keep the
12773 } mem;
12785 mem.nAlloc[i]++;
12786 mem.nCurrent[i]++;
12787 if( mem.nCurrent[i]>mem.mxCurrent[i] ){
12788 mem.mxCurrent[i] = mem.nCurrent[i];
12791 mem.nCurrent[i]--;
12792 assert( mem.nCurrent[i]>=0 );
12844 mem.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);
12854 mem.mutex = 0;
12900 sqlite3_mutex_enter(mem.mutex);
12901 assert( mem.disallow==0 );
12904 mem.nBacktrace*sizeof(void*) + mem.nTitle;
12908 pBt = (void**)&z[mem.nTitle];
12909 pHdr = (struct MemBlockHdr*)&pBt[mem.nBacktrace];
12911 pHdr->pPrev = mem.pLast;
12912 if( mem.pLast ){
12913 mem.pLast->pNext = pHdr;
12915 mem.pFirst = pHdr;
12917 mem.pLast = pHdr;
12919 pHdr->nBacktraceSlots = mem.nBacktrace;
12920 pHdr->nTitle = mem.nTitle;
12921 if( mem.nBacktrace ){
12923 pHdr->nBacktrace = backtrace(aAddr, mem.nBacktrace+1)-1;
12926 if( mem.xBacktrace ){
12927 mem.xBacktrace(nByte, pHdr->nBacktrace-1, &aAddr[1]);
12932 if( mem.nTitle ){
12933 memcpy(z, mem.zTitle, mem.nTitle);
12943 sqlite3_mutex_leave(mem.mutex);
12954 assert( sqlite3GlobalConfig.bMemstat || mem.mutex!=0 );
12958 sqlite3_mutex_enter(mem.mutex);
12963 assert( mem.pFirst==pHdr );
12964 mem.pFirst = pHdr->pNext;
12970 assert( mem.pLast==pHdr );
12971 mem.pLast = pHdr->pPrev;
12979 sqlite3_mutex_leave(mem.mutex);
12994 assert( mem.disallow==0 );
13034 mem.nBacktrace = depth;
13038 mem.xBacktrace = xBacktrace;
13046 sqlite3_mutex_enter(mem.mutex);
13047 if( n>=sizeof(memmem.zTitle)-1;
13048 memcpy(mem.zTitle, zTitle, n);
13049 mem.zTitle[n] = 0;
13050 mem.nTitle = ROUND8(n);
13051 sqlite3_mutex_leave(mem.mutex);
13056 for(pHdr=mem.pFirst; pHdr; pHdr=pHdr->pNext){
13059 mem.xBacktrace(pHdr->iSize, pHdr->nBacktrace-1, &pBt[1]);
13078 for(pHdr=mem.pFirst; pHdr; pHdr=pHdr->pNext){
13093 if( mem.nAlloc[i] ){
13095 i*8, mem.nAlloc[i], mem.nCurrent[i], mem.mxCurrent[i]);
13098 if( mem.nAlloc[NCSIZE-1] ){
13100 NCSIZE*8-8, mem.nAlloc[NCSIZE-1],
13101 mem.nCurrent[NCSIZE-1], mem.mxCurrent[NCSIZE-1]);
13113 nTotal += mem.nAlloc[i];
17630 Mem *aMem; /* Array of memory cells */
17642 #define VdbeFrameMem(p) ((Mem *)&((u8 *)p)[ROUND8(sizeof(VdbeFrame))])
17650 ** Internally, the vdbe manipulates nearly all SQL values as Mem
17651 ** structures. Each Mem struct may cache multiple representations (string,
17652 ** integer etc.) of the same value. A value (and therefore Mem structure)
17656 ** in a Mem struct is returned by the MemType(Mem*) macro. The type is
17660 struct Mem {
17675 void (*xDel)(void *); /* If not null, call this function to delete Mem.z */
17680 ** representations of the value stored in the Mem struct.
17685 ** If the MEM_Str flag is set then Mem.z points at a string representation.
17691 ** Multiple of these values can appear in Mem.flags. But only one
17692 ** at a time can appear in Mem.type.
17703 /* Whenever Mem contains a valid string or blob representation, one of
17705 ** policy for Mem.z. The MEM_Term flag tells us whether or not the
17709 #define MEM_Dyn 0x0400 /* Need to call sqliteFree() on Mem.z */
17710 #define MEM_Static 0x0800 /* Mem.z points to a static string */
17711 #define MEM_Ephem 0x1000 /* Mem.z points to an ephemeral string */
17712 #define MEM_Agg 0x2000 /* Mem.z points to an agg function context */
17713 #define MEM_Zero 0x4000 /* Mem.i contains count of 0s appended to blob */
17722 ** Clear any existing type flags from a Mem and replace them with f
17757 ** (Mem) which are only defined there.
17762 Mem s; /* The return value is stored here */
17763 Mem *pMem; /* Memory cell used to store aggregate context */
17804 Mem **apArg; /* Arguments to currently executing user function */
17805 Mem *aColName; /* Column names to return */
17806 Mem *pResultSet; /* Pointer to an array of results */
17813 Mem *aVar; /* Values for the OP_Variable opcode. */
17817 Mem *aMem; /* The memory locations */
17867 SQLITE_PRIVATE u32 sqlite3VdbeSerialType(Mem*, int);
17868 SQLITE_PRIVATE u32 sqlite3VdbeSerialPut(unsigned char*, int, Mem*, int);
17869 SQLITE_PRIVATE u32 sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*);
17875 SQLITE_PRIVATE int sqlite3MemCompare(const Mem*, const Mem*, const CollSeq*);
17879 SQLITE_PRIVATE int sqlite3VdbeChangeEncoding(Mem *, int);
17880 SQLITE_PRIVATE int sqlite3VdbeMemTooBig(Mem*);
17881 SQLITE_PRIVATE int sqlite3VdbeMemCopy(Mem*, const Mem*);
17882 SQLITE_PRIVATE void sqlite3VdbeMemShallowCopy(Mem*, const Mem*, int);
17883 SQLITE_PRIVATE void sqlite3VdbeMemMove(Mem*, Mem*);
17884 SQLITE_PRIVATE int sqlite3VdbeMemNulTerminate(Mem*);
17885 SQLITE_PRIVATE int sqlite3VdbeMemSetStr(Mem*, const char*, int, u8, void(*)(void*));
17886 SQLITE_PRIVATE void sqlite3VdbeMemSetInt64(Mem*, i64);
17887 SQLITE_PRIVATE void sqlite3VdbeMemSetDouble(Mem*, double);
17888 SQLITE_PRIVATE void sqlite3VdbeMemSetNull(Mem*);
17889 SQLITE_PRIVATE void sqlite3VdbeMemSetZeroBlob(Mem*,int);
17890 SQLITE_PRIVATE void sqlite3VdbeMemSetRowSet(Mem*);
17891 SQLITE_PRIVATE int sqlite3VdbeMemMakeWriteable(Mem*);
17892 SQLITE_PRIVATE int sqlite3VdbeMemStringify(Mem*, int);
17893 SQLITE_PRIVATE i64 sqlite3VdbeIntValue(Mem*);
17894 SQLITE_PRIVATE int sqlite3VdbeMemIntegerify(Mem*);
17895 SQLITE_PRIVATE double sqlite3VdbeRealValue(Mem*);
17896 SQLITE_PRIVATE void sqlite3VdbeIntegerAffinity(Mem*);
17897 SQLITE_PRIVATE int sqlite3VdbeMemRealify(Mem*);
17898 SQLITE_PRIVATE int sqlite3VdbeMemNumerify(Mem*);
17899 SQLITE_PRIVATE int sqlite3VdbeMemFromBtree(BtCursor*,int,int,int,Mem*);
17900 SQLITE_PRIVATE void sqlite3VdbeMemRelease(Mem *p);
17901 SQLITE_PRIVATE void sqlite3VdbeMemReleaseExternal(Mem *p);
17902 SQLITE_PRIVATE int sqlite3VdbeMemFinalize(Mem*, FuncDef*);
17904 SQLITE_PRIVATE int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve);
17908 SQLITE_PRIVATE void sqlite3VdbeMemStoreType(Mem *pMem);
17922 SQLITE_PRIVATE int sqlite3VdbeMemTranslate(Mem*, u8);
17925 SQLITE_PRIVATE void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf);
17927 SQLITE_PRIVATE int sqlite3VdbeMemHandleBom(Mem *pMem);
17930 SQLITE_PRIVATE int sqlite3VdbeMemExpandBlob(Mem *);
18093 ** If the TRANSLATE_TRACE macro is defined, the value of each Mem is
18104 SQLITE_PRIVATE int sqlite3VdbeMemTranslate(Mem *pMem, u8 desiredEnc){
18242 ** the encoding of the Mem adjusted. This routine does not do any
18243 ** byte-swapping, it just sets Mem.enc appropriately.
18245 ** The allocation (static, dynamic etc.) and encoding of the Mem may be
18248 SQLITE_PRIVATE int sqlite3VdbeMemHandleBom(Mem *pMem){
18341 Mem m;
18367 Mem m;
46336 ** This file contains code use to manipulate "Mem" structure. A "Mem"
46337 ** stores a single value in the VDBE. Mem is an opaque structure visible
46338 ** only within the VDBE. Interface routines refer to a Mem using the
46343 ** Call sqlite3VdbeMemExpandBlob() on the supplied value (type Mem*)
46361 SQLITE_PRIVATE int sqlite3VdbeChangeEncoding(Mem *pMem, int desiredEnc){
46396 ** not set, Mem.n is zeroed.
46398 SQLITE_PRIVATE int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve){
46436 ** Make the given Mem object MEM_Dyn. In other words, make it so
46443 SQLITE_PRIVATE int sqlite3VdbeMemMakeWriteable(Mem *pMem){
46462 ** If the given Mem* has a zero-filled tail, turn it into an ordinary
46466 SQLITE_PRIVATE int sqlite3VdbeMemExpandBlob(Mem *pMem){
46492 ** Make sure the given Mem is \u0000 terminated.
46494 SQLITE_PRIVATE int sqlite3VdbeMemNulTerminate(Mem *pMem){
46509 ** Add MEM_Str to the set of representations for the given Mem. Numbers
46521 SQLITE_PRIVATE int sqlite3VdbeMemStringify(Mem *pMem, int enc){
46565 SQLITE_PRIVATE int sqlite3VdbeMemFinalize(Mem *pMem, FuncDef *pFunc){
46588 ** does not free any Mem.zMalloc buffer.
46590 SQLITE_PRIVATE void sqlite3VdbeMemReleaseExternal(Mem *p){
46614 ** Release any memory held by the Mem. This may leave the Mem in an
46615 ** inconsistent state, for example with (Mem.z==0) and
46616 ** (Mem.type==SQLITE_TEXT).
46618 SQLITE_PRIVATE void sqlite3VdbeMemRelease(Mem *p){
46673 SQLITE_PRIVATE i64 sqlite3VdbeIntValue(Mem *pMem){
46703 SQLITE_PRIVATE double sqlite3VdbeRealValue(Mem *pMem){
46729 ** The MEM structure is already a MEM_Real. Try to also make it a
46732 SQLITE_PRIVATE void sqlite3VdbeIntegerAffinity(Mem *pMem){
46761 SQLITE_PRIVATE int sqlite3VdbeMemIntegerify(Mem *pMem){
46775 SQLITE_PRIVATE int sqlite3VdbeMemRealify(Mem *pMem){
46788 SQLITE_PRIVATE int sqlite3VdbeMemNumerify(Mem *pMem){
46809 SQLITE_PRIVATE void sqlite3VdbeMemSetNull(Mem *pMem){
46824 SQLITE_PRIVATE void sqlite3VdbeMemSetZeroBlob(Mem *pMem, int n){
46846 SQLITE_PRIVATE void sqlite3VdbeMemSetInt64(Mem *pMem, i64 val){
46857 SQLITE_PRIVATE void sqlite3VdbeMemSetDouble(Mem *pMem, double val){
46872 SQLITE_PRIVATE void sqlite3VdbeMemSetRowSet(Mem *pMem){
46890 ** Return true if the Mem object contains a TEXT or BLOB that is
46893 SQLITE_PRIVATE int sqlite3VdbeMemTooBig(Mem *p){
46906 ** Size of struct Mem not including the Mem.zMalloc member.
46908 #define MEMCELLSIZE (size_t)(&(((Mem *)0)->zMalloc))
46916 SQLITE_PRIVATE void sqlite3VdbeMemShallowCopy(Mem *pTo, const Mem *pFrom, int srcType){
46932 SQLITE_PRIVATE int sqlite3VdbeMemCopy(Mem *pTo, const Mem *pFrom){
46956 SQLITE_PRIVATE void sqlite3VdbeMemMove(Mem *pTo, Mem *pFrom){
46962 memcpy(pTo, pFrom, sizeof(Mem));
46969 ** Change the value of a Mem to be a string or a BLOB.
46974 ** Mem structure. Otherwise, any existing buffer is freed and the
46984 Mem *pMem, /* Memory cell to set to string value */
47019 /* The following block sets the new values of Mem.z and Mem.xDel. It
47073 SQLITE_PRIVATE int sqlite3MemCompare(const Mem *pMem1, const Mem *pMem2, const CollSeq *pColl){
47154 Mem c1;
47155 Mem c2;
47183 ** Move data out of a btree key or data field and into a Mem structure.
47200 Mem *pMem /* OUT: Return data in this Mem structure. */
47292 Mem *p = sqlite3DbMallocZero(db, sizeof(*p));
47396 if( v ) sqlite3VdbeMemSetStr((Mem *)v, z, n, enc, xDel);
47404 sqlite3VdbeMemRelease((Mem *)v);
47405 sqlite3DbFree(((Mem*)v)->db, v);
47413 Mem *p = (Mem*)pVal;
48332 Mem *pMem = pOp->p4.pMem;
48412 ** Release an array of N Mem elements
48414 static void releaseMemArray(Mem *p, int N){
48416 Mem *pEnd;
48453 Mem *aMem = VdbeFrameMem(p);
48484 Mem *pSub = 0; /* Memory cell hold array of subprogs */
48488 Mem *pMem = p->pResultSet = &p->aMem[1]; /* First Mem of result set */
48806 mem */
48830 p->aMem = allocSpace(p->aMem, nMem*sizeof(Mem), &zCsr, zEnd, &nByte);
48831 p->aVar = allocSpace(p->aVar, nVar*sizeof(Mem), &zCsr, zEnd, &nByte);
48832 p->apArg = allocSpace(p->apArg, nArg*sizeof(Mem*), &zCsr, zEnd, &nByte);
48992 Mem *pColName;
49000 p->aColName = pColName = (Mem*)sqlite3DbMallocZero(db, sizeof(Mem)*n );
49027 Mem *pColName;
49856 SQLITE_PRIVATE u32 sqlite3VdbeSerialType(Mem *pMem, int file_format){
49974 SQLITE_PRIVATE u32 sqlite3VdbeSerialPut(u8 *buf, int nBuf, Mem *pMem, int file_format){
50027 Mem *pMem /* Memory cell to write value into */
50145 Mem *pMem;
50156 nByte = ROUND8(sizeof(UnpackedRecord)) + sizeof(Mem)*(pKeyInfo->nField+1);
50167 p->aMem = pMem = (Mem*)&((char*)p)[ROUND8(sizeof(UnpackedRecord))];
50194 Mem *pMem;
50249 Mem mem1;
50352 Mem m, v;
50434 Mem m;
50509 Mem *pMem = &v->aVar[iVar-1];
50513 sqlite3VdbeMemCopy((Mem *)pRet, pMem);
50515 sqlite3VdbeMemStoreType((Mem *)pRet);
50671 ** The following routines extract information from a Mem or sqlite3_value
50675 Mem *p = (Mem*)pVal;
50692 return sqlite3VdbeRealValue((Mem*)pVal);
50695 return (int)sqlite3VdbeIntValue((Mem*)pVal);
50698 return sqlite3VdbeIntValue((Mem*)pVal);
51043 Mem *pMem;
51161 ** it is, return a pointer to the Mem for the value of that column.
51162 ** If iCol is not valid, return a pointer to a Mem which has a value
51165 static Mem *columnMem(sqlite3_stmt *pStmt, int i){
51168 Mem *pOut;
51177 ** a pointer to the following static Mem object which contains the
51178 ** value SQL NULL. Even though the Mem structure contains an element
51180 ** switches (-Os), gcc may align this Mem object on a 4-byte boundary
51183 ** that a Mem structure is located on an 8-byte boundary. To prevent
51187 static const Mem nullMem
51197 pOut = (Mem*)&nullMem;
51280 Mem *pOut = columnMem(pStmt, i);
51327 const void *(*xFunc)(Mem*),
51360 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_NAME);
51365 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_NAME);
51385 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_DECLTYPE);
51390 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_DECLTYPE);
51403 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_DATABASE);
51408 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_DATABASE);
51419 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_TABLE);
51424 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_TABLE);
51435 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_COLUMN);
51440 pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_COLUMN);
51462 Mem *pVar;
51508 Mem *pVar;
51864 Mem *pVar; /* Value of a host parameter */
51908 Mem utf8;
52027 static void updateMaxBlobsize(Mem *p){
52079 ** Call sqlite3VdbeMemExpandBlob() on the supplied value (type Mem*)
52090 SQLITE_PRIVATE void sqlite3VdbeMemStoreType(Mem *pMem){
52137 Mem *pMem = &p->aMem[p->nMem-iCur];
52174 static void applyNumericAffinity(Mem *pRec){
52211 Mem *pRec, /* The value to apply affinity to */
52243 Mem *pMem = (Mem*)pVal;
52251 ** not the internal Mem* type.
52258 applyAffinity((Mem *)pVal, affinity, enc);
52266 SQLITE_PRIVATE void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf){
52348 static void memTracePrint(FILE *out, Mem *p){
52368 static void registerTrace(FILE *out, int iReg, Mem *p){
52576 Mem *aMem = p->aMem; /* Copy of p->aMem */
52577 Mem *pIn1 = 0; /* 1st input operand */
52578 Mem *pIn2 = 0; /* 2nd input operand */
52579 Mem *pIn3 = 0; /* 3rd input operand */
52580 Mem *pOut = 0; /* Output operand */
52603 Mem *pVar; /* Value being transferred */
52612 Mem *pMem;
52627 Mem *pArg;
52671 Mem *pDest; /* Where to write the extracted value */
52672 Mem sMem; /* For storing the record being decoded */
52679 Mem *pReg; /* PseudoTable input register */
52687 Mem *pRec; /* The new record */
52694 Mem *pData0; /* First field to be combined into the record */
52695 Mem *pLast; /* Last field of the record */
52769 char aTempRec[ROUND8(sizeof(UnpackedRecord)) + sizeof(Mem)*3 + 7];
52776 Mem *aMx;
52791 Mem *pMem; /* Register holding largest rowid for AUTOINCREMENT */
52795 Mem *pData; /* MEM cell holding data for the record to be inserted */
52796 Mem *pKey; /* MEM cell holding key for the record */
52887 Mem *pnErr; /* Register keeping track of errors remaining */
52899 Mem *pRt; /* Register to allocate runtime space */
52900 Mem *pMem; /* Used to iterate through memory cells */
52901 Mem *pEnd; /* Last memory cell in new array */
52908 Mem *pIn;
52911 Mem *pIn1;
52917 Mem *pMem;
52918 Mem *pRec;
52923 Mem *pMem;
52941 Mem *pQuery;
52942 Mem *pArgc;
52948 Mem **apArg;
52953 Mem *pDest;
52964 Mem *pName;
52972 Mem **apArg;
52973 Mem *pX;
53084 ** external allocations out of mem[p2] and set mem[p2] to be
53086 ** value or convert mem[p2] to a different type.
53414 Mem *pVar; /* Value being transferred */
53523 Mem *pMem;
53786 Mem *pArg;
54498 Mem *pDest; /* Where to write the extracted value */
54499 Mem sMem; /* For storing the record being decoded */
54506 Mem *pReg; /* PseudoTable input register */
54719 ** a pointer to a Mem object.
54816 Mem *pRec; /* The new record */
54823 Mem *pData0; /* First field to be combined into the record */
54824 Mem *pLast; /* Last field of the record */
55875 char aTempRec[ROUND8(sizeof(UnpackedRecord)) + sizeof(Mem)*3 + 7];
55958 Mem *aMx;
56102 Mem *pMem; /* Register holding largest rowid for AUTOINCREMENT */
56178 assert( (u.be.pMem->flags & MEM_Int)!=0 ); /* mem(P3) holds an integer */
56272 Mem *pData; /* MEM cell holding data for the record to be inserted */
56273 Mem *pKey; /* MEM cell holding key for the record */
57188 Mem *pnErr; /* Register keeping track of errors remaining */
57347 Mem *pRt; /* Register to allocate runtime space */
57348 Mem *pMem; /* Used to iterate through memory cells */
57349 Mem *pEnd; /* Last memory cell in new array */
57394 + u.by.nMem * sizeof(Mem)
57460 Mem *pIn;
57521 Mem *pIn1;
57604 Mem *pMem;
57605 Mem *pRec;
57659 Mem *pMem;
57881 Mem *pQuery;
57882 Mem *pArgc;
57888 Mem **apArg;
57945 Mem *pDest;
57980 ** dynamic allocation in u.ch.sContext.s (a Mem struct) is released.
58053 Mem *pName;
58101 Mem **apArg;
58102 Mem *pX;
62097 int mem = ++pParse->nMem;
62098 sqlite3VdbeAddOp1(v, OP_If, mem);
62099 testAddr = sqlite3VdbeAddOp2(v, OP_Integer, 1, mem);
65255 ** iMem+nCol+1 .. Mem+2*nCol:
72532 Mem *pArg = (Mem *)argv[0];
72533 Mem *pBest;
72537 pBest = (Mem *)sqlite3_aggregate_context(context, sizeof(*pBest));
77097 int mem = ++pParse->nMem;
77102 sqlite3VdbeAddOp4(v, OP_Int64, 0, mem, 0, (char*)pI64, P4_INT64);
77105 sqlite3VdbeAddOp2(v, OP_ResultRow, mem, 1);
81043 ** records the previous output. mem[regPrev] is a flag that is false
83020 int iAMem; /* First Mem address for storing current GROUP BY */
83021 int iBMem; /* First Mem address for previous GROUP BY */
83022 int iUseFlag; /* Mem address holding flag indicating that at least
83025 int iAbortFlag; /* Mem address which causes query abort if positive */