Home | History | Annotate | Download | only in dist

Lines Matching refs:pMem

7724     Mem *pMem;             /* Used when p4type is P4_MEM */
12225 Mem *pMem; /* Memory cell used to store aggregate context */
12372 SQLITE_PRIVATE int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve);
12376 SQLITE_PRIVATE void sqlite3VdbeMemStoreType(Mem *pMem);
12397 SQLITE_PRIVATE void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf);
12399 SQLITE_PRIVATE int sqlite3VdbeMemHandleBom(Mem *pMem);
19591 ** This routine transforms the internal text encoding used by pMem to
19593 ** encoding, or if *pMem does not contain a string value.
19595 SQLITE_PRIVATE int sqlite3VdbeMemTranslate(Mem *pMem, u8 desiredEnc){
19603 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
19604 assert( pMem->flags&MEM_Str );
19605 assert( pMem->enc!=desiredEnc );
19606 assert( pMem->enc!=0 );
19607 assert( pMem->n>=0 );
19612 sqlite3VdbeMemPrettyPrint(pMem, zBuf);
19621 if( pMem->enc!=SQLITE_UTF8 && desiredEnc!=SQLITE_UTF8 ){
19624 rc = sqlite3VdbeMemMakeWriteable(pMem);
19629 zIn = (u8*)pMem->z;
19630 zTerm = &zIn[pMem->n&~1];
19637 pMem->enc = desiredEnc;
19648 pMem->n &= ~1;
19649 len = pMem->n * 2 + 1;
19656 len = pMem->n * 2 + 2;
19665 zIn = (u8*)pMem->z;
19666 zTerm = &zIn[pMem->n];
19667 zOut = sqlite3DbMallocRaw(pMem->db, len);
19673 if( pMem->enc==SQLITE_UTF8 ){
19690 pMem->n = (int)(z - zOut);
19694 if( pMem->enc==SQLITE_UTF16LE ){
19707 pMem->n = (int)(z - zOut);
19710 assert( (pMem->n+(desiredEnc==SQLITE_UTF8?1:2))<=len );
19712 sqlite3VdbeMemRelease(pMem);
19713 pMem->flags &= ~(MEM_Static|MEM_Dyn|MEM_Ephem);
19714 pMem->enc = desiredEnc;
19715 pMem->flags |= (MEM_Term|MEM_Dyn);
19716 pMem->z = (char*)zOut;
19717 pMem->zMalloc = pMem->z;
19723 sqlite3VdbeMemPrettyPrint(pMem, zBuf);
19732 ** UTF-16 string stored in *pMem. If one is present, it is removed and
19739 SQLITE_PRIVATE int sqlite3VdbeMemHandleBom(Mem *pMem){
19743 assert( pMem->n>=0 );
19744 if( pMem->n>1 ){
19745 u8 b1 = *(u8 *)pMem->z;
19746 u8 b2 = *(((u8 *)pMem->z) + 1);
19756 rc = sqlite3VdbeMemMakeWriteable(pMem);
19758 pMem->n -= 2;
19759 memmove(pMem->z, &pMem->z[2], pMem->n);
19760 pMem->z[pMem->n] = '\0';
19761 pMem->z[pMem->n+1] = '\0';
19762 pMem->flags |= MEM_Term;
19763 pMem->enc = bom;
26649 void *pMem = mmap(0, szRegion, PROT_READ|PROT_WRITE,
26652 if( pMem==MAP_FAILED ){
26656 pShmNode->apRegion[pShmNode->nRegion] = pMem;
54184 ** If pMem is an object with a valid string representation, this routine
54188 ** If pMem is not a string object, or the encoding of the string
54196 SQLITE_PRIVATE int sqlite3VdbeChangeEncoding(Mem *pMem, int desiredEnc){
54198 assert( (pMem->flags&MEM_RowSet)==0 );
54201 if( !(pMem->flags&MEM_Str) || pMem->enc==desiredEnc ){
54204 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
54212 rc = sqlite3VdbeMemTranslate(pMem, (u8)desiredEnc);
54214 assert(rc==SQLITE_OK || pMem->enc!=desiredEnc);
54215 assert(rc==SQLITE_NOMEM || pMem->enc==desiredEnc);
54221 ** Make sure pMem->z points to a writable allocation of at least
54233 SQLITE_PRIVATE int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve){
54235 ((pMem->zMalloc && pMem->zMalloc==pMem->z) ? 1 : 0) +
54236 (((pMem->flags&MEM_Dyn)&&pMem->xDel) ? 1 : 0) +
54237 ((pMem->flags&MEM_Ephem) ? 1 : 0) +
54238 ((pMem->flags&MEM_Static) ? 1 : 0)
54240 assert( (pMem->flags&MEM_RowSet)==0 );
54243 if( sqlite3DbMallocSize(pMem->db, pMem->zMalloc)<n ){
54244 if( preserve && pMem->z==pMem->zMalloc ){
54245 pMem->z = pMem->zMalloc = sqlite3DbReallocOrFree(pMem->db, pMem->z, n);
54248 sqlite3DbFree(pMem->db, pMem->zMalloc);
54249 pMem->zMalloc = sqlite3DbMallocRaw(pMem->db, n);
54253 if( pMem->z && preserve && pMem->zMalloc && pMem->z!=pMem->zMalloc ){
54254 memcpy(pMem->zMalloc, pMem->z, pMem->n);
54256 if( pMem->flags&MEM_Dyn && pMem->xDel ){
54257 pMem->xDel((void *)(pMem->z));
54260 pMem->z = pMem->zMalloc;
54261 if( pMem->z==0 ){
54262 pMem->flags = MEM_Null;
54264 pMem->flags &= ~(MEM_Ephem|MEM_Static);
54266 pMem->xDel = 0;
54267 return (pMem->z ? SQLITE_OK : SQLITE_NOMEM);
54278 SQLITE_PRIVATE int sqlite3VdbeMemMakeWriteable(Mem *pMem){
54280 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
54281 assert( (pMem->flags&MEM_RowSet)==0 );
54282 expandBlob(pMem);
54283 f = pMem->flags;
54284 if( (f&(MEM_Str|MEM_Blob)) && pMem->z!=pMem->zMalloc ){
54285 if( sqlite3VdbeMemGrow(pMem, pMem->n + 2, 1) ){
54288 pMem->z[pMem->n] = 0;
54289 pMem->z[pMem->n+1] = 0;
54290 pMem->flags |= MEM_Term;
54292 pMem->pScopyFrom = 0;
54304 SQLITE_PRIVATE int sqlite3VdbeMemExpandBlob(Mem *pMem){
54305 if( pMem->flags & MEM_Zero ){
54307 assert( pMem->flags&MEM_Blob );
54308 assert( (pMem->flags&MEM_RowSet)==0 );
54309 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
54312 nByte = pMem->n + pMem->u.nZero;
54316 if( sqlite3VdbeMemGrow(pMem, nByte, 1) ){
54320 memset(&pMem->z[pMem->n], 0, pMem->u.nZero);
54321 pMem->n += pMem->u.nZero;
54322 pMem->flags &= ~(MEM_Zero|MEM_Term);
54332 SQLITE_PRIVATE int sqlite3VdbeMemNulTerminate(Mem *pMem){
54333 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
54334 if( (pMem->flags & MEM_Term)!=0 || (pMem->flags & MEM_Str)==0 ){
54337 if( sqlite3VdbeMemGrow(pMem, pMem->n+2, 1) ){
54340 pMem->z[pMem->n] = 0;
54341 pMem->z[pMem->n+1] = 0;
54342 pMem->flags |= MEM_Term;
54359 SQLITE_PRIVATE int sqlite3VdbeMemStringify(Mem *pMem, int enc){
54361 int fg = pMem->flags;
54364 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
54368 assert( (pMem->flags&MEM_RowSet)==0 );
54369 assert( EIGHT_BYTE_ALIGNMENT(pMem) );
54372 if( sqlite3VdbeMemGrow(pMem, nByte, 0) ){
54383 sqlite3_snprintf(nByte, pMem->z, "%lld", pMem->u.i);
54386 sqlite3_snprintf(nByte, pMem->z, "%!.15g", pMem->r);
54388 pMem->n = sqlite3Strlen30(pMem->z);
54389 pMem->enc = SQLITE_UTF8;
54390 pMem->flags |= MEM_Str|MEM_Term;
54391 sqlite3VdbeChangeEncoding(pMem, enc);
54396 ** Memory cell pMem contains the context of an aggregate function.
54398 ** result of the aggregate is stored back into pMem.
54403 SQLITE_PRIVATE int sqlite3VdbeMemFinalize(Mem *pMem, FuncDef *pFunc){
54407 assert( (pMem->flags & MEM_Null)!=0 || pFunc==pMem->u.pDef );
54408 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
54411 ctx.s.db = pMem->db;
54412 ctx.pMem = pMem;
54415 assert( 0==(pMem->flags&MEM_Dyn) && !pMem->xDel );
54416 sqlite3DbFree(pMem->db, pMem->zMalloc);
54417 memcpy(pMem, &ctx.s, sizeof(ctx.s));
54507 pMem describes as an integer.
54508 ** If pMem is an integer, then the value is exact. If pMem is
54510 ** If pMem is a string or blob, then we make an attempt to convert
54511 ** it into a integer and return that. If pMem represents an
54514 ** If pMem represents a string value, its encoding might be changed.
54516 SQLITE_PRIVATE i64 sqlite3VdbeIntValue(Mem *pMem){
54518 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
54519 assert( EIGHT_BYTE_ALIGNMENT(pMem) );
54520 flags = pMem->flags;
54522 return pMem->u.i;
54524 return doubleToInt64(pMem->r);
54527 assert( pMem->z || pMem->n==0 );
54528 testcase( pMem->z==0 );
54529 sqlite3Atoi64(pMem->z, &value, pMem->n, pMem->enc);
54537 ** Return the best representation of pMem that we can get into a
54538 ** double. If pMem is already a double or an integer, return its
54542 SQLITE_PRIVATE double sqlite3VdbeRealValue(Mem *pMem){
54543 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
54544 assert( EIGHT_BYTE_ALIGNMENT(pMem) );
54545 if( pMem->flags & MEM_Real ){
54546 return pMem->r;
54547 }else if( pMem->flags & MEM_Int ){
54548 return (double)pMem->u.i;
54549 }else if( pMem->flags & (MEM_Str|MEM_Blob) ){
54552 sqlite3AtoF(pMem->z, &val, pMem->n, pMem->enc);
54564 SQLITE_PRIVATE void sqlite3VdbeIntegerAffinity(Mem *pMem){
54565 assert( pMem->flags & MEM_Real );
54566 assert( (pMem->flags & MEM_RowSet)==0 );
54567 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
54568 assert( EIGHT_BYTE_ALIGNMENT(pMem) );
54570 pMem->u.i = doubleToInt64(pMem->r);
54584 if( pMem->r==(double)pMem->u.i && pMem->u.i>SMALLEST_INT64
54585 && ALWAYS(pMem->u.i<LARGEST_INT64) ){
54586 pMem->flags |= MEM_Int;
54591 ** Convert pMem to type integer. Invalidate any prior representations.
54593 SQLITE_PRIVATE int sqlite3VdbeMemIntegerify(Mem *pMem){
54594 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
54595 assert( (pMem->flags & MEM_RowSet)==0 );
54596 assert( EIGHT_BYTE_ALIGNMENT(pMem) );
54598 pMem->u.i = sqlite3VdbeIntValue(pMem);
54599 MemSetTypeFlag(pMem, MEM_Int);
54604 ** Convert pMem so that it is of type MEM_Real.
54607 SQLITE_PRIVATE int sqlite3VdbeMemRealify(Mem *pMem){
54608 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
54609 assert( EIGHT_BYTE_ALIGNMENT(pMem) );
54611 pMem->r = sqlite3VdbeRealValue(pMem);
54612 MemSetTypeFlag(pMem, MEM_Real);
54617 ** Convert pMem so that it has types MEM_Real or MEM_Int or both.
54624 SQLITE_PRIVATE int sqlite3VdbeMemNumerify(Mem *pMem){
54625 if( (pMem->flags & (MEM_Int|MEM_Real|MEM_Null))==0 ){
54626 assert( (pMem->flags & (MEM_Blob|MEM_Str))!=0 );
54627 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
54628 if( 0==sqlite3Atoi64(pMem->z, &pMem->u.i, pMem->n, pMem->enc) ){
54629 MemSetTypeFlag(pMem, MEM_Int);
54631 pMem->r = sqlite3VdbeRealValue(pMem);
54632 MemSetTypeFlag(pMem, MEM_Real);
54633 sqlite3VdbeIntegerAffinity(pMem);
54636 assert( (pMem->flags & (MEM_Int|MEM_Real|MEM_Null))!=0 );
54637 pMem->flags &= ~(MEM_Str|MEM_Blob);
54642 ** Delete any previous value and set the value stored in *pMem to NULL.
54644 SQLITE_PRIVATE void sqlite3VdbeMemSetNull(Mem *pMem){
54645 if( pMem->flags & MEM_Frame ){
54646 VdbeFrame *pFrame = pMem->u.pFrame;
54650 if( pMem->flags & MEM_RowSet ){
54651 sqlite3RowSetClear(pMem->u.pRowSet);
54653 MemSetTypeFlag(pMem, MEM_Null);
54654 pMem->type = SQLITE_NULL;
54661 SQLITE_PRIVATE void sqlite3VdbeMemSetZeroBlob(Mem *pMem, int n){
54662 sqlite3VdbeMemRelease(pMem);
54663 pMem->flags = MEM_Blob|MEM_Zero;
54664 pMem->type = SQLITE_BLOB;
54665 pMem->n = 0;
54667 pMem->u.nZero = n;
54668 pMem->enc = SQLITE_UTF8;
54671 sqlite3VdbeMemGrow(pMem, n, 0);
54672 if( pMem->z ){
54673 pMem->n = n;
54674 memset(pMem->z, 0, n);
54680 ** Delete any previous value and set the value stored in *pMem to val,
54683 SQLITE_PRIVATE void sqlite3VdbeMemSetInt64(Mem *pMem, i64 val){
54684 sqlite3VdbeMemRelease(pMem);
54685 pMem->u.i = val;
54686 pMem->flags = MEM_Int;
54687 pMem->type = SQLITE_INTEGER;
54692 ** Delete any previous value and set the value stored in *pMem to val,
54695 SQLITE_PRIVATE void sqlite3VdbeMemSetDouble(Mem *pMem, double val){
54697 sqlite3VdbeMemSetNull(pMem);
54699 sqlite3VdbeMemRelease(pMem);
54700 pMem->r = val;
54701 pMem->flags = MEM_Real;
54702 pMem->type = SQLITE_FLOAT;
54708 ** Delete any previous value and set the value of pMem to be an
54711 SQLITE_PRIVATE void sqlite3VdbeMemSetRowSet(Mem *pMem){
54712 sqlite3 *db = pMem->db;
54714 assert( (pMem->flags & MEM_RowSet)==0 );
54715 sqlite3VdbeMemRelease(pMem);
54716 pMem->zMalloc = sqlite3DbMallocRaw(db, 64);
54718 pMem->flags = MEM_Null;
54720 assert( pMem->zMalloc );
54721 pMem->u.pRowSet = sqlite3RowSetInit(db, pMem->zMalloc,
54722 sqlite3DbMallocSize(db, pMem->zMalloc));
54723 assert( pMem->u.pRowSet!=0 );
54724 pMem->flags = MEM_RowSet;
54753 SQLITE_PRIVATE void sqlite3VdbeMemPrepareToChange(Vdbe *pVdbe, Mem *pMem){
54757 if( pX->pScopyFrom==pMem ){
54762 pMem->pScopyFrom = 0;
54841 ** is required to store the string, then value of pMem is unchanged. In
54845 Mem *pMem, /* Memory cell to set to string value */
54851 int nByte = n; /* New value for pMem->n */
54853 u16 flags = 0; /* New value for pMem->flags */
54855 assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
54856 assert( (pMem->flags & MEM_RowSet)==0 );
54858 /* If z is a NULL pointer, set pMem to contain an SQL NULL. */
54860 sqlite3VdbeMemSetNull(pMem);
54864 if( pMem->db ){
54865 iLimit = pMem->db->aLimit[SQLITE_LIMIT_LENGTH];
54892 if( sqlite3VdbeMemGrow(pMem, nAlloc, 0) ){
54895 memcpy(pMem->z, z, nAlloc);
54897 sqlite3VdbeMemRelease(pMem);
54898 pMem->zMalloc = pMem->z = (char *)z;
54899 pMem->xDel = 0;
54901 sqlite3VdbeMemRelease(pMem);
54902 pMem->z = (char *)z;
54903 pMem->xDel = xDel;
54907 pMem->n = nByte;
54908 pMem->flags = flags;
54909 pMem->enc = (enc==0 ? SQLITE_UTF8 : enc);
54910 pMem->type = (enc==0 ? SQLITE_BLOB : SQLITE_TEXT);
54913 if( pMem->enc!=SQLITE_UTF8 && sqlite3VdbeMemHandleBom(pMem) ){
55048 ** into the pMem element.
55050 ** The pMem structure is assumed to be uninitialized. Any prior content
55054 ** to read from the disk) then the pMem is left in an inconsistent state.
55061 Mem *pMem /* OUT: Return data in this Mem structure. */
55071 assert( (pMem->flags & MEM_RowSet)==0 );
55079 if( offset+amt<=available && (pMem->flags&MEM_Dyn)==0 ){
55080 sqlite3VdbeMemRelease(pMem);
55081 pMem->z = &zData[offset];
55082 pMem->flags = MEM_Blob|MEM_Ephem;
55083 }else if( SQLITE_OK==(rc = sqlite3VdbeMemGrow(pMem, amt+2, 0)) ){
55084 pMem->flags = MEM_Blob|MEM_Dyn|MEM_Term;
55085 pMem->enc = 0;
55086 pMem->type = SQLITE_BLOB;
55088 rc = sqlite3BtreeKey(pCur, offset, amt, pMem->z);
55090 rc = sqlite3BtreeData(pCur, offset, amt, pMem->z);
55092 pMem->z[amt] = 0;
55093 pMem->z[amt+1] = 0;
55095 sqlite3VdbeMemRelease(pMem);
55098 pMem->n = amt;
56210 Mem *pMem = pOp->p4.pMem;
56211 assert( (pMem->flags & MEM_Null)==0 );
56212 if( pMem->flags & MEM_Str ){
56213 zP4 = pMem->z;
56214 }else if( pMem->flags & MEM_Int ){
56215 sqlite3_snprintf(nTemp, zTemp, "%lld", pMem->u.i);
56216 }else if( pMem->flags & MEM_Real ){
56217 sqlite3_snprintf(nTemp, zTemp, "%.16g", pMem->r);
56219 assert( pMem->flags & MEM_Blob );
56377 Mem *pMem = p->pResultSet = &p->aMem[1]; /* First Mem of result set */
56387 releaseMemArray(pMem, 8);
56450 pMem->flags = MEM_Int;
56451 pMem->type = SQLITE_INTEGER;
56452 pMem->u.i = i; /* Program counter */
56453 pMem++;
56455 pMem->flags = MEM_Static|MEM_Str|MEM_Term;
56456 pMem->z = (char*)sqlite3OpcodeName(pOp->opcode); /* Opcode */
56457 assert( pMem->z!=0 );
56458 pMem->n = sqlite3Strlen30(pMem->z);
56459 pMem->type = SQLITE_TEXT;
56460 pMem->enc = SQLITE_UTF8;
56461 pMem++;
56483 pMem->flags = MEM_Int;
56484 pMem->u.i = pOp->p1; /* P1 */
56485 pMem->type = SQLITE_INTEGER;
56486 pMem++;
56488 pMem->flags = MEM_Int;
56489 pMem->u.i = pOp->p2; /* P2 */
56490 pMem->type = SQLITE_INTEGER;
56491 pMem++;
56493 pMem->flags = MEM_Int;
56494 pMem->u.i = pOp->p3; /* P3 */
56495 pMem->type = SQLITE_INTEGER;
56496 pMem++;
56498 if( sqlite3VdbeMemGrow(pMem, 32, 0) ){ /* P4 */
56502 pMem->flags = MEM_Dyn|MEM_Str|MEM_Term;
56503 z = displayP4(pOp, pMem->z, 32);
56504 if( z!=pMem->z ){
56505 sqlite3VdbeMemSetStr(pMem, z, -1, SQLITE_UTF8, 0);
56507 assert( pMem->z!=0 );
56508 pMem->n = sqlite3Strlen30(pMem->z);
56509 pMem->enc = SQLITE_UTF8;
56511 pMem->type = SQLITE_TEXT;
56512 pMem++;
56515 if( sqlite3VdbeMemGrow(pMem, 4, 0) ){
56519 pMem->flags = MEM_Dyn|MEM_Str|MEM_Term;
56520 pMem->n = 2;
56521 sqlite3_snprintf(3, pMem->z, "%.2x", pOp->p5); /* P5 */
56522 pMem->type = SQLITE_TEXT;
56523 pMem->enc = SQLITE_UTF8;
56524 pMem++;
56528 pMem->flags = MEM_Str|MEM_Term;
56529 pMem->z = pOp->zComment;
56530 pMem->n = sqlite3Strlen30(pMem->z);
56531 pMem->enc = SQLITE_UTF8;
56532 pMem->type = SQLITE_TEXT;
56536 pMem->flags = MEM_Null; /* Comment */
56537 pMem->type = SQLITE_NULL;
57786 ** Return the serial-type for the value stored in pMem.
57788 SQLITE_PRIVATE u32 sqlite3VdbeSerialType(Mem *pMem, int file_format){
57789 int flags = pMem->flags;
57798 i64 i = pMem->u.i;
57814 assert( pMem->db->mallocFailed || flags&(MEM_Str|MEM_Blob) );
57815 n = pMem->n;
57817 n += pMem->u.nZero;
57889 ** Write the serialized data blob for the value stored in pMem into
57906 SQLITE_PRIVATE u32 sqlite3VdbeSerialPut(u8 *buf, int nBuf, Mem *pMem, int file_format){
57907 u32 serial_type = sqlite3VdbeSerialType(pMem, file_format);
57915 assert( sizeof(v)==sizeof(pMem->r) );
57916 memcpy(&v, &pMem->r, sizeof(v));
57919 v = pMem->u.i;
57932 assert( pMem->n + ((pMem->flags & MEM_Zero)?pMem->u.nZero:0)
57934 assert( pMem->n<=nBuf );
57935 len = pMem->n;
57936 memcpy(buf, pMem->z, len);
57937 if( pMem->flags & MEM_Zero ){
57938 len += pMem->u.nZero;
57943 memset(&buf[pMem->n], 0, len-pMem->n);
57954 ** and store the result in pMem. Return the number of bytes read.
57959 Mem *pMem /* Memory cell to write value into */
57965 pMem->flags = MEM_Null;
57969 pMem->u.i = (signed char)buf[0];
57970 pMem->flags = MEM_Int;
57974 pMem->u.i = (((signed char)buf[0])<<8) | buf[1];
57975 pMem->flags = MEM_Int;
57979 pMem->u.i = (((signed char)buf[0])<<16) | (buf[1]<<8) | buf[2];
57980 pMem->flags = MEM_Int;
57984 pMem->u.i = (buf[0]<<24) | (buf[1]<<16) | (buf[2]<<8) | buf[3];
57985 pMem->flags = MEM_Int;
57992 pMem->u.i = *(i64*)&x;
57993 pMem->flags = MEM_Int;
58017 pMem->u.i = *(i64*)&x;
58018 pMem->flags = MEM_Int;
58020 assert( sizeof(x)==8 && sizeof(pMem->r)==8 );
58022 memcpy(&pMem->r, &x, sizeof(x));
58023 pMem->flags = sqlite3IsNaN(pMem->r) ? MEM_Null : MEM_Real;
58029 pMem->u.i = serial_type-8;
58030 pMem->flags = MEM_Int;
58035 pMem->z = (char *)buf;
58036 pMem->n = len;
58037 pMem->xDel = 0;
58039 pMem->flags = MEM_Str | MEM_Ephem;
58041 pMem->flags = MEM_Blob | MEM_Ephem;
58077 Mem *pMem;
58099 p->aMem = pMem = (Mem*)&((char*)p)[ROUND8(sizeof(UnpackedRecord))];
58100 assert( EIGHT_BYTE_ALIGNMENT(pMem) );
58108 pMem->enc = pKeyInfo->enc;
58109 pMem->db = pKeyInfo->db;
58110 pMem->flags = 0;
58111 pMem->zMalloc = 0;
58112 d += sqlite3VdbeSerialGet(&aKey[d], serial_type, pMem);
58113 pMem++;
58126 Mem *pMem;
58130 for(i=0, pMem=p->aMem; i<p->nField; i++, pMem++){
58136 if( NEVER(pMem->zMalloc) ) sqlite3VdbeMemRelease(pMem);
58441 Mem *pMem = &v->aVar[iVar-1];
58442 if( 0==(pMem->flags & MEM_Null) ){
58445 sqlite3VdbeMemCopy((Mem *)pRet, pMem);
59008 Mem *pMem;
59011 pMem = p->pMem;
59013 if( (pMem->flags & MEM_Agg)==0 ){
59015 sqlite3VdbeMemReleaseExternal(pMem);
59016 pMem->flags = MEM_Null;
59017 pMem->z = 0;
59019 sqlite3VdbeMemGrow(pMem, nByte, 0);
59020 pMem->flags = MEM_Agg;
59021 pMem->u.pDef = p->pFunc;
59022 if( pMem->z ){
59023 memset(pMem->z, 0, nByte);
59027 return (void*)pMem->z;
59100 assert( p && p->pMem && p->pFunc && p->pFunc->xStep );
59101 return p->pMem->n;
60076 ** Argument pMem points at a register that will be passed to a
60078 ** This routine sets the pMem->type variable used by the sqlite3_value_*()
60081 SQLITE_PRIVATE void sqlite3VdbeMemStoreType(Mem *pMem){
60082 int flags = pMem->flags;
60084 pMem->type = SQLITE_NULL;
60087 pMem->type = SQLITE_INTEGER;
60090 pMem->type = SQLITE_FLOAT;
60093 pMem->type = SQLITE_TEXT;
60095 pMem->type = SQLITE_BLOB;
60128 Mem *pMem = &p->aMem[p->nMem-iCur];
60142 if( SQLITE_OK==sqlite3VdbeMemGrow(pMem, nByte, 0) ){
60143 p->apCsr[iCur] = pCx = (VdbeCursor*)pMem->z;
60148 pMem->z[ROUND8(sizeof(VdbeCursor))];
60152 &pMem->z[ROUND8(sizeof(VdbeCursor))+2*nField*sizeof(u32)];
60231 Mem *pMem = (Mem*)pVal;
60232 if( pMem->type==SQLITE_TEXT ){
60233 applyNumericAffinity(pMem);
60234 sqlite3VdbeMemStoreType(pMem);
60236 return pMem->type;
60253 ** Write a nice string representation of the contents of cell pMem
60256 SQLITE_PRIVATE void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf){
60258 int f = pMem->flags;
60280 sqlite3_snprintf(100, zCsr, "%d[", pMem->n);
60282 for(i=0; i<16 && i<pMem->n; i++){
60283 sqlite3_snprintf(100, zCsr, "%02X", ((int)pMem->z[i] & 0xFF));
60286 for(i=0; i<16 && i<pMem->n; i++){
60287 char z = pMem->z[i];
60292 sqlite3_snprintf(100, zCsr, "]%s", encnames[pMem->enc]);
60295 sqlite3_snprintf(100, zCsr,"+%dz",pMem->u.nZero);
60315 sqlite3_snprintf(100, &zBuf[k], "%d", pMem->n);
60318 for(j=0; j<15 && j<pMem->n; j++){
60319 u8 c = pMem->z[j];
60327 sqlite3_snprintf(100,&zBuf[k], encnames[pMem->enc]);
60597 Mem *pMem;
60778 Mem *pMem; /* Register holding largest rowid for AUTOINCREMENT */
60887 Mem *pMem; /* Used to iterate through memory cells */
60904 Mem *pMem;
60910 Mem *pMem;
61495 Mem *pMem;
61539 u.ad.pMem = p->pResultSet = &aMem[pOp->p1];
61541 assert( memIsValid(&u.ad.pMem[u.ad.i]) );
61542 Deephemeralize(&u.ad.pMem[u.ad.i]);
61543 assert( (u.ad.pMem[u.ad.i].flags & MEM_Ephem)==0
61544 || (u.ad.pMem[u.ad.i].flags & (MEM_Str|MEM_Blob))==0 );
61545 sqlite3VdbeMemNulTerminate(&u.ad.pMem[u.ad.i]);
61546 sqlite3VdbeMemStoreType(&u.ad.pMem[u.ad.i]);
61547 REGISTER_TRACE(pOp->p1+u.ad.i, &u.ad.pMem[u.ad.i]);
62739 sqlite3VdbeMemShallowCopy(u.am.pDest, pOp->p4.pMem, MEM_Static);
64127 Mem *pMem; /* Register holding largest rowid for AUTOINCREMENT */
64194 u.be.pMem = &u.be.pFrame->aMem[pOp->p3];
64198 u.be.pMem = &aMem[pOp->p3];
64199 memAboutToChange(p, u.be.pMem);
64201 assert( memIsValid(u.be.pMem) );
64203 REGISTER_TRACE(pOp->p3, u.be.pMem);
64204 sqlite3VdbeMemIntegerify(u.be.pMem);
64205 assert( (u.be.pMem->flags & MEM_Int)!=0 ); /* mem(P3) holds an integer */
64206 if( u.be.pMem->u.i==MAX_ROWID || u.be.pC->useRandomRowid ){
64210 if( u.be.v<u.be.pMem->u.i+1 ){
64211 u.be.v = u.be.pMem->u.i + 1;
64213 u.be.pMem->u.i = u.be.v;
65398 Mem *pMem; /* Used to iterate through memory cells */
65468 for(u.by.pMem=VdbeFrameMem(u.by.pFrame); u.by.pMem!=u.by.pEnd; u.by.pMem++){
65469 u.by.pMem->flags = MEM_Null;
65470 u.by.pMem->db = db;
65656 Mem *pMem;
65675 u.cb.ctx.pMem = u.cb.pMem = &aMem[pOp->p3];
65676 u.cb.pMem->n++;
65713 Mem *pMem;
65716 u.cc.pMem = &aMem[pOp->p1];
65717 assert( (u.cc.pMem->flags & ~(MEM_Null|MEM_Agg))==0 );
65718 rc = sqlite3VdbeMemFinalize(u.cc.pMem, pOp->p4.pFunc);
65720 sqlite3SetString(&p->zErrMsg, db, "%s", sqlite3_value_text(u.cc.pMem));
65722 sqlite3VdbeChangeEncoding(u.cc.pMem, encoding);
65723 UPDATE_MAX_BLOBSIZE(u.cc.pMem);
65724 if( sqlite3VdbeMemTooBig(u.cc.pMem) ){