Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Change the way that the random() SQL function prevents the maximum negative integer so that it is testable. (CVS 6436) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
995f2b9b1031fadc85e179701536b9dd |
User & Date: | drh 2009-04-02 14:05:22.000 |
Context
2009-04-02
| ||
16:59 | Disable the query flattening optimization when the subquery is a compound query with an ORDER BY clause. Ticket #3773 shows why that combination does not work. (CVS 6437) (check-in: 23f90d5073 user: drh tags: trunk) | |
14:05 | Change the way that the random() SQL function prevents the maximum negative integer so that it is testable. (CVS 6436) (check-in: 995f2b9b10 user: drh tags: trunk) | |
13:36 | Use ALWAYS and NEVER macros on unchangeable conditions within func.c. (CVS 6435) (check-in: eb65e64e7e user: drh tags: trunk) | |
Changes
Changes to src/func.c.
︙ | ︙ | |||
12 13 14 15 16 17 18 | ** This file contains the C functions that implement various SQL ** functions of SQLite. ** ** There is only one exported symbol in this file - the function ** sqliteRegisterBuildinFunctions() found at the bottom of the file. ** All other code has file scope. ** | | | 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | ** This file contains the C functions that implement various SQL ** functions of SQLite. ** ** There is only one exported symbol in this file - the function ** sqliteRegisterBuildinFunctions() found at the bottom of the file. ** All other code has file scope. ** ** $Id: func.c,v 1.230 2009/04/02 14:05:22 drh Exp $ */ #include "sqliteInt.h" #include <stdlib.h> #include <assert.h> #include "vdbeInt.h" /* |
︙ | ︙ | |||
358 359 360 361 362 363 364 | sqlite3_context *context, int NotUsed, sqlite3_value **NotUsed2 ){ sqlite_int64 r; UNUSED_PARAMETER2(NotUsed, NotUsed2); sqlite3_randomness(sizeof(r), &r); | > | | > > > > > > > > | 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 | sqlite3_context *context, int NotUsed, sqlite3_value **NotUsed2 ){ sqlite_int64 r; UNUSED_PARAMETER2(NotUsed, NotUsed2); sqlite3_randomness(sizeof(r), &r); if( r<0 ){ /* We need to prevent a random number of 0x8000000000000000 ** (or -9223372036854775808) since when you do abs() of that ** number of you get the same value back again. To do this ** in a way that is testable, mask the sign bit off of negative ** values, resulting in a positive value. Then take the ** 2s complement of that positive value. The end result can ** therefore be no less than -9223372036854775807. */ r = -(r ^ (((sqlite3_int64)1)<<63)); } sqlite3_result_int64(context, r); } /* ** Implementation of randomblob(N). Return a random blob ** that is N bytes long. */ |
︙ | ︙ |