/ Check-in [c1745f47]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Bugfix for row format. (CVS 1391)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: c1745f47ae6597953426c852559c3ba559b5ecd4
User & Date: danielk1977 2004-05-18 01:31:14
Context
2004-05-18
09:58
Fix many problems with manifest types and column affinity. Most things are working now. (CVS 1392) check-in: a62872aa user: danielk1977 tags: trunk
01:31
Bugfix for row format. (CVS 1391) check-in: c1745f47 user: danielk1977 tags: trunk
01:23
Omit the '\0' at the end of UTF-8 strings on disk (it is implied). Also don't store the number of rows at the beginning of each table record. (CVS 1390) check-in: 202a470f user: danielk1977 tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/vdbeaux.c.

1165
1166
1167
1168
1169
1170
1171





1172
1173
1174
1175
1176
1177
1178
1179
....
1282
1283
1284
1285
1286
1287
1288

1289
1290

1291
1292

1293
1294

1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305

1306



1307
1308
1309
1310
1311
1312
1313
....
1456
1457
1458
1459
1460
1461
1462
























1463
1464
1465
1466
1467
1468
1469
    if( i>=-2147483647 && i<=2147483647 ) return 3;
    return 4;
  }
  if( flags&MEM_Real ){
    return 5;
  }
  if( flags&MEM_Str ){





    return (pMem->n*2 + 13);
  }
  if( flags&MEM_Blob ){
    return (pMem->n*2 + 12);
  }
  return 0;
}

................................................................................
    memcpy(&pMem->r, buf, 8);
    pMem->flags = MEM_Real;
    return 8;
  }
  
  /* String or blob */
  assert( serial_type>=12 );

  if( serial_type&0x01 ){
    pMem->flags = MEM_Str;

  }else{
    pMem->flags = MEM_Blob;

  }
  len = sqlite3VdbeSerialTypeLen(serial_type);

  pMem->n = len;
  if( len>NBFS ){
    pMem->z = sqliteMallocRaw( len );
    if( !pMem->z ){
      return -1;
    }
    pMem->flags |= MEM_Dyn;
  }else{
    pMem->z = pMem->zShort;
    pMem->flags |= MEM_Short;
  }

  memcpy(pMem->z, buf, len); 




  return len;
}

/*
** Compare the values contained by the two memory cells, returning
** negative, zero or positive if pMem1 is less than, equal to, or greater
................................................................................
  }
  if( offset2<nKey2 ){
    return -1;
  }

  return 0;
}

























/*
** pCur points at an index entry. Read the rowid (varint occuring at
** the end of the entry and store it in *rowid. Return SQLITE_OK if
** everything works, or an error code otherwise.
*/
int sqlite3VdbeIdxRowid(BtCursor *pCur, i64 *rowid){







>
>
>
>
>
|







 







>


>


>

<
>
|
<
|








>

>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
....
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301

1302
1303

1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
....
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
    if( i>=-2147483647 && i<=2147483647 ) return 3;
    return 4;
  }
  if( flags&MEM_Real ){
    return 5;
  }
  if( flags&MEM_Str ){
    /* We assume that the string is NULL-terminated. We don't store the
    ** NULL-terminator - it is implied by the string storage class.
    */
    assert( pMem->n>0 );
    assert( pMem->z[pMem->n-1]=='\0' );
    return (pMem->n*2 + 11); /* (pMem->n-1)*2 + 13 */
  }
  if( flags&MEM_Blob ){
    return (pMem->n*2 + 12);
  }
  return 0;
}

................................................................................
    memcpy(&pMem->r, buf, 8);
    pMem->flags = MEM_Real;
    return 8;
  }
  
  /* String or blob */
  assert( serial_type>=12 );
  len = sqlite3VdbeSerialTypeLen(serial_type);
  if( serial_type&0x01 ){
    pMem->flags = MEM_Str;
    pMem->n = len+1;
  }else{
    pMem->flags = MEM_Blob;
    pMem->n = len;
  }


  if( (pMem->n)>NBFS ){

    pMem->z = sqliteMallocRaw( pMem->n );
    if( !pMem->z ){
      return -1;
    }
    pMem->flags |= MEM_Dyn;
  }else{
    pMem->z = pMem->zShort;
    pMem->flags |= MEM_Short;
  }

  memcpy(pMem->z, buf, len); 
  if( pMem->flags&MEM_Str ){
    pMem->z[len] = '\0';
  }

  return len;
}

/*
** Compare the values contained by the two memory cells, returning
** negative, zero or positive if pMem1 is less than, equal to, or greater
................................................................................
  }
  if( offset2<nKey2 ){
    return -1;
  }

  return 0;
}

/*
** This function compares the two table row records specified by 
** {nKey1, pKey1} and {nKey2, pKey2}, returning a negative, zero
** or positive integer if {nKey1, pKey1} is less than, equal to or 
** greater than {nKey2, pKey2}.
**
** This function is pretty inefficient and will probably be replace
** by something else in the near future. It is currently required
** by compound SELECT operators. 
*/
int sqlite3VdbeRowCompare(
  void *userData,
  int nKey1, const void *pKey1, 
  int nKey2, const void *pKey2
){
  int offset1 = 0;
  int offset2 = 0;
  const unsigned char *aKey1 = (const unsigned char *)pKey1;
  const unsigned char *aKey2 = (const unsigned char *)pKey2;

  assert( userData==0 );
}
  

/*
** pCur points at an index entry. Read the rowid (varint occuring at
** the end of the entry and store it in *rowid. Return SQLITE_OK if
** everything works, or an error code otherwise.
*/
int sqlite3VdbeIdxRowid(BtCursor *pCur, i64 *rowid){