Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Improved detection and reporting of errors in the readfile() extension SQL function. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
d2f0b5a483869d39f5c5814c9d6df3d3 |
User & Date: | drh 2019-01-11 17:20:25.808 |
Context
2019-01-11
| ||
17:41 | Fix a problem handling a negative value in the "number-of-pages" database header field. Also a problem with running "REINDEX tbl" against a virtual table for which the SQL passed to sqlite3_declare_vtab() contains PRIMARY KEY or UNIQUE constraints. (check-in: 556dd8922f user: dan tags: trunk) | |
17:20 | Improved detection and reporting of errors in the readfile() extension SQL function. (check-in: d2f0b5a483 user: drh tags: trunk) | |
17:19 | Omit errors about missing SAVEPOINTs when aborting the .archive command in the CLI. (check-in: 2a47387ba6 user: drh tags: trunk) | |
Changes
Changes to ext/misc/fileio.c.
︙ | ︙ | |||
117 118 119 120 121 122 123 | #define FSDIR_COLUMN_DATA 3 /* File content */ #define FSDIR_COLUMN_PATH 4 /* Path to top of search */ #define FSDIR_COLUMN_DIR 5 /* Path is relative to this directory */ /* ** Set the result stored by context ctx to a blob containing the | | > > > > > > > | > > | > > > > > > > > > > > > > > > | > | 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 | #define FSDIR_COLUMN_DATA 3 /* File content */ #define FSDIR_COLUMN_PATH 4 /* Path to top of search */ #define FSDIR_COLUMN_DIR 5 /* Path is relative to this directory */ /* ** Set the result stored by context ctx to a blob containing the ** contents of file zName. Or, leave the result unchanged (NULL) ** if the file does not exist or is unreadable. ** ** If the file exceeds the SQLite blob size limit, through an ** SQLITE_TOOBIG error. ** ** Throw an SQLITE_IOERR if there are difficulties pulling the file ** off of disk. */ static void readFileContents(sqlite3_context *ctx, const char *zName){ FILE *in; sqlite3_int64 nIn; void *pBuf; sqlite3 *db; int mxBlob; in = fopen(zName, "rb"); if( in==0 ){ /* File does not exist or is unreadable. Leave the result set to NULL. */ return; } fseek(in, 0, SEEK_END); nIn = ftell(in); rewind(in); db = sqlite3_context_db_handle(ctx); mxBlob = sqlite3_limit(db, SQLITE_LIMIT_LENGTH, -1); if( nIn>mxBlob ){ sqlite3_result_error_code(ctx, SQLITE_TOOBIG); fclose(in); return; } pBuf = sqlite3_malloc( nIn ); if( pBuf==0 ){ sqlite3_result_error_nomem(ctx); fclose(in); return; } if( 1==fread(pBuf, nIn, 1, in) ){ sqlite3_result_blob(ctx, pBuf, nIn, sqlite3_free); }else{ sqlite3_result_error_code(ctx, SQLITE_IOERR); sqlite3_free(pBuf); } fclose(in); } /* ** Implementation of the "readfile(X)" SQL function. The entire content |
︙ | ︙ |