{"id":18936390,"url":"https://github.com/vaporexampleslab/synergysqliteframework","last_synced_at":"2026-03-21T03:30:15.385Z","repository":{"id":133115014,"uuid":"177857360","full_name":"VaporExamplesLab/SynergySQLiteFramework","owner":"VaporExamplesLab","description":"SynergySQLiteFramework provides a Swift API for SynergySQLiteC SQLite C-source package.","archived":false,"fork":false,"pushed_at":"2023-03-10T01:53:36.000Z","size":450,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-31T21:26:14.678Z","etag":null,"topics":["sqlite3","swift","swift-package-manager"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/VaporExamplesLab.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":"2019-03-26T19:41:41.000Z","updated_at":"2023-03-10T01:53:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"0fb50a90-ce0c-4296-b66e-dcf8e52784df","html_url":"https://github.com/VaporExamplesLab/SynergySQLiteFramework","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VaporExamplesLab%2FSynergySQLiteFramework","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VaporExamplesLab%2FSynergySQLiteFramework/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VaporExamplesLab%2FSynergySQLiteFramework/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VaporExamplesLab%2FSynergySQLiteFramework/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VaporExamplesLab","download_url":"https://codeload.github.com/VaporExamplesLab/SynergySQLiteFramework/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239937701,"owners_count":19721482,"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":["sqlite3","swift","swift-package-manager"],"created_at":"2024-11-08T12:07:15.889Z","updated_at":"2026-03-21T03:30:15.347Z","avatar_url":"https://github.com/VaporExamplesLab.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SynergySQLiteFramework\n\n## Contents \u003ca id=\"contents\"\u003e\u003c/a\u003e\n[API Summary](#ApiSummary) •\n[Example](#Example) •\n[Notes](#Notes) •\n[Subproject Usage](#SubprojectUsage) •\n[Original Setup](#OriginalSetup) •\n[Resources](#resources-)\n\n## API Summary \u003ca id=\"ApiSummary\"\u003e\u003c/a\u003e\u003csup\u003e[▴](#contents)\u003c/sup\u003e\n\n#### SynergySQLite (Utilities)\n\n``` swift\nstatic func escapeLikeString(_ s: String, escapeChar: String) -\u003e String \nstatic func getProcessInfo() -\u003e [String:String]\nstatic func getSqliteInfo() -\u003e [String:String]\n```\n\n#### SynergySQLiteDatabase -- database connection\n\n``` swift\nSynergySQLiteDatabase(pathname: String, options: OptionDictionary = [:])\n\nfunc open()   -\u003e Bool   // true: successful open\nfunc close()  -\u003e Bool   // true: successful open\n\nfunc isOpen()    -\u003e Bool\nfunc getStatus() -\u003e SynergySQLiteStatus\nfunc hasError()  -\u003e Bool\n\nfunc importSql(filepath: String)\n```\n\n#### SynergySQLiteQuery\n\nUse `SynergySQLiteQuery` manipulating and executing SQL statements.\n\n_Note: only the first statement will be executed.  Separate multiple statements into multiple SynergySQLiteQuery. ... or :NYI: set up a bind parameter._\n\n``` swift\nSynergySQLiteQuery(db: SynergySQLiteDatabase) \nfunc statementPrepare(_ sql: String) -\u003e Int // returns Int status\nfunc statementReset()\nfunc statementBind(paramIndex: Int32, paramValue: String) -\u003e Int32\nfunc statementExecute() // creates SynergySQLiteResult()\n\nfunc getResult() -\u003e SynergySQLiteResult?\n\nfunc getStatus() -\u003e SynergySQLiteStatus\nfunc hasError()  -\u003e Bool\n\n// executes non-empty query\nSynergySQLiteQuery(sql: String, db: SynergySQLiteDatabase)\n\n// :NYI:   \n// .bindValue(placeholder, value, type) \n// .bindValue(position, value, type)\n// .boundValue(placeholder) \n// .boundValue(position)\n\n```\n\n#### SynergySQLiteResult\n\nCreated by `SynergySQLiteQuery` execution. `SynergySQLiteResult` is used for reading and formatting results. \n\n``` swift\npublic var columnNames: [String]\n// :NYI: columnType: [SynergySQLiteResultTypes]\n// :???: ponder column type in Query for mapping int to boolean\npublic var data: [[Any?]]\n\nfunc toStringTsv(withColumnNames: Bool = true) -\u003e String\n// :NYI: toStringJson(withColumnNames: Bool = true)\n\nfunc getRowData(rowIdx: Int) -\u003e [Any?]\n```\n\n#### SynergySQLiteStatus\n\n`SynergySQLiteStatus` provides status and error information.\n\n## Example \u003ca id=\"Example\"\u003e\u003c/a\u003e\u003csup\u003e[▴](#contents)\u003c/sup\u003e\n\n``` swift\n(\"select * from employees\");\ncolumnCount() // column fields \ncolumnIndex(\"name\"); // index of column field \"name\"\ncolumnType(\"name\"), columnType(index)\nrowCount() // rows\n```\n\n## Notes \u003ca id=\"Notes\"\u003e\u003c/a\u003e\u003csup\u003e[▴](#contents)\u003c/sup\u003e\n\nBoolean values are inserted and returned as `0` or `1`.\n\nIn Xcode the C header files need to be manually added to the project.\n\n![BuildSettingsCHeaders](README_files/BuildSettingsCHeaders.png)\n\nThe script ['swift-copy-testresources.swift'](swift-copy-testresources.swift) is used to copy the test database to a known location to support the tests.\n\n``` swift\n#!/usr/bin/swift\n\n// FILE: swift-copy-testresources.sh\n// verify swift path with \"which -a swift\"\n// macOS: /usr/bin/swift \n// Ubuntu: /opt/swift/current/usr/bin/swift \n\nimport Foundation\n\nfunc copyTestResources() {\n    let argv = ProcessInfo.processInfo.arguments\n//     for i in 0..\u003cargv.count {\n//         print(\"argv[\\(i)] = \\(argv[i])\")\n//     }\n    \n    let pwd = argv[argv.count-1]\n    print(\"Executing swift-copy-testresources\")\n    print(\"  PWD=\\(pwd)\")\n    \n    let fm = FileManager.default\n    \n    let pwdUrl = URL(fileURLWithPath: pwd, isDirectory: true)\n    let srcUrl = pwdUrl\n        .appendingPathComponent(\"TestResources\", isDirectory: true)\n    let dstUrl = pwdUrl\n        .appendingPathComponent(\".build\", isDirectory: true)\n        .appendingPathComponent(\"TestResources\", isDirectory: true)\n    \n    do {\n        let contents = try fm.contentsOfDirectory(at: srcUrl, includingPropertiesForKeys: [])\n        do { try fm.removeItem(at: dstUrl) } catch { }\n        try fm.createDirectory(at: dstUrl, withIntermediateDirectories: true)\n        for fromUrl in contents {\n            try fm.copyItem(\n                at: fromUrl, \n                to: dstUrl.appendingPathComponent(fromUrl.lastPathComponent)\n            )\n        }\n    } catch {\n        print(\"  SKIP TestResources not copied. \")\n        return\n    }\n            \n    print(\"  SUCCESS TestResources copy completed.\\n  FROM \\(srcUrl)\\n  TO \\(dstUrl)\")\n}\n\ncopyTestResources()\n```\n\n## Subproject Usage \u003ca id=\"SubprojectUsage\"\u003e\u003c/a\u003e\u003csup\u003e[▴](#contents)\u003c/sup\u003e\n\n1. Clone Repository\n\n    ``` bash\n    cd WORKING_DIRECTORY\n    git clone git@github.com:VaporExamplesLab/SynergySQLiteFramework.git\n    ```\n\n2. Create Xcode project\n\n    ``` bash\n    cd SynergySQLiteFramework\n\n    # for macOS\n    swift package generate-xcodeproj --xcconfig-overrides Package.xcconfig\n    ```\n\n3. Verify `DEFINES_MODULE = YES` in Project Editor \u003e Target \u003e Build Settings.\n\n4. Drag and drop SynergySQLiteFramework.xcodeproj as subproject to the parent Xcode project.\n\n5. In the parent Xcode project, Project Editor \u003e Target \u003e Build Phases:\n    * `+` add to Target Dependencies\n    * `+` add to Link Binary With Libraries\n\n## Original Setup \u003ca id=\"OriginalSetup\"\u003e\u003c/a\u003e\u003csup\u003e[▴](#contents)\u003c/sup\u003e\n\n_Steps taken to initial setup this project._\n\n``` bash\nmkdir SynergySQLiteFramework\ncd SynergySQLiteFramework\nswift package init\ngit init\ngit add README.md\ngit commit -m \"first commit\"\ngit remote add origin git@github.com-*:VaporExamplesLab/SynergySQLiteFramework.git\ngit push -u origin master\n\n# swift build -Xswiftc \"-target\" -Xswiftc \"x86_64-apple-macosx10.13\"\nswiftbuild # alias\n\n# swift test -Xswiftc \"-target\" -Xswiftc \"x86_64-apple-macosx10.13\"\nswifttest # alias\n\n# swift package generate-xcodeproj --xcconfig-overrides Configs/Package.xcconfig\nswiftxcode # alias\nopen SynergySQLiteFramework.xcodeproj\n```\n\n## Resources \u003ca id=\"resources-\"\u003e\u003c/a\u003e\u003csup\u003e[▴](#contents)\u003c/sup\u003e\n\n[SQLite: SQL As Understood By SQLite ⇗](https://www.sqlite.org/lang.html)  \n[SQLite: Core Functions ⇗](https://www.sqlite.org/lang_corefunc.html)  \n[SQLite: PRAGMA Statements ⇗](https://www.sqlite.org/pragma.html) … SQL extension specific to SQLite. Used to modify the operation of the SQLite library or to query the SQLite library for internal (non-table) data.  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvaporexampleslab%2Fsynergysqliteframework","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvaporexampleslab%2Fsynergysqliteframework","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvaporexampleslab%2Fsynergysqliteframework/lists"}