Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Slightly faster implementation of the length() SQL function. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
9a4199aedb039141a50a68943ef863d7 |
User & Date: | drh 2018-01-23 04:22:33.527 |
Context
2018-01-23
| ||
07:11 | Skip defining WIN32_LEAN_AND_MEAN when it is already defined. (check-in: 195f5323df user: mistachkin tags: trunk) | |
04:22 | Slightly faster implementation of the length() SQL function. (check-in: 9a4199aedb user: drh tags: trunk) | |
03:44 | Slightly faster function dispatch in the virtual machine by avoiding unnecessary reinitialization of variables that are already correctly initialized. (check-in: edd4e6876c user: drh tags: trunk) | |
Changes
Changes to src/func.c.
︙ | ︙ | |||
98 99 100 101 102 103 104 | ** Implementation of the length() function */ static void lengthFunc( sqlite3_context *context, int argc, sqlite3_value **argv ){ | < < > > | | | < > > | > | | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | ** Implementation of the length() function */ static void lengthFunc( sqlite3_context *context, int argc, sqlite3_value **argv ){ assert( argc==1 ); UNUSED_PARAMETER(argc); switch( sqlite3_value_type(argv[0]) ){ case SQLITE_BLOB: case SQLITE_INTEGER: case SQLITE_FLOAT: { sqlite3_result_int(context, sqlite3_value_bytes(argv[0])); break; } case SQLITE_TEXT: { const unsigned char *z = sqlite3_value_text(argv[0]); const unsigned char *z0; unsigned char c; if( z==0 ) return; z0 = z; while( (c = *z)!=0 ){ z++; if( c>=0xc0 ){ while( (*z & 0xc0)==0x80 ){ z++; z0++; } } } sqlite3_result_int(context, (int)(z-z0)); break; } default: { sqlite3_result_null(context); break; } } |
︙ | ︙ |