{"id":13483062,"url":"https://github.com/crystal-lang/crystal-sqlite3","last_synced_at":"2025-04-04T16:14:40.785Z","repository":{"id":28590875,"uuid":"32109068","full_name":"crystal-lang/crystal-sqlite3","owner":"crystal-lang","description":"SQLite3 bindings for Crystal","archived":false,"fork":false,"pushed_at":"2024-10-14T11:18:05.000Z","size":141,"stargazers_count":143,"open_issues_count":23,"forks_count":28,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-02T22:42:14.535Z","etag":null,"topics":["crystal","database","driver","sqlite3"],"latest_commit_sha":null,"homepage":"https://crystaldoc.info/github/crystal-lang/crystal-sqlite3","language":"Crystal","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/crystal-lang.png","metadata":{"funding":{"open_collective":"crystal-lang"},"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2015-03-12T23:31:27.000Z","updated_at":"2025-02-04T20:18:15.000Z","dependencies_parsed_at":"2024-11-23T21:01:12.642Z","dependency_job_id":null,"html_url":"https://github.com/crystal-lang/crystal-sqlite3","commit_stats":{"total_commits":105,"total_committers":13,"mean_commits":8.076923076923077,"dds":0.6666666666666667,"last_synced_commit":"c58cea290c85e2a33dc8f494a5f04b519d3e0274"},"previous_names":["manastech/crystal-sqlite3"],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crystal-lang%2Fcrystal-sqlite3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crystal-lang%2Fcrystal-sqlite3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crystal-lang%2Fcrystal-sqlite3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crystal-lang%2Fcrystal-sqlite3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crystal-lang","download_url":"https://codeload.github.com/crystal-lang/crystal-sqlite3/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247208147,"owners_count":20901570,"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":["crystal","database","driver","sqlite3"],"created_at":"2024-07-31T17:01:07.923Z","updated_at":"2025-04-04T16:14:40.766Z","avatar_url":"https://github.com/crystal-lang.png","language":"Crystal","funding_links":["https://opencollective.com/crystal-lang"],"categories":["Database Drivers/Clients"],"sub_categories":[],"readme":"# crystal-sqlite3 [![Build Status](https://travis-ci.org/crystal-lang/crystal-sqlite3.svg?branch=master)](https://travis-ci.org/crystal-lang/crystal-sqlite3)\n\nSQLite3 bindings for [Crystal](http://crystal-lang.org/).\n\nCheck [crystal-db](https://github.com/crystal-lang/crystal-db) for general db driver documentation. crystal-sqlite3 driver is registered under `sqlite3://` uri.\n\n## Installation\n\nAdd this to your application's `shard.yml`:\n\n```yml\ndependencies:\n  sqlite3:\n    github: crystal-lang/crystal-sqlite3\n```\n\n### Usage\n\n```crystal\nrequire \"sqlite3\"\n\nDB.open \"sqlite3://./data.db\" do |db|\n  db.exec \"create table contacts (name text, age integer)\"\n  db.exec \"insert into contacts values (?, ?)\", \"John Doe\", 30\n\n  args = [] of DB::Any\n  args \u003c\u003c \"Sarah\"\n  args \u003c\u003c 33\n  db.exec \"insert into contacts values (?, ?)\", args: args\n\n  puts \"max age:\"\n  puts db.scalar \"select max(age) from contacts\" # =\u003e 33\n\n  puts \"contacts:\"\n  db.query \"select name, age from contacts order by age desc\" do |rs|\n    puts \"#{rs.column_name(0)} (#{rs.column_name(1)})\"\n    # =\u003e name (age)\n    rs.each do\n      puts \"#{rs.read(String)} (#{rs.read(Int32)})\"\n      # =\u003e Sarah (33)\n      # =\u003e John Doe (30)\n    end\n  end\nend\n```\n\n### DB::Any\n\n* `Time` is implemented as `TEXT` column using `SQLite3::DATE_FORMAT_SUBSECOND` format (or `SQLite3::DATE_FORMAT_SECOND` if the text does not contain a dot).\n* `Bool` is implemented as `INT` column mapping `0`/`1` values.\n\n### Setting PRAGMAs\n\nYou can adjust certain [SQLite3 PRAGMAs](https://www.sqlite.org/pragma.html)\nautomatically when the connection is created by using the query parameters:\n\n```crystal\nrequire \"sqlite3\"\n\nDB.open \"sqlite3://./data.db?journal_mode=wal\u0026synchronous=normal\" do |db|\n  # this database now uses WAL journal and normal synchronous mode\n  # (defaults were `delete` and `full`, respectively)\nend\n```\n\nThe following is the list of supported options:\n\n| Name                      | Connection key  |\n|---------------------------|-----------------|\n| [Busy Timeout][pragma-to] | `busy_timeout` |\n| [Cache Size][pragma-cs] | `cache_size` |\n| [Foreign Keys][pragma-fk] | `foreign_keys` |\n| [Journal Mode][pragma-jm] | `journal_mode` |\n| [Synchronous][pragma-sync] | `synchronous` |\n| [WAL autocheckoint][pragma-walck] | `wal_autocheckpoint` |\n\nPlease note there values passed using these connection keys are passed\ndirectly to SQLite3 without check or evaluation. Using incorrect values result\nin no error by the library.\n\n[pragma-to]: https://www.sqlite.org/pragma.html#pragma_busy_timeout\n[pragma-cs]: https://www.sqlite.org/pragma.html#pragma_cache_size\n[pragma-fk]: https://www.sqlite.org/pragma.html#pragma_foreign_keys\n[pragma-jm]: https://www.sqlite.org/pragma.html#pragma_journal_mode\n[pragma-sync]: https://www.sqlite.org/pragma.html#pragma_synchronous\n[pragma-walck]: https://www.sqlite.org/pragma.html#pragma_wal_autocheckpoint\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrystal-lang%2Fcrystal-sqlite3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrystal-lang%2Fcrystal-sqlite3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrystal-lang%2Fcrystal-sqlite3/lists"}