{"id":13849087,"url":"https://github.com/plausiblelabs/pldatabase","last_synced_at":"2025-07-12T15:33:02.250Z","repository":{"id":10629520,"uuid":"12853003","full_name":"plausiblelabs/pldatabase","owner":"plausiblelabs","description":"SQL database access library for iOS and macOS","archived":false,"fork":false,"pushed_at":"2019-10-08T17:57:28.000Z","size":8026,"stargazers_count":17,"open_issues_count":0,"forks_count":10,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-11-22T01:32:37.332Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Objective-C","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/plausiblelabs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-09-15T21:31:59.000Z","updated_at":"2024-04-29T15:46:00.000Z","dependencies_parsed_at":"2022-09-18T07:33:19.171Z","dependency_job_id":null,"html_url":"https://github.com/plausiblelabs/pldatabase","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/plausiblelabs/pldatabase","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plausiblelabs%2Fpldatabase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plausiblelabs%2Fpldatabase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plausiblelabs%2Fpldatabase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plausiblelabs%2Fpldatabase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/plausiblelabs","download_url":"https://codeload.github.com/plausiblelabs/pldatabase/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plausiblelabs%2Fpldatabase/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265013568,"owners_count":23698062,"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":[],"created_at":"2024-08-04T19:01:07.593Z","updated_at":"2025-07-12T15:32:59.400Z","avatar_url":"https://github.com/plausiblelabs.png","language":"Objective-C","funding_links":[],"categories":["Objective-C"],"sub_categories":[],"readme":"# PLDatabase\n\nPLDatabase provides an SQL database access library for Objective-C, focused on SQLite as an application database. The library supports both macOS and iOS development.\n\n## Basic Usage\n\n### Creating a Connection\n\nOpen a connection to a database file:\n\n```objectivec\nPLSqliteDatabase *db = [[PLSqliteDatabase alloc] initWithPath: @\"/path/to/database\"];\nif (![db openAndReturnError: \u0026error]) {\n    NSLog(@\"Could not open database\");\n}\n```\n\n### Update Statements\n\nUpdate statements can be executed directly via `-[PLDatabase executeUpdateAndReturnError:statement:...]`:\n\n```objectivec\nif (![db executeUpdateAndReturnError: \u0026error statement: @\"CREATE TABLE example (id INTEGER)\"]) {\n    NSLog(@\"Table creation failed\");\n}\n\nif (![db executeQueryAndReturnError: \u0026error statement: @\"INSERT INTO example (id) VALUES (?)\", [NSNumber numberWithInteger: 42]]) {\n    NSLog(@\"Data insert failed\");\n}\n```\n\n### Query Statements\n\nQueries can be executed using `-[PLDatabase executeQueryAndReturnError:statement:...]`.  To iterate over the returned results, a instance conforming to the `PLResultSet` protocol will be returned:\n\n```objectivec\nid\u003cPLResultSet\u003e results = [db executeQueryAndReturnError: \u0026error statement: @\"SELECT id FROM example WHERE id = ?\", [NSNumber numberWithInteger: 42]];\nPLResultSetStatus rss;\nwhile ((rss = [results nextAndReturnError: \u0026error]) == PLResultSetStatusRow) {\n    NSLog(@\"Value of column id is %d\", [results intForColumn: @\"id\"]);\n}\n\nif (rss != PLResultSetStatusDone) {\n    NSLog(@\"Iterating results failed\");\n}\n\n// Failure to close the result set will not leak memory, but may\n// retain database resources until the instance is deallocated.\n[results close];\n```\n\n### Prepared Statements\n\nPre-compilation of SQL statements and advanced parameter binding are supported by `PLPreparedStatement`. A prepared statement can be constructed using `-[PLDatabase prepareStatement:error:]`.\n\n```objectivec\nid\u003cPLPreparedStatement\u003e stmt = [db prepareStatement: @\"INSERT INTO example (name, color) VALUES (?, ?)\" error: \u0026error];\n\n// Bind the parameters\n[stmt bindParameters: @[\"Widget\", @\"Blue\"]];\n\n// Execute the INSERT\nif ([stmt executeUpdateAndReturnError: \u0026error] == NO) {\n    NSLog(@\"INSERT failed\");\n}\n```\n\n### Name-based Parameter Binding\n\nName-based parameter binding is also supported:\n\n```objectivec\n// Prepare the statement\nid\u003cPLPreparedStatement\u003e stmt = [db prepareStatement: @\"INSERT INTO test (name, color) VALUES (:name, :color)\" error: \u0026error];\n\n// Bind the parameters using a dictionary\n[stmt bindParameterDictionary: @{ @\"name\" : @\"Widget\", @\"color\" : @\"Blue\" }];\n\n// Execute the INSERT\nif ([stmt executeUpdateAndReturnError: \u0026error] == NO) {\n    NSLog(@\"INSERT failed\");\n}\n```\n\n## Building\n\nTo build your own release binary, build the 'Disk Image' target:\n```\n$ xcodebuild -configuration Release -target 'Disk Image'\n```\n\nThis will output a new release disk image containing an embeddable macOS framework and a static iOS framework in `build/Release/Plausible Database-{version}.dmg`.\n\n## License\n\nPLDatabase is provided free of charge under the BSD license, and may be freely integrated with any application. See the LICENSE file for the full license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplausiblelabs%2Fpldatabase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplausiblelabs%2Fpldatabase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplausiblelabs%2Fpldatabase/lists"}