{"id":13460665,"url":"https://a4z.github.io/libsl3/","last_synced_at":"2025-03-24T19:32:32.612Z","repository":{"id":81564383,"uuid":"43769564","full_name":"a4z/libsl3","owner":"a4z","description":" The convenient  C++ interface for SQLite","archived":false,"fork":false,"pushed_at":"2023-05-20T18:27:02.000Z","size":7609,"stargazers_count":15,"open_issues_count":0,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-08-01T10:21:40.098Z","etag":null,"topics":["sql","sqlite"],"latest_commit_sha":null,"homepage":"https://a4z.github.io/libsl3/","language":"C","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/a4z.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}},"created_at":"2015-10-06T18:16:47.000Z","updated_at":"2024-03-31T20:04:34.000Z","dependencies_parsed_at":"2024-01-13T17:47:03.446Z","dependency_job_id":"db6b9cd4-f858-4df9-a74c-e8243400191c","html_url":"https://github.com/a4z/libsl3","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a4z%2Flibsl3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a4z%2Flibsl3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a4z%2Flibsl3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a4z%2Flibsl3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/a4z","download_url":"https://codeload.github.com/a4z/libsl3/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":222004233,"owners_count":16914875,"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":["sql","sqlite"],"created_at":"2024-07-31T10:00:46.661Z","updated_at":"2025-03-24T19:32:32.605Z","avatar_url":"https://github.com/a4z.png","language":"C","funding_links":[],"categories":["Examples"],"sub_categories":[],"readme":"# libsl3, a C++ interface for SQLite 3.x\r\n\r\nlibsl3 is designed to enable comfortable and efficient communication with a\r\nSQLite database based on its natural language, which is SQL.\r\n\r\nlibsl3 originated back at a time when C++11 was new.\r\nIt has remained stable to support existing users for quite a while, over a decade.\r\nWith the arrival of C++23, development has restarted, but due to a lack of time, not much has happened so far. The minimum required C++ standard is now C++17.\r\nThe goal is to keep the interface stable, but using a newer C++ standard might justify some breaking changes.\r\n\r\nFor people seeking the old version, release v1.1.31001 preserves the original C++11 state with CMake 2.8 support.\r\n\r\n**The full documentation for libsl3 can be found here:** \u003cbr\u003e\r\nhttps://a4z.github.io/libsl3/\r\n\r\n## Build\r\n\r\nQuickly summarized, there are dependencies, but they are all either development dependencies or optional\r\n\r\n- sqlite3\r\n- doctest\r\n- commonCompilerWarnings\r\n\r\n### Consume via CMake\r\n\r\nTo build libsl3 without any dependencies, run\r\n\r\n    cmake -S . -B build -DBUILD_TESTING=OFF -Dsl3_USE_INTERNAL_SQLITE3=ON -Dsl3_USE_COMMON_COMPILER_WARNINGS=OFF\r\n\r\nThis will build libsl3 with the internal sqlite distribution.\r\nThe used sqlite version is documented in the patch level part of the actual libsl3 version.\r\n\r\nFor using sqlite from the system, run\r\n\r\n    cmake -S . -B build -DBUILD_TESTING=OFF -Dsl3_USE_COMMON_COMPILER_WARNINGS=OFF\r\n\r\nFor more information about how to consume and build the library, visit [the documentation](https://a4z.github.io/libsl3/#Installation).\r\n\r\n## A short usage example\r\n\r\n```cpp\r\n#include \u003ccassert\u003e\r\n#include \u003ciostream\u003e\r\n#include \u003csl3/database.hpp\u003e\r\n\r\nint main()\r\n{\r\n  using namespace sl3;\r\n  // define a db\r\n  Database db(\":memory:\");\r\n  // run commands against the db\r\n  db.execute(\"CREATE TABLE tbl(f1 INTEGER, f2 TEXT, f3 REAL);\");\r\n  // create a command with parameters\r\n  auto cmd = db.prepare(\"INSERT INTO tbl (f1, f2, f3) VALUES (?,?,?);\");\r\n  //add some data\r\n  cmd.execute(parameters(1, \"one\", 1.1));\r\n  cmd.execute(parameters(2, \"two\", 2.2));\r\n  // access the data\r\n  Dataset ds = db.select(\"SELECT * FROM tbl;\");\r\n  // Dataset is a container\r\n  assert(ds.size()==2);\r\n  // A row in a dataset is also a container\r\n  auto row = ds[0] ;\r\n  assert(row.size()==3);\r\n  // Type info for each field s available\r\n  assert ( row[0].type() == Type::Int ) ;\r\n  assert ( row[1].type() == Type::Text ) ;\r\n  assert ( row[2].type() == Type::Real ) ;\r\n  // there is also iterator access\r\n  for(const auto\u0026 row  :ds) {\r\n      for (const auto\u0026 field : row) {\r\n          std::cout \u003c\u003c field \u003c\u003c \" \" ;\r\n      }\r\n      std::cout \u003c\u003c std::endl;\r\n  }\r\n}\r\n\r\n```\r\n\r\nThis will output\r\n\r\n```bash\r\n1 one 1.1\r\n2 two 2.1\r\n```\r\n\r\nAdditional samples can be found in the tests and tests/samples subfolder.\r\n\r\n## License\r\n\r\nhttps://www.mozilla.org/en-US/MPL/2.0/\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/a4z.github.io%2Flibsl3%2F","html_url":"https://awesome.ecosyste.ms/projects/a4z.github.io%2Flibsl3%2F","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/a4z.github.io%2Flibsl3%2F/lists"}