{"id":18143204,"url":"https://github.com/0xf6da/sqlite.ahk","last_synced_at":"2025-04-06T19:28:03.711Z","repository":{"id":259670631,"uuid":"879149678","full_name":"0xf6da/sqlite.ahk","owner":"0xf6da","description":"AHKv2: better-sqlite3 with only db.prepare() and stmt.all(); supports named parameters","archived":false,"fork":false,"pushed_at":"2024-10-27T05:53:26.000Z","size":1295,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-13T01:36:05.703Z","etag":null,"topics":["autohotkey","autohotkey-v2","better-sqlite3","sqlite"],"latest_commit_sha":null,"homepage":"","language":"AutoHotkey","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/0xf6da.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-10-27T05:51:52.000Z","updated_at":"2024-10-27T06:24:49.000Z","dependencies_parsed_at":"2024-10-27T08:29:50.306Z","dependency_job_id":"403ae2c0-2886-4b76-be69-0b98494dfc58","html_url":"https://github.com/0xf6da/sqlite.ahk","commit_stats":null,"previous_names":["0xf6da/sqlite.ahk"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xf6da%2Fsqlite.ahk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xf6da%2Fsqlite.ahk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xf6da%2Fsqlite.ahk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xf6da%2Fsqlite.ahk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0xf6da","download_url":"https://codeload.github.com/0xf6da/sqlite.ahk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247538096,"owners_count":20955065,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["autohotkey","autohotkey-v2","better-sqlite3","sqlite"],"created_at":"2024-11-01T19:06:04.532Z","updated_at":"2025-04-06T19:28:03.674Z","avatar_url":"https://github.com/0xf6da.png","language":"AutoHotkey","funding_links":[],"categories":[],"sub_categories":[],"readme":"sqlite but with only prepared statements\n\n```ahk\n#Include %A_LineFile%/../sqlite.ahk\n\ndb:=sqlite(\":memory:\", A_LineFile \"\\..\\sqlite3.dll\") ;path to sqlite3.dll is needed\n; \":memory:\" is temporary, use a filename for persistent storage\n\n; normal usage:\n; db:=sqlite(\"db.sqlite\", A_LineFile \"\\..\\sqlite3.dll\")\n\ndb.prepare(\"\n(\nCREATE TABLE debts (\n   DebtName TEXT,\n   Amount TEXT,\n   CreatedDate TEXT\n`)\n)\").all() ;create table using prepared statement\n\nview_db() {\n    static select_statement := db.prepare(\"select DebtName,Amount,CreatedDate from debts\")\n\n    rows:=select_statement.all() ;Array\n    for row in rows {\n        OutputDebug row.DebtName \": \" row.Amount \"`n\"\n\n        ; works too:\n        ; OutputDebug row[\"DebtName\"] \": \" row[\"Amount\"] \"`n\"\n\n        ; works too: (useful for when you don't know the name of the column)\n        ; OutputDebug row[1] \": \" row[2] \"`n\"\n\n        ; for k,v in row { ; Enumerator gives you column names (and values)\n        ;     OutputDebug k \": \" v \"`n\"\n        ; }\n    }\n}\n\n;Array mode: indexed params (\"?\" , \"?NNN\")\ndb.prepare(\"insert into debts (DebtName,Amount,CreatedDate) VALUES (?,?,?)\").all(\"Medical Bill\",2000,\"2024-08-25\")\ndb.prepare(\"update debts set Amount=? where DebtName=?\").all(1500,\"Medical Bill\")\nview_db()\n\n;Object mode: named params (\":AAA\", \"@AAA\", \"$AAA\")\ndb.prepare(\"update debts set Amount=$Amount where DebtName=$DebtName\").all({Amount:1000,DebtName:\"Medical Bill\"}) ;using {} Object\nview_db()\n\n;Object mode: named params (\":AAA\", \"@AAA\", \"$AAA\")\ndb.prepare(\"update debts set Amount=:Amount where DebtName=:DebtName\").all(Map(\"Amount\",500,\"DebtName\",\"Medical Bill\")) ;using Map() works too\nview_db()\n```\n\n.loadExtension() is not supported but will be added on request, and more\n\nbetter error messages is being worked on, any recommendation/error report is appreciated","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xf6da%2Fsqlite.ahk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0xf6da%2Fsqlite.ahk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xf6da%2Fsqlite.ahk/lists"}