-
Notifications
You must be signed in to change notification settings - Fork 10
sqlite3/3.49.1 #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| package main | ||
|
|
||
| import ( | ||
| "github.com/goplus/llpkg/sqlite3" | ||
|
|
||
| "github.com/goplus/llgo/c" | ||
| "github.com/goplus/llgo/c/os" | ||
| ) | ||
|
|
||
| func main() { | ||
| os.Remove(c.Str("test.db")) | ||
|
|
||
| var db *sqlite3.Sqlite3 | ||
| err := sqlite3.DoOpen(c.Str("test.db"), &db) | ||
| check(err, db, "sqlite: Open") | ||
|
|
||
| err = db.Exec(c.Str("CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT)"), nil, nil, nil) | ||
| check(err, db, "sqlite: Exec CREATE TABLE") | ||
|
|
||
| var stmt *sqlite3.Stmt | ||
| sql := "INSERT INTO users (id, name) VALUES (?, ?)" | ||
| err = db.DoPrepareV3(c.GoStringData(sql), c.Int(len(sql)), 0, &stmt, nil) | ||
| check(err, db, "sqlite: PrepareV3 INSERT") | ||
|
|
||
| stmt.BindInt(1, 100) | ||
| stmt.BindText(2, c.Str("Hello World"), -1, nil) | ||
|
|
||
| err = stmt.Step() | ||
| checkDone(err, db, "sqlite: Step INSERT 1") | ||
|
|
||
| stmt.Reset() | ||
| stmt.BindInt(1, 200) | ||
| stmt.BindText(2, c.Str("This is llgo"), -1, nil) | ||
|
|
||
| err = stmt.Step() | ||
| checkDone(err, db, "sqlite: Step INSERT 2") | ||
|
|
||
| stmt.Close() | ||
|
|
||
| sql = "SELECT * FROM users" | ||
| err = db.DoPrepareV3(c.GoStringData(sql), c.Int(len(sql)), 0, &stmt, nil) | ||
| check(err, db, "sqlite: PrepareV3 SELECT") | ||
|
|
||
| for { | ||
| if err = stmt.Step(); err != sqlite3.ROW { | ||
| break | ||
| } | ||
| c.Printf(c.Str("==> id=%d, name=%s\n"), stmt.ColumnInt(0), stmt.ColumnText(1)) | ||
| } | ||
| checkDone(err, db, "sqlite: Step done") | ||
|
|
||
| stmt.Close() | ||
| db.Close() | ||
| } | ||
|
|
||
| func check(err c.Int, db *sqlite3.Sqlite3, at string) { | ||
| if err != sqlite3.OK { | ||
| c.Printf(c.Str("==> %s Error: (%d) %s\n"), c.AllocaCStr(at), err, db.Errmsg()) | ||
| c.Exit(1) | ||
| } | ||
| } | ||
|
|
||
| func checkDone(err c.Int, db *sqlite3.Sqlite3, at string) { | ||
| if err != sqlite3.DONE { | ||
| check(err, db, at) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| module github.com/goplus/llpkg/sqlite3 | ||
|
|
||
| go 1.20 | ||
|
|
||
| require github.com/goplus/llgo v0.10.0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| github.com/goplus/llgo v0.10.0 h1:s3U3cnO3cploF1xCCJleAb16NQFAmHxdUmdrNhRH3hY= | ||
| github.com/goplus/llgo v0.10.0/go.mod h1:YfOHsT/g3lc9b4GclLj812YzdSsJr0kd3CCB830TqHE= |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "name": "sqlite3", | ||
| "cflags": "$(pkg-config --cflags sqlite3)", | ||
| "libs": "$(pkg-config --libs sqlite3)", | ||
| "include": [ | ||
| "sqlite3ext.h", | ||
| "sqlite3.h" | ||
| ], | ||
| "trimPrefixes": ["sqlite3_","SQLITE_"], | ||
| "cplusplus": false | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| Fts5Context | ||
| Fts5ExtensionApi | ||
| Fts5PhraseIter | ||
| Fts5Tokenizer | ||
| fts5_api Fts5Api | ||
| fts5_extension_function Fts5ExtensionFunction | ||
| fts5_tokenizer Fts5Tokenizer__1 | ||
| fts5_tokenizer_v2 Fts5TokenizerV2 | ||
| sqlite3 Sqlite3 | ||
| sqlite3_api_routines ApiRoutines | ||
| sqlite3_backup Backup | ||
| sqlite3_blob Blob | ||
| sqlite3_callback Callback | ||
| sqlite3_context Context | ||
| sqlite3_destructor_type DestructorType | ||
| sqlite3_file File | ||
| sqlite3_filename Filename | ||
| sqlite3_index_info IndexInfo | ||
| sqlite3_int64 Int64 | ||
| sqlite3_io_methods IoMethods | ||
| sqlite3_loadext_entry LoadextEntry | ||
| sqlite3_mem_methods MemMethods | ||
| sqlite3_module Module | ||
| sqlite3_mutex Mutex | ||
| sqlite3_mutex_methods MutexMethods | ||
| sqlite3_pcache Pcache | ||
| sqlite3_pcache_methods PcacheMethods | ||
| sqlite3_pcache_methods2 PcacheMethods2 | ||
| sqlite3_pcache_page PcachePage | ||
| sqlite3_rtree_dbl RtreeDbl | ||
| sqlite3_rtree_geometry RtreeGeometry | ||
| sqlite3_rtree_query_info RtreeQueryInfo | ||
| sqlite3_snapshot Snapshot | ||
| sqlite3_stmt Stmt | ||
| sqlite3_str Str | ||
| sqlite3_syscall_ptr SyscallPtr | ||
| sqlite3_uint64 Uint64 | ||
| sqlite3_value Value | ||
| sqlite3_vfs Vfs | ||
| sqlite3_vtab Vtab | ||
| sqlite3_vtab_cursor VtabCursor | ||
| sqlite_int64 SqliteInt64 | ||
| sqlite_uint64 SqliteUint64 | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.