Lines Matching refs:pMem
7731 Mem *pMem; /* Used when p4type is P4_MEM */
12232 Mem *pMem; /* Memory cell used to store aggregate context */
12379 SQLITE_PRIVATE int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve);
12383 SQLITE_PRIVATE void sqlite3VdbeMemStoreType(Mem *pMem);
12404 SQLITE_PRIVATE void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf);
12406 SQLITE_PRIVATE int sqlite3VdbeMemHandleBom(Mem *pMem);
19598 ** This routine transforms the internal text encoding used by pMem to
19600 ** encoding, or if *pMem does not contain a string value.
19602 SQLITE_PRIVATE int sqlite3VdbeMemTranslate(Mem *pMem, u8 desiredEnc){
19610 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
19611 assert( pMem->flags&MEM_Str );
19612 assert( pMem->enc!=desiredEnc );
19613 assert( pMem->enc!=0 );
19614 assert( pMem->n>=0 );
19619 sqlite3VdbeMemPrettyPrint(pMem, zBuf);
19628 if( pMem->enc!=SQLITE_UTF8 && desiredEnc!=SQLITE_UTF8 ){
19631 rc = sqlite3VdbeMemMakeWriteable(pMem);
19636 zIn = (u8*)pMem->z;
19637 zTerm = &zIn[pMem->n&~1];
19644 pMem->enc = desiredEnc;
19655 pMem->n &= ~1;
19656 len = pMem->n * 2 + 1;
19663 len = pMem->n * 2 + 2;
19672 zIn = (u8*)pMem->z;
19673 zTerm = &zIn[pMem->n];
19674 zOut = sqlite3DbMallocRaw(pMem->db, len);
19680 if( pMem->enc==SQLITE_UTF8 ){
19697 pMem->n = (int)(z - zOut);
19701 if( pMem->enc==SQLITE_UTF16LE ){
19714 pMem->n = (int)(z - zOut);
19717 assert( (pMem->n+(desiredEnc==SQLITE_UTF8?1:2))<=len );
19719 sqlite3VdbeMemRelease(pMem);
19720 pMem->flags &= ~(MEM_Static|MEM_Dyn|MEM_Ephem);
19721 pMem->enc = desiredEnc;
19722 pMem->flags |= (MEM_Term|MEM_Dyn);
19723 pMem->z = (char*)zOut;
19724 pMem->zMalloc = pMem->z;
19730 sqlite3VdbeMemPrettyPrint(pMem, zBuf);
19739 ** UTF-16 string stored in *pMem. If one is present, it is removed and
19746 SQLITE_PRIVATE int sqlite3VdbeMemHandleBom(Mem *pMem){
19750 assert( pMem->n>=0 );
19751 if( pMem->n>1 ){
19752 u8 b1 = *(u8 *)pMem->z;
19753 u8 b2 = *(((u8 *)pMem->z) + 1);
19763 rc = sqlite3VdbeMemMakeWriteable(pMem);
19765 pMem->n -= 2;
19766 memmove(pMem->z, &pMem->z[2], pMem->n);
19767 pMem->z[pMem->n] = '\0';
19768 pMem->z[pMem->n+1] = '\0';
19769 pMem->flags |= MEM_Term;
19770 pMem->enc = bom;
26656 void *pMem = mmap(0, szRegion, PROT_READ|PROT_WRITE,
26659 if( pMem==MAP_FAILED ){
26663 pShmNode->apRegion[pShmNode->nRegion] = pMem;
54191 ** If pMem is an object with a valid string representation, this routine
54195 ** If pMem is not a string object, or the encoding of the string
54203 SQLITE_PRIVATE int sqlite3VdbeChangeEncoding(Mem *pMem, int desiredEnc){
54205 assert( (pMem->flags&MEM_RowSet)==0 );
54208 if( !(pMem->flags&MEM_Str) || pMem->enc==desiredEnc ){
54211 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
54219 rc = sqlite3VdbeMemTranslate(pMem, (u8)desiredEnc);
54221 assert(rc==SQLITE_OK || pMem->enc!=desiredEnc);
54222 assert(rc==SQLITE_NOMEM || pMem->enc==desiredEnc);
54228 ** Make sure pMem->z points to a writable allocation of at least
54240 SQLITE_PRIVATE int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve){
54242 ((pMem->zMalloc && pMem->zMalloc==pMem->z) ? 1 : 0) +
54243 (((pMem->flags&MEM_Dyn)&&pMem->xDel) ? 1 : 0) +
54244 ((pMem->flags&MEM_Ephem) ? 1 : 0) +
54245 ((pMem->flags&MEM_Static) ? 1 : 0)
54247 assert( (pMem->flags&MEM_RowSet)==0 );
54250 if( sqlite3DbMallocSize(pMem->db, pMem->zMalloc)<n ){
54251 if( preserve && pMem->z==pMem->zMalloc ){
54252 pMem->z = pMem->zMalloc = sqlite3DbReallocOrFree(pMem->db, pMem->z, n);
54255 sqlite3DbFree(pMem->db, pMem->zMalloc);
54256 pMem->zMalloc = sqlite3DbMallocRaw(pMem->db, n);
54260 if( pMem->z && preserve && pMem->zMalloc && pMem->z!=pMem->zMalloc ){
54261 memcpy(pMem->zMalloc, pMem->z, pMem->n);
54263 if( pMem->flags&MEM_Dyn && pMem->xDel ){
54264 pMem->xDel((void *)(pMem->z));
54267 pMem->z = pMem->zMalloc;
54268 if( pMem->z==0 ){
54269 pMem->flags = MEM_Null;
54271 pMem->flags &= ~(MEM_Ephem|MEM_Static);
54273 pMem->xDel = 0;
54274 return (pMem->z ? SQLITE_OK : SQLITE_NOMEM);
54285 SQLITE_PRIVATE int sqlite3VdbeMemMakeWriteable(Mem *pMem){
54287 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
54288 assert( (pMem->flags&MEM_RowSet)==0 );
54289 expandBlob(pMem);
54290 f = pMem->flags;
54291 if( (f&(MEM_Str|MEM_Blob)) && pMem->z!=pMem->zMalloc ){
54292 if( sqlite3VdbeMemGrow(pMem, pMem->n + 2, 1) ){
54295 pMem->z[pMem->n] = 0;
54296 pMem->z[pMem->n+1] = 0;
54297 pMem->flags |= MEM_Term;
54299 pMem->pScopyFrom = 0;
54311 SQLITE_PRIVATE int sqlite3VdbeMemExpandBlob(Mem *pMem){
54312 if( pMem->flags & MEM_Zero ){
54314 assert( pMem->flags&MEM_Blob );
54315 assert( (pMem->flags&MEM_RowSet)==0 );
54316 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
54319 nByte = pMem->n + pMem->u.nZero;
54323 if( sqlite3VdbeMemGrow(pMem, nByte, 1) ){
54327 memset(&pMem->z[pMem->n], 0, pMem->u.nZero);
54328 pMem->n += pMem->u.nZero;
54329 pMem->flags &= ~(MEM_Zero|MEM_Term);
54339 SQLITE_PRIVATE int sqlite3VdbeMemNulTerminate(Mem *pMem){
54340 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
54341 if( (pMem->flags & MEM_Term)!=0 || (pMem->flags & MEM_Str)==0 ){
54344 if( sqlite3VdbeMemGrow(pMem, pMem->n+2, 1) ){
54347 pMem->z[pMem->n] = 0;
54348 pMem->z[pMem->n+1] = 0;
54349 pMem->flags |= MEM_Term;
54366 SQLITE_PRIVATE int sqlite3VdbeMemStringify(Mem *pMem, int enc){
54368 int fg = pMem->flags;
54371 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
54375 assert( (pMem->flags&MEM_RowSet)==0 );
54376 assert( EIGHT_BYTE_ALIGNMENT(pMem) );
54379 if( sqlite3VdbeMemGrow(pMem, nByte, 0) ){
54390 sqlite3_snprintf(nByte, pMem->z, "%lld", pMem->u.i);
54393 sqlite3_snprintf(nByte, pMem->z, "%!.15g", pMem->r);
54395 pMem->n = sqlite3Strlen30(pMem->z);
54396 pMem->enc = SQLITE_UTF8;
54397 pMem->flags |= MEM_Str|MEM_Term;
54398 sqlite3VdbeChangeEncoding(pMem, enc);
54403 ** Memory cell pMem contains the context of an aggregate function.
54405 ** result of the aggregate is stored back into pMem.
54410 SQLITE_PRIVATE int sqlite3VdbeMemFinalize(Mem *pMem, FuncDef *pFunc){
54414 assert( (pMem->flags & MEM_Null)!=0 || pFunc==pMem->u.pDef );
54415 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
54418 ctx.s.db = pMem->db;
54419 ctx.pMem = pMem;
54422 assert( 0==(pMem->flags&MEM_Dyn) && !pMem->xDel );
54423 sqlite3DbFree(pMem->db, pMem->zMalloc);
54424 memcpy(pMem, &ctx.s, sizeof(ctx.s));
54514 ** at representing the value that *pMem describes as an integer.
54515 ** If pMem is an integer, then the value is exact. If pMem is
54517 ** If pMem is a string or blob, then we make an attempt to convert
54518 ** it into a integer and return that. If pMem represents an
54521 ** If pMem represents a string value, its encoding might be changed.
54523 SQLITE_PRIVATE i64 sqlite3VdbeIntValue(Mem *pMem){
54525 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
54526 assert( EIGHT_BYTE_ALIGNMENT(pMem) );
54527 flags = pMem->flags;
54529 return pMem->u.i;
54531 return doubleToInt64(pMem->r);
54534 assert( pMem->z || pMem->n==0 );
54535 testcase( pMem->z==0 );
54536 sqlite3Atoi64(pMem->z, &value, pMem->n, pMem->enc);
54544 ** Return the best representation of pMem that we can get into a
54545 ** double. If pMem is already a double or an integer, return its
54549 SQLITE_PRIVATE double sqlite3VdbeRealValue(Mem *pMem){
54550 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
54551 assert( EIGHT_BYTE_ALIGNMENT(pMem) );
54552 if( pMem->flags & MEM_Real ){
54553 return pMem->r;
54554 }else if( pMem->flags & MEM_Int ){
54555 return (double)pMem->u.i;
54556 }else if( pMem->flags & (MEM_Str|MEM_Blob) ){
54559 sqlite3AtoF(pMem->z, &val, pMem->n, pMem->enc);
54571 SQLITE_PRIVATE void sqlite3VdbeIntegerAffinity(Mem *pMem){
54572 assert( pMem->flags & MEM_Real );
54573 assert( (pMem->flags & MEM_RowSet)==0 );
54574 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
54575 assert( EIGHT_BYTE_ALIGNMENT(pMem) );
54577 pMem->u.i = doubleToInt64(pMem->r);
54591 if( pMem->r==(double)pMem->u.i && pMem->u.i>SMALLEST_INT64
54592 && ALWAYS(pMem->u.i<LARGEST_INT64) ){
54593 pMem->flags |= MEM_Int;
54598 ** Convert pMem to type integer. Invalidate any prior representations.
54600 SQLITE_PRIVATE int sqlite3VdbeMemIntegerify(Mem *pMem){
54601 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
54602 assert( (pMem->flags & MEM_RowSet)==0 );
54603 assert( EIGHT_BYTE_ALIGNMENT(pMem) );
54605 pMem->u.i = sqlite3VdbeIntValue(pMem);
54606 MemSetTypeFlag(pMem, MEM_Int);
54611 ** Convert pMem so that it is of type MEM_Real.
54614 SQLITE_PRIVATE int sqlite3VdbeMemRealify(Mem *pMem){
54615 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
54616 assert( EIGHT_BYTE_ALIGNMENT(pMem) );
54618 pMem->r = sqlite3VdbeRealValue(pMem);
54619 MemSetTypeFlag(pMem, MEM_Real);
54624 ** Convert pMem so that it has types MEM_Real or MEM_Int or both.
54631 SQLITE_PRIVATE int sqlite3VdbeMemNumerify(Mem *pMem){
54632 if( (pMem->flags & (MEM_Int|MEM_Real|MEM_Null))==0 ){
54633 assert( (pMem->flags & (MEM_Blob|MEM_Str))!=0 );
54634 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
54635 if( 0==sqlite3Atoi64(pMem->z, &pMem->u.i, pMem->n, pMem->enc) ){
54636 MemSetTypeFlag(pMem, MEM_Int);
54638 pMem->r = sqlite3VdbeRealValue(pMem);
54639 MemSetTypeFlag(pMem, MEM_Real);
54640 sqlite3VdbeIntegerAffinity(pMem);
54643 assert( (pMem->flags & (MEM_Int|MEM_Real|MEM_Null))!=0 );
54644 pMem->flags &= ~(MEM_Str|MEM_Blob);
54649 ** Delete any previous value and set the value stored in *pMem to NULL.
54651 SQLITE_PRIVATE void sqlite3VdbeMemSetNull(Mem *pMem){
54652 if( pMem->flags & MEM_Frame ){
54653 VdbeFrame *pFrame = pMem->u.pFrame;
54657 if( pMem->flags & MEM_RowSet ){
54658 sqlite3RowSetClear(pMem->u.pRowSet);
54660 MemSetTypeFlag(pMem, MEM_Null);
54661 pMem->type = SQLITE_NULL;
54668 SQLITE_PRIVATE void sqlite3VdbeMemSetZeroBlob(Mem *pMem, int n){
54669 sqlite3VdbeMemRelease(pMem);
54670 pMem->flags = MEM_Blob|MEM_Zero;
54671 pMem->type = SQLITE_BLOB;
54672 pMem->n = 0;
54674 pMem->u.nZero = n;
54675 pMem->enc = SQLITE_UTF8;
54678 sqlite3VdbeMemGrow(pMem, n, 0);
54679 if( pMem->z ){
54680 pMem->n = n;
54681 memset(pMem->z, 0, n);
54687 ** Delete any previous value and set the value stored in *pMem to val,
54690 SQLITE_PRIVATE void sqlite3VdbeMemSetInt64(Mem *pMem, i64 val){
54691 sqlite3VdbeMemRelease(pMem);
54692 pMem->u.i = val;
54693 pMem->flags = MEM_Int;
54694 pMem->type = SQLITE_INTEGER;
54699 ** Delete any previous value and set the value stored in *pMem to val,
54702 SQLITE_PRIVATE void sqlite3VdbeMemSetDouble(Mem *pMem, double val){
54704 sqlite3VdbeMemSetNull(pMem);
54706 sqlite3VdbeMemRelease(pMem);
54707 pMem->r = val;
54708 pMem->flags = MEM_Real;
54709 pMem->type = SQLITE_FLOAT;
54715 ** Delete any previous value and set the value of pMem to be an
54718 SQLITE_PRIVATE void sqlite3VdbeMemSetRowSet(Mem *pMem){
54719 sqlite3 *db = pMem->db;
54721 assert( (pMem->flags & MEM_RowSet)==0 );
54722 sqlite3VdbeMemRelease(pMem);
54723 pMem->zMalloc = sqlite3DbMallocRaw(db, 64);
54725 pMem->flags = MEM_Null;
54727 assert( pMem->zMalloc );
54728 pMem->u.pRowSet = sqlite3RowSetInit(db, pMem->zMalloc,
54729 sqlite3DbMallocSize(db, pMem->zMalloc));
54730 assert( pMem->u.pRowSet!=0 );
54731 pMem->flags = MEM_RowSet;
54760 SQLITE_PRIVATE void sqlite3VdbeMemPrepareToChange(Vdbe *pVdbe, Mem *pMem){
54764 if( pX->pScopyFrom==pMem ){
54769 pMem->pScopyFrom = 0;
54848 ** is required to store the string, then value of pMem is unchanged. In
54852 Mem *pMem, /* Memory cell to set to string value */
54858 int nByte = n; /* New value for pMem->n */
54860 u16 flags = 0; /* New value for pMem->flags */
54862 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
54863 assert( (pMem->flags & MEM_RowSet)==0 );
54865 /* If z is a NULL pointer, set pMem to contain an SQL NULL. */
54867 sqlite3VdbeMemSetNull(pMem);
54871 if( pMem->db ){
54872 iLimit = pMem->db->aLimit[SQLITE_LIMIT_LENGTH];
54899 if( sqlite3VdbeMemGrow(pMem, nAlloc, 0) ){
54902 memcpy(pMem->z, z, nAlloc);
54904 sqlite3VdbeMemRelease(pMem);
54905 pMem->zMalloc = pMem->z = (char *)z;
54906 pMem->xDel = 0;
54908 sqlite3VdbeMemRelease(pMem);
54909 pMem->z = (char *)z;
54910 pMem->xDel = xDel;
54914 pMem->n = nByte;
54915 pMem->flags = flags;
54916 pMem->enc = (enc==0 ? SQLITE_UTF8 : enc);
54917 pMem->type = (enc==0 ? SQLITE_BLOB : SQLITE_TEXT);
54920 if( pMem->enc!=SQLITE_UTF8 && sqlite3VdbeMemHandleBom(pMem) ){
55055 ** into the pMem element.
55057 ** The pMem structure is assumed to be uninitialized. Any prior content
55061 ** to read from the disk) then the pMem is left in an inconsistent state.
55068 Mem *pMem /* OUT: Return data in this Mem structure. */
55078 assert( (pMem->flags & MEM_RowSet)==0 );
55086 if( offset+amt<=available && (pMem->flags&MEM_Dyn)==0 ){
55087 sqlite3VdbeMemRelease(pMem);
55088 pMem->z = &zData[offset];
55089 pMem->flags = MEM_Blob|MEM_Ephem;
55090 }else if( SQLITE_OK==(rc = sqlite3VdbeMemGrow(pMem, amt+2, 0)) ){
55091 pMem->flags = MEM_Blob|MEM_Dyn|MEM_Term;
55092 pMem->enc = 0;
55093 pMem->type = SQLITE_BLOB;
55095 rc = sqlite3BtreeKey(pCur, offset, amt, pMem->z);
55097 rc = sqlite3BtreeData(pCur, offset, amt, pMem->z);
55099 pMem->z[amt] = 0;
55100 pMem->z[amt+1] = 0;
55102 sqlite3VdbeMemRelease(pMem);
55105 pMem->n = amt;
56217 Mem *pMem = pOp->p4.pMem;
56218 assert( (pMem->flags & MEM_Null)==0 );
56219 if( pMem->flags & MEM_Str ){
56220 zP4 = pMem->z;
56221 }else if( pMem->flags & MEM_Int ){
56222 sqlite3_snprintf(nTemp, zTemp, "%lld", pMem->u.i);
56223 }else if( pMem->flags & MEM_Real ){
56224 sqlite3_snprintf(nTemp, zTemp, "%.16g", pMem->r);
56226 assert( pMem->flags & MEM_Blob );
56384 Mem *pMem = p->pResultSet = &p->aMem[1]; /* First Mem of result set */
56394 releaseMemArray(pMem, 8);
56457 pMem->flags = MEM_Int;
56458 pMem->type = SQLITE_INTEGER;
56459 pMem->u.i = i; /* Program counter */
56460 pMem++;
56462 pMem->flags = MEM_Static|MEM_Str|MEM_Term;
56463 pMem->z = (char*)sqlite3OpcodeName(pOp->opcode); /* Opcode */
56464 assert( pMem->z!=0 );
56465 pMem->n = sqlite3Strlen30(pMem->z);
56466 pMem->type = SQLITE_TEXT;
56467 pMem->enc = SQLITE_UTF8;
56468 pMem++;
56490 pMem->flags = MEM_Int;
56491 pMem->u.i = pOp->p1; /* P1 */
56492 pMem->type = SQLITE_INTEGER;
56493 pMem++;
56495 pMem->flags = MEM_Int;
56496 pMem->u.i = pOp->p2; /* P2 */
56497 pMem->type = SQLITE_INTEGER;
56498 pMem++;
56500 pMem->flags = MEM_Int;
56501 pMem->u.i = pOp->p3; /* P3 */
56502 pMem->type = SQLITE_INTEGER;
56503 pMem++;
56505 if( sqlite3VdbeMemGrow(pMem, 32, 0) ){ /* P4 */
56509 pMem->flags = MEM_Dyn|MEM_Str|MEM_Term;
56510 z = displayP4(pOp, pMem->z, 32);
56511 if( z!=pMem->z ){
56512 sqlite3VdbeMemSetStr(pMem, z, -1, SQLITE_UTF8, 0);
56514 assert( pMem->z!=0 );
56515 pMem->n = sqlite3Strlen30(pMem->z);
56516 pMem->enc = SQLITE_UTF8;
56518 pMem->type = SQLITE_TEXT;
56519 pMem++;
56522 if( sqlite3VdbeMemGrow(pMem, 4, 0) ){
56526 pMem->flags = MEM_Dyn|MEM_Str|MEM_Term;
56527 pMem->n = 2;
56528 sqlite3_snprintf(3, pMem->z, "%.2x", pOp->p5); /* P5 */
56529 pMem->type = SQLITE_TEXT;
56530 pMem->enc = SQLITE_UTF8;
56531 pMem++;
56535 pMem->flags = MEM_Str|MEM_Term;
56536 pMem->z = pOp->zComment;
56537 pMem->n = sqlite3Strlen30(pMem->z);
56538 pMem->enc = SQLITE_UTF8;
56539 pMem->type = SQLITE_TEXT;
56543 pMem->flags = MEM_Null; /* Comment */
56544 pMem->type = SQLITE_NULL;
57793 ** Return the serial-type for the value stored in pMem.
57795 SQLITE_PRIVATE u32 sqlite3VdbeSerialType(Mem *pMem, int file_format){
57796 int flags = pMem->flags;
57805 i64 i = pMem->u.i;
57821 assert( pMem->db->mallocFailed || flags&(MEM_Str|MEM_Blob) );
57822 n = pMem->n;
57824 n += pMem->u.nZero;
57896 ** Write the serialized data blob for the value stored in pMem into
57913 SQLITE_PRIVATE u32 sqlite3VdbeSerialPut(u8 *buf, int nBuf, Mem *pMem, int file_format){
57914 u32 serial_type = sqlite3VdbeSerialType(pMem, file_format);
57922 assert( sizeof(v)==sizeof(pMem->r) );
57923 memcpy(&v, &pMem->r, sizeof(v));
57926 v = pMem->u.i;
57939 assert( pMem->n + ((pMem->flags & MEM_Zero)?pMem->u.nZero:0)
57941 assert( pMem->n<=nBuf );
57942 len = pMem->n;
57943 memcpy(buf, pMem->z, len);
57944 if( pMem->flags & MEM_Zero ){
57945 len += pMem->u.nZero;
57950 memset(&buf[pMem->n], 0, len-pMem->n);
57961 ** and store the result in pMem. Return the number of bytes read.
57966 Mem *pMem /* Memory cell to write value into */
57972 pMem->flags = MEM_Null;
57976 pMem->u.i = (signed char)buf[0];
57977 pMem->flags = MEM_Int;
57981 pMem->u.i = (((signed char)buf[0])<<8) | buf[1];
57982 pMem->flags = MEM_Int;
57986 pMem->u.i = (((signed char)buf[0])<<16) | (buf[1]<<8) | buf[2];
57987 pMem->flags = MEM_Int;
57991 pMem->u.i = (buf[0]<<24) | (buf[1]<<16) | (buf[2]<<8) | buf[3];
57992 pMem->flags = MEM_Int;
57999 pMem->u.i = *(i64*)&x;
58000 pMem->flags = MEM_Int;
58024 pMem->u.i = *(i64*)&x;
58025 pMem->flags = MEM_Int;
58027 assert( sizeof(x)==8 && sizeof(pMem->r)==8 );
58029 memcpy(&pMem->r, &x, sizeof(x));
58030 pMem->flags = sqlite3IsNaN(pMem->r) ? MEM_Null : MEM_Real;
58036 pMem->u.i = serial_type-8;
58037 pMem->flags = MEM_Int;
58042 pMem->z = (char *)buf;
58043 pMem->n = len;
58044 pMem->xDel = 0;
58046 pMem->flags = MEM_Str | MEM_Ephem;
58048 pMem->flags = MEM_Blob | MEM_Ephem;
58084 Mem *pMem;
58106 p->aMem = pMem = (Mem*)&((char*)p)[ROUND8(sizeof(UnpackedRecord))];
58107 assert( EIGHT_BYTE_ALIGNMENT(pMem) );
58115 pMem->enc = pKeyInfo->enc;
58116 pMem->db = pKeyInfo->db;
58117 pMem->flags = 0;
58118 pMem->zMalloc = 0;
58119 d += sqlite3VdbeSerialGet(&aKey[d], serial_type, pMem);
58120 pMem++;
58133 Mem *pMem;
58137 for(i=0, pMem=p->aMem; i<p->nField; i++, pMem++){
58143 if( NEVER(pMem->zMalloc) ) sqlite3VdbeMemRelease(pMem);
58448 Mem *pMem = &v->aVar[iVar-1];
58449 if( 0==(pMem->flags & MEM_Null) ){
58452 sqlite3VdbeMemCopy((Mem *)pRet, pMem);
59015 Mem *pMem;
59018 pMem = p->pMem;
59020 if( (pMem->flags & MEM_Agg)==0 ){
59022 sqlite3VdbeMemReleaseExternal(pMem);
59023 pMem->flags = MEM_Null;
59024 pMem->z = 0;
59026 sqlite3VdbeMemGrow(pMem, nByte, 0);
59027 pMem->flags = MEM_Agg;
59028 pMem->u.pDef = p->pFunc;
59029 if( pMem->z ){
59030 memset(pMem->z, 0, nByte);
59034 return (void*)pMem->z;
59107 assert( p && p->pMem && p->pFunc && p->pFunc->xStep );
59108 return p->pMem->n;
60083 ** Argument pMem points at a register that will be passed to a
60085 ** This routine sets the pMem->type variable used by the sqlite3_value_*()
60088 SQLITE_PRIVATE void sqlite3VdbeMemStoreType(Mem *pMem){
60089 int flags = pMem->flags;
60091 pMem->type = SQLITE_NULL;
60094 pMem->type = SQLITE_INTEGER;
60097 pMem->type = SQLITE_FLOAT;
60100 pMem->type = SQLITE_TEXT;
60102 pMem->type = SQLITE_BLOB;
60135 Mem *pMem = &p->aMem[p->nMem-iCur];
60149 if( SQLITE_OK==sqlite3VdbeMemGrow(pMem, nByte, 0) ){
60150 p->apCsr[iCur] = pCx = (VdbeCursor*)pMem->z;
60155 pCx->aType = (u32 *)&pMem->z[ROUND8(sizeof(VdbeCursor))];
60159 &pMem->z[ROUND8(sizeof(VdbeCursor))+2*nField*sizeof(u32)];
60238 Mem *pMem = (Mem*)pVal;
60239 if( pMem->type==SQLITE_TEXT ){
60240 applyNumericAffinity(pMem);
60241 sqlite3VdbeMemStoreType(pMem);
60243 return pMem->type;
60260 ** Write a nice string representation of the contents of cell pMem
60263 SQLITE_PRIVATE void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf){
60265 int f = pMem->flags;
60287 sqlite3_snprintf(100, zCsr, "%d[", pMem->n);
60289 for(i=0; i<16 && i<pMem->n; i++){
60290 sqlite3_snprintf(100, zCsr, "%02X", ((int)pMem->z[i] & 0xFF));
60293 for(i=0; i<16 && i<pMem->n; i++){
60294 char z = pMem->z[i];
60299 sqlite3_snprintf(100, zCsr, "]%s", encnames[pMem->enc]);
60302 sqlite3_snprintf(100, zCsr,"+%dz",pMem->u.nZero);
60322 sqlite3_snprintf(100, &zBuf[k], "%d", pMem->n);
60325 for(j=0; j<15 && j<pMem->n; j++){
60326 u8 c = pMem->z[j];
60334 sqlite3_snprintf(100,&zBuf[k], encnames[pMem->enc]);
60604 Mem *pMem;
60785 Mem *pMem; /* Register holding largest rowid for AUTOINCREMENT */
60894 Mem *pMem; /* Used to iterate through memory cells */
60911 Mem *pMem;
60917 Mem *pMem;
61502 Mem *pMem;
61546 u.ad.pMem = p->pResultSet = &aMem[pOp->p1];
61548 assert( memIsValid(&u.ad.pMem[u.ad.i]) );
61549 Deephemeralize(&u.ad.pMem[u.ad.i]);
61550 assert( (u.ad.pMem[u.ad.i].flags & MEM_Ephem)==0
61551 || (u.ad.pMem[u.ad.i].flags & (MEM_Str|MEM_Blob))==0 );
61552 sqlite3VdbeMemNulTerminate(&u.ad.pMem[u.ad.i]);
61553 sqlite3VdbeMemStoreType(&u.ad.pMem[u.ad.i]);
61554 REGISTER_TRACE(pOp->p1+u.ad.i, &u.ad.pMem[u.ad.i]);
62746 sqlite3VdbeMemShallowCopy(u.am.pDest, pOp->p4.pMem, MEM_Static);
64134 Mem *pMem; /* Register holding largest rowid for AUTOINCREMENT */
64201 u.be.pMem = &u.be.pFrame->aMem[pOp->p3];
64205 u.be.pMem = &aMem[pOp->p3];
64206 memAboutToChange(p, u.be.pMem);
64208 assert( memIsValid(u.be.pMem) );
64210 REGISTER_TRACE(pOp->p3, u.be.pMem);
64211 sqlite3VdbeMemIntegerify(u.be.pMem);
64212 assert( (u.be.pMem->flags & MEM_Int)!=0 ); /* mem(P3) holds an integer */
64213 if( u.be.pMem->u.i==MAX_ROWID || u.be.pC->useRandomRowid ){
64217 if( u.be.v<u.be.pMem->u.i+1 ){
64218 u.be.v = u.be.pMem->u.i + 1;
64220 u.be.pMem->u.i = u.be.v;
65405 Mem *pMem; /* Used to iterate through memory cells */
65475 for(u.by.pMem=VdbeFrameMem(u.by.pFrame); u.by.pMem!=u.by.pEnd; u.by.pMem++){
65476 u.by.pMem->flags = MEM_Null;
65477 u.by.pMem->db = db;
65663 Mem *pMem;
65682 u.cb.ctx.pMem = u.cb.pMem = &aMem[pOp->p3];
65683 u.cb.pMem->n++;
65720 Mem *pMem;
65723 u.cc.pMem = &aMem[pOp->p1];
65724 assert( (u.cc.pMem->flags & ~(MEM_Null|MEM_Agg))==0 );
65725 rc = sqlite3VdbeMemFinalize(u.cc.pMem, pOp->p4.pFunc);
65727 sqlite3SetString(&p->zErrMsg, db, "%s", sqlite3_value_text(u.cc.pMem));
65729 sqlite3VdbeChangeEncoding(u.cc.pMem, encoding);
65730 UPDATE_MAX_BLOBSIZE(u.cc.pMem);
65731 if( sqlite3VdbeMemTooBig(u.cc.pMem) ){