Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Handle BLOBs specially, treating them as binary, in the tointeger() and toreal() SQL functions. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | toTypeFuncs |
Files: | files | file ages | folders |
SHA1: |
c4c53acb985a248c89db2d75025d941e |
User & Date: | mistachkin 2013-08-31 21:41:09.620 |
Context
2013-09-01
| ||
23:36 | Merge updates from trunk. (check-in: 2982725e12 user: mistachkin tags: toTypeFuncs) | |
2013-08-31
| ||
21:41 | Handle BLOBs specially, treating them as binary, in the tointeger() and toreal() SQL functions. (check-in: c4c53acb98 user: mistachkin tags: toTypeFuncs) | |
2013-08-29
| ||
02:27 | Disable several toreal() tests that require high floating point precision when it is unavailable. (check-in: b724219b00 user: mistachkin tags: toTypeFuncs) | |
Changes
Changes to src/func.c.
︙ | ︙ | |||
986 987 988 989 990 991 992 | } break; } case SQLITE_INTEGER: { sqlite3_result_int64(context, sqlite3_value_int64(argv[0])); break; } | | > > > > > > > > > > > | 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 | } break; } case SQLITE_INTEGER: { sqlite3_result_int64(context, sqlite3_value_int64(argv[0])); break; } case SQLITE_BLOB: { const unsigned char *zBlob = sqlite3_value_blob(argv[0]); if( zBlob ){ int nBlob = sqlite3_value_bytes(argv[0]); if( nBlob==sizeof(i64) ){ i64 iVal; memcpy(&iVal, zBlob, sizeof(i64)); sqlite3_result_int64(context, iVal); } } break; } case SQLITE_TEXT: { const unsigned char *zStr = sqlite3_value_text(argv[0]); if( zStr ){ int nStr = sqlite3_value_bytes(argv[0]); if( nStr && !sqlite3Isspace(zStr[0]) ){ i64 iVal; if( !sqlite3Atoi64((const char*)zStr, &iVal, nStr, SQLITE_UTF8) ){ |
︙ | ︙ | |||
1034 1035 1036 1037 1038 1039 1040 | i64 iVal = sqlite3_value_int64(argv[0]); double rVal = (double)iVal; if( iVal==(i64)rVal ){ sqlite3_result_double(context, rVal); } break; } | | > > > > > > > > > > > | 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 | i64 iVal = sqlite3_value_int64(argv[0]); double rVal = (double)iVal; if( iVal==(i64)rVal ){ sqlite3_result_double(context, rVal); } break; } case SQLITE_BLOB: { const unsigned char *zBlob = sqlite3_value_blob(argv[0]); if( zBlob ){ int nBlob = sqlite3_value_bytes(argv[0]); if( nBlob==sizeof(double) ){ double rVal; memcpy(&rVal, zBlob, sizeof(double)); sqlite3_result_double(context, rVal); } } break; } case SQLITE_TEXT: { const unsigned char *zStr = sqlite3_value_text(argv[0]); if( zStr ){ int nStr = sqlite3_value_bytes(argv[0]); if( nStr && !sqlite3Isspace(zStr[0]) && !sqlite3Isspace(zStr[nStr-1]) ){ double rVal; if( sqlite3AtoF((const char*)zStr, &rVal, nStr, SQLITE_UTF8) ){ |
︙ | ︙ |