Skip to content

Commit

Permalink
added new result codes
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaWise committed Oct 29, 2024
1 parent 9fc53fe commit b34c9f5
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 28 deletions.
30 changes: 25 additions & 5 deletions src/better_sqlite3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ CS::CS (v8::Isolate * isolate)
SetCode(isolate, SQLITE_WARNING, "SQLITE_WARNING");
SetCode(isolate, SQLITE_ROW, "SQLITE_ROW");
SetCode(isolate, SQLITE_DONE, "SQLITE_DONE");

SetCode(isolate, SQLITE_ERROR_MISSING_COLLSEQ, "SQLITE_ERROR_MISSING_COLLSEQ");
SetCode(isolate, SQLITE_ERROR_RETRY, "SQLITE_ERROR_RETRY");
SetCode(isolate, SQLITE_ERROR_SNAPSHOT, "SQLITE_ERROR_SNAPSHOT");
SetCode(isolate, SQLITE_IOERR_READ, "SQLITE_IOERR_READ");
SetCode(isolate, SQLITE_IOERR_SHORT_READ, "SQLITE_IOERR_SHORT_READ");
SetCode(isolate, SQLITE_IOERR_WRITE, "SQLITE_IOERR_WRITE");
Expand Down Expand Up @@ -237,18 +241,31 @@ CS::CS (v8::Isolate * isolate)
SetCode(isolate, SQLITE_IOERR_CONVPATH, "SQLITE_IOERR_CONVPATH");
SetCode(isolate, SQLITE_IOERR_VNODE, "SQLITE_IOERR_VNODE");
SetCode(isolate, SQLITE_IOERR_AUTH, "SQLITE_IOERR_AUTH");
SetCode(isolate, SQLITE_IOERR_BEGIN_ATOMIC, "SQLITE_IOERR_BEGIN_ATOMIC");
SetCode(isolate, SQLITE_IOERR_COMMIT_ATOMIC, "SQLITE_IOERR_COMMIT_ATOMIC");
SetCode(isolate, SQLITE_IOERR_ROLLBACK_ATOMIC, "SQLITE_IOERR_ROLLBACK_ATOMIC");
SetCode(isolate, SQLITE_IOERR_DATA, "SQLITE_IOERR_DATA");
SetCode(isolate, SQLITE_IOERR_CORRUPTFS, "SQLITE_IOERR_CORRUPTFS");
SetCode(isolate, SQLITE_IOERR_IN_PAGE, "SQLITE_IOERR_IN_PAGE");
SetCode(isolate, SQLITE_LOCKED_SHAREDCACHE, "SQLITE_LOCKED_SHAREDCACHE");
SetCode(isolate, SQLITE_LOCKED_VTAB, "SQLITE_LOCKED_VTAB");
SetCode(isolate, SQLITE_BUSY_RECOVERY, "SQLITE_BUSY_RECOVERY");
SetCode(isolate, SQLITE_BUSY_SNAPSHOT, "SQLITE_BUSY_SNAPSHOT");
SetCode(isolate, SQLITE_CANTOPEN_NOTEMPDIR, "SQLITE_CANTOPEN_NOTEMPDIR");
SetCode(isolate, SQLITE_CANTOPEN_ISDIR, "SQLITE_CANTOPEN_ISDIR");
SetCode(isolate, SQLITE_CANTOPEN_FULLPATH, "SQLITE_CANTOPEN_FULLPATH");
SetCode(isolate, SQLITE_CANTOPEN_CONVPATH, "SQLITE_CANTOPEN_CONVPATH");
SetCode(isolate, SQLITE_CANTOPEN_DIRTYWAL, "SQLITE_CANTOPEN_DIRTYWAL");
SetCode(isolate, SQLITE_CANTOPEN_SYMLINK, "SQLITE_CANTOPEN_SYMLINK");
SetCode(isolate, SQLITE_CORRUPT_VTAB, "SQLITE_CORRUPT_VTAB");
SetCode(isolate, SQLITE_CORRUPT_SEQUENCE, "SQLITE_CORRUPT_SEQUENCE");
SetCode(isolate, SQLITE_CORRUPT_INDEX, "SQLITE_CORRUPT_INDEX");
SetCode(isolate, SQLITE_READONLY_RECOVERY, "SQLITE_READONLY_RECOVERY");
SetCode(isolate, SQLITE_READONLY_CANTLOCK, "SQLITE_READONLY_CANTLOCK");
SetCode(isolate, SQLITE_READONLY_ROLLBACK, "SQLITE_READONLY_ROLLBACK");
SetCode(isolate, SQLITE_READONLY_DBMOVED, "SQLITE_READONLY_DBMOVED");
SetCode(isolate, SQLITE_READONLY_CANTINIT, "SQLITE_READONLY_CANTINIT");
SetCode(isolate, SQLITE_READONLY_DIRECTORY, "SQLITE_READONLY_DIRECTORY");
SetCode(isolate, SQLITE_ABORT_ROLLBACK, "SQLITE_ABORT_ROLLBACK");
SetCode(isolate, SQLITE_CONSTRAINT_CHECK, "SQLITE_CONSTRAINT_CHECK");
SetCode(isolate, SQLITE_CONSTRAINT_COMMITHOOK, "SQLITE_CONSTRAINT_COMMITHOOK");
Expand All @@ -260,22 +277,25 @@ CS::CS (v8::Isolate * isolate)
SetCode(isolate, SQLITE_CONSTRAINT_UNIQUE, "SQLITE_CONSTRAINT_UNIQUE");
SetCode(isolate, SQLITE_CONSTRAINT_VTAB, "SQLITE_CONSTRAINT_VTAB");
SetCode(isolate, SQLITE_CONSTRAINT_ROWID, "SQLITE_CONSTRAINT_ROWID");
SetCode(isolate, SQLITE_CONSTRAINT_PINNED, "SQLITE_CONSTRAINT_PINNED");
SetCode(isolate, SQLITE_CONSTRAINT_DATATYPE, "SQLITE_CONSTRAINT_DATATYPE");
SetCode(isolate, SQLITE_NOTICE_RECOVER_WAL, "SQLITE_NOTICE_RECOVER_WAL");
SetCode(isolate, SQLITE_NOTICE_RECOVER_ROLLBACK, "SQLITE_NOTICE_RECOVER_ROLLBACK");
SetCode(isolate, SQLITE_NOTICE_RBU, "SQLITE_NOTICE_RBU");
SetCode(isolate, SQLITE_WARNING_AUTOINDEX, "SQLITE_WARNING_AUTOINDEX");
SetCode(isolate, SQLITE_AUTH_USER, "SQLITE_AUTH_USER");
SetCode(isolate, SQLITE_OK_LOAD_PERMANENTLY, "SQLITE_OK_LOAD_PERMANENTLY");
SetCode(isolate, SQLITE_ERROR_MISSING_COLLSEQ, "SQLITE_ERROR_MISSING_COLLSEQ");
SetCode(isolate, SQLITE_OK_SYMLINK, "SQLITE_OK_SYMLINK");
}
#line 141 "./src/util/constants.lzz"
#line 161 "./src/util/constants.lzz"
void CS::SetString (v8::Isolate * isolate, v8::Global <v8::String> & constant, char const * str)
#line 141 "./src/util/constants.lzz"
#line 161 "./src/util/constants.lzz"
{
constant.Reset(isolate, InternalizedFromLatin1(isolate, str));
}
#line 145 "./src/util/constants.lzz"
#line 165 "./src/util/constants.lzz"
void CS::SetCode (v8::Isolate * isolate, int code, char const * str)
#line 145 "./src/util/constants.lzz"
#line 165 "./src/util/constants.lzz"
{
codes.emplace(std::piecewise_construct,
std::forward_as_tuple(code),
Expand Down
44 changes: 22 additions & 22 deletions src/better_sqlite3.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,49 +68,49 @@ class CS
v8::Local <v8::String> Code (v8::Isolate * isolate, int code);
#line 10 "./src/util/constants.lzz"
explicit CS (v8::Isolate * isolate);
#line 120 "./src/util/constants.lzz"
#line 140 "./src/util/constants.lzz"
v8::Global <v8::String> database;
#line 121 "./src/util/constants.lzz"
#line 141 "./src/util/constants.lzz"
v8::Global <v8::String> reader;
#line 122 "./src/util/constants.lzz"
#line 142 "./src/util/constants.lzz"
v8::Global <v8::String> source;
#line 123 "./src/util/constants.lzz"
#line 143 "./src/util/constants.lzz"
v8::Global <v8::String> memory;
#line 124 "./src/util/constants.lzz"
#line 144 "./src/util/constants.lzz"
v8::Global <v8::String> readonly;
#line 125 "./src/util/constants.lzz"
#line 145 "./src/util/constants.lzz"
v8::Global <v8::String> name;
#line 126 "./src/util/constants.lzz"
#line 146 "./src/util/constants.lzz"
v8::Global <v8::String> next;
#line 127 "./src/util/constants.lzz"
#line 147 "./src/util/constants.lzz"
v8::Global <v8::String> length;
#line 128 "./src/util/constants.lzz"
#line 148 "./src/util/constants.lzz"
v8::Global <v8::String> done;
#line 129 "./src/util/constants.lzz"
#line 149 "./src/util/constants.lzz"
v8::Global <v8::String> value;
#line 130 "./src/util/constants.lzz"
#line 150 "./src/util/constants.lzz"
v8::Global <v8::String> changes;
#line 131 "./src/util/constants.lzz"
#line 151 "./src/util/constants.lzz"
v8::Global <v8::String> lastInsertRowid;
#line 132 "./src/util/constants.lzz"
#line 152 "./src/util/constants.lzz"
v8::Global <v8::String> statement;
#line 133 "./src/util/constants.lzz"
#line 153 "./src/util/constants.lzz"
v8::Global <v8::String> column;
#line 134 "./src/util/constants.lzz"
#line 154 "./src/util/constants.lzz"
v8::Global <v8::String> table;
#line 135 "./src/util/constants.lzz"
#line 155 "./src/util/constants.lzz"
v8::Global <v8::String> type;
#line 136 "./src/util/constants.lzz"
#line 156 "./src/util/constants.lzz"
v8::Global <v8::String> totalPages;
#line 137 "./src/util/constants.lzz"
#line 157 "./src/util/constants.lzz"
v8::Global <v8::String> remainingPages;
#line 139 "./src/util/constants.lzz"
#line 159 "./src/util/constants.lzz"
private:
#line 141 "./src/util/constants.lzz"
#line 161 "./src/util/constants.lzz"
static void SetString (v8::Isolate * isolate, v8::Global <v8::String> & constant, char const * str);
#line 145 "./src/util/constants.lzz"
#line 165 "./src/util/constants.lzz"
void SetCode (v8::Isolate * isolate, int code, char const * str);
#line 151 "./src/util/constants.lzz"
#line 171 "./src/util/constants.lzz"
std::unordered_map <int, v8::Global<v8::String> > codes;
};
#line 1 "./src/util/bind-map.lzz"
Expand Down
22 changes: 21 additions & 1 deletion src/util/constants.lzz
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ public:
SetCode(isolate, SQLITE_WARNING, "SQLITE_WARNING");
SetCode(isolate, SQLITE_ROW, "SQLITE_ROW");
SetCode(isolate, SQLITE_DONE, "SQLITE_DONE");

SetCode(isolate, SQLITE_ERROR_MISSING_COLLSEQ, "SQLITE_ERROR_MISSING_COLLSEQ");
SetCode(isolate, SQLITE_ERROR_RETRY, "SQLITE_ERROR_RETRY");
SetCode(isolate, SQLITE_ERROR_SNAPSHOT, "SQLITE_ERROR_SNAPSHOT");
SetCode(isolate, SQLITE_IOERR_READ, "SQLITE_IOERR_READ");
SetCode(isolate, SQLITE_IOERR_SHORT_READ, "SQLITE_IOERR_SHORT_READ");
SetCode(isolate, SQLITE_IOERR_WRITE, "SQLITE_IOERR_WRITE");
Expand Down Expand Up @@ -86,18 +90,31 @@ public:
SetCode(isolate, SQLITE_IOERR_CONVPATH, "SQLITE_IOERR_CONVPATH");
SetCode(isolate, SQLITE_IOERR_VNODE, "SQLITE_IOERR_VNODE");
SetCode(isolate, SQLITE_IOERR_AUTH, "SQLITE_IOERR_AUTH");
SetCode(isolate, SQLITE_IOERR_BEGIN_ATOMIC, "SQLITE_IOERR_BEGIN_ATOMIC");
SetCode(isolate, SQLITE_IOERR_COMMIT_ATOMIC, "SQLITE_IOERR_COMMIT_ATOMIC");
SetCode(isolate, SQLITE_IOERR_ROLLBACK_ATOMIC, "SQLITE_IOERR_ROLLBACK_ATOMIC");
SetCode(isolate, SQLITE_IOERR_DATA, "SQLITE_IOERR_DATA");
SetCode(isolate, SQLITE_IOERR_CORRUPTFS, "SQLITE_IOERR_CORRUPTFS");
SetCode(isolate, SQLITE_IOERR_IN_PAGE, "SQLITE_IOERR_IN_PAGE");
SetCode(isolate, SQLITE_LOCKED_SHAREDCACHE, "SQLITE_LOCKED_SHAREDCACHE");
SetCode(isolate, SQLITE_LOCKED_VTAB, "SQLITE_LOCKED_VTAB");
SetCode(isolate, SQLITE_BUSY_RECOVERY, "SQLITE_BUSY_RECOVERY");
SetCode(isolate, SQLITE_BUSY_SNAPSHOT, "SQLITE_BUSY_SNAPSHOT");
SetCode(isolate, SQLITE_CANTOPEN_NOTEMPDIR, "SQLITE_CANTOPEN_NOTEMPDIR");
SetCode(isolate, SQLITE_CANTOPEN_ISDIR, "SQLITE_CANTOPEN_ISDIR");
SetCode(isolate, SQLITE_CANTOPEN_FULLPATH, "SQLITE_CANTOPEN_FULLPATH");
SetCode(isolate, SQLITE_CANTOPEN_CONVPATH, "SQLITE_CANTOPEN_CONVPATH");
SetCode(isolate, SQLITE_CANTOPEN_DIRTYWAL, "SQLITE_CANTOPEN_DIRTYWAL");
SetCode(isolate, SQLITE_CANTOPEN_SYMLINK, "SQLITE_CANTOPEN_SYMLINK");
SetCode(isolate, SQLITE_CORRUPT_VTAB, "SQLITE_CORRUPT_VTAB");
SetCode(isolate, SQLITE_CORRUPT_SEQUENCE, "SQLITE_CORRUPT_SEQUENCE");
SetCode(isolate, SQLITE_CORRUPT_INDEX, "SQLITE_CORRUPT_INDEX");
SetCode(isolate, SQLITE_READONLY_RECOVERY, "SQLITE_READONLY_RECOVERY");
SetCode(isolate, SQLITE_READONLY_CANTLOCK, "SQLITE_READONLY_CANTLOCK");
SetCode(isolate, SQLITE_READONLY_ROLLBACK, "SQLITE_READONLY_ROLLBACK");
SetCode(isolate, SQLITE_READONLY_DBMOVED, "SQLITE_READONLY_DBMOVED");
SetCode(isolate, SQLITE_READONLY_CANTINIT, "SQLITE_READONLY_CANTINIT");
SetCode(isolate, SQLITE_READONLY_DIRECTORY, "SQLITE_READONLY_DIRECTORY");
SetCode(isolate, SQLITE_ABORT_ROLLBACK, "SQLITE_ABORT_ROLLBACK");
SetCode(isolate, SQLITE_CONSTRAINT_CHECK, "SQLITE_CONSTRAINT_CHECK");
SetCode(isolate, SQLITE_CONSTRAINT_COMMITHOOK, "SQLITE_CONSTRAINT_COMMITHOOK");
Expand All @@ -109,12 +126,15 @@ public:
SetCode(isolate, SQLITE_CONSTRAINT_UNIQUE, "SQLITE_CONSTRAINT_UNIQUE");
SetCode(isolate, SQLITE_CONSTRAINT_VTAB, "SQLITE_CONSTRAINT_VTAB");
SetCode(isolate, SQLITE_CONSTRAINT_ROWID, "SQLITE_CONSTRAINT_ROWID");
SetCode(isolate, SQLITE_CONSTRAINT_PINNED, "SQLITE_CONSTRAINT_PINNED");
SetCode(isolate, SQLITE_CONSTRAINT_DATATYPE, "SQLITE_CONSTRAINT_DATATYPE");
SetCode(isolate, SQLITE_NOTICE_RECOVER_WAL, "SQLITE_NOTICE_RECOVER_WAL");
SetCode(isolate, SQLITE_NOTICE_RECOVER_ROLLBACK, "SQLITE_NOTICE_RECOVER_ROLLBACK");
SetCode(isolate, SQLITE_NOTICE_RBU, "SQLITE_NOTICE_RBU");
SetCode(isolate, SQLITE_WARNING_AUTOINDEX, "SQLITE_WARNING_AUTOINDEX");
SetCode(isolate, SQLITE_AUTH_USER, "SQLITE_AUTH_USER");
SetCode(isolate, SQLITE_OK_LOAD_PERMANENTLY, "SQLITE_OK_LOAD_PERMANENTLY");
SetCode(isolate, SQLITE_ERROR_MISSING_COLLSEQ, "SQLITE_ERROR_MISSING_COLLSEQ");
SetCode(isolate, SQLITE_OK_SYMLINK, "SQLITE_OK_SYMLINK");
}

v8::Global<v8::String> database;
Expand Down

0 comments on commit b34c9f5

Please sign in to comment.