{"id":18098502,"url":"https://github.com/danieloneill/jsidbi","last_synced_at":"2025-04-06T04:18:00.814Z","repository":{"id":89578094,"uuid":"179739392","full_name":"danieloneill/jsidbi","owner":"danieloneill","description":"LibDBI interface for JSI","archived":false,"fork":false,"pushed_at":"2019-04-07T00:49:55.000Z","size":33,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-12T10:18:56.798Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/danieloneill.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-05T19:02:58.000Z","updated_at":"2019-04-07T00:49:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"43facf59-59d0-4801-9558-6660a87db946","html_url":"https://github.com/danieloneill/jsidbi","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/danieloneill%2Fjsidbi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danieloneill%2Fjsidbi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danieloneill%2Fjsidbi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danieloneill%2Fjsidbi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danieloneill","download_url":"https://codeload.github.com/danieloneill/jsidbi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247430976,"owners_count":20937876,"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-10-31T20:11:29.877Z","updated_at":"2025-04-06T04:18:00.598Z","avatar_url":"https://github.com/danieloneill.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# jsidbi\nLibDBI interface for JSI\n\n## Building\nEdit the Makefile such that JSIDIR points to the src/ directory within your JSI codebase.\n\nlibdbi must be installed, along with the developer headers.\n\nRun 'make'.\n\n## Creating a DB instance:\nYou can copy the resulting 'dbi.so' either to you system modules directory (on my system, \"/usr/local/lib/jsi/dbi.so\" works) or wherever you like, with Interp.conf({pkgDirs:[]}) configured appropriately.\n\nIn your script, load it with:\n\n    require('dbi');\n\nCreate a database instance with:\n\n    var db = new DB(\"mysql\", {'host':'localhost', 'username':'root', 'dbname':'test'});\n\nThe database type names and parameters accepted by each can be found on the libdbi-drivers documentation.\n\n### db.open():bool\nUpon successfully connecting to the database, returns true, otherwise false.\n\n### db.error():object\nReturns an object containing the most recent error on the database handle in the format:\n\n    { \"number\":\u003ccode\u003e, \"text\":\u003cerror message\u003e }\n\n### db.begin():bool\nBegin a transaction. If successful, returns true. If it failed for any reason (including the underlying database lacking a transaction implementation) it will return false.\n\n### db.commit():bool\nCommit a transaction. If successful, returns true. If it failed for any reason (including the underlying database lacking a transaction implementation) it will return false.\n\n### db.rollback():bool\nRoll back a transaction. If successful, returns true. If it failed for any reason (including the underlying database lacking a transaction implementation) it will return false.\n\n### db.use(dbname:string):bool\nSwitch to use the specified database \"dbname\". If successful, returns true. Otherwise false.\n\n### db.query(query:string, params:array=void):DBQuery\nQuery the database using the provided query string. Parameters (if any) may be provided in the 'params' array.\n\nParameters provided are interpolated by their position in their passed array.\n\nIndexes start at 1 for interpolated tokens and are notated by a '%' symbol.\n\n    var q = db.query(\"SELECT foo, bar FROM mytable WHERE firstname=%1 AND lastname=%2\", [\"Tricia\", \"MacMillan\"]);\n\n### db.lastSeq(name:string=void):number\nReturn the last sequence value for the named sequence (if supported).\n\nThe last sequence generated (on any table) will be returned for databases which do not support explicit sequences (eg, Mysql)\n\n### db.nextSeq(name:string=void):number\nReturn the next sequence value for the named sequence (if supported).\n\nFor databases which do not support explicit sequences (eg, Mysql) this method is useless.\n\n### db.check():bool\nCheck if the server is connected and, if not, attempt to reconnect.\n\nReturns true if connected, false otherwise.\n\n### db.escape(content:string):string\nEscape a string for inclusion in a SQL query directly.\n\nReturns the escaped string if successful, false otherwise.\n\n\n## Creating a Query instance:\n\n    var query = db.query(\"SELECT cheese FROM kitchen WHERE kind != 'mozzarella'\");\n\nIf a query is successful, a handle is returned which offers relatively basic operations and parameters.\n\n### query.fields:array\nAn ordered array of the fields returned by the query.\n\n### query.rowcount:number\nHow many rows are returned by the query.\n\n### query.seek(row:number):bool\nMove to a specific row within the result set. If successful, returns true. Otherwise, false.\n\n### query.value(column:number):\u0026lt;mixed\u0026gt;\nReturn the value at the specified column index in the currently selected row.\n\n * NULL field values will be returned as a Null value.\n * Integers will be converted to \"long long\", or a signed 64-bit integer, before being returned as a JSI Number.\n * Floating point and double precision are treated as doubles.\n * Binary data and strings are returned as normal, but be mindful that JSI is (currently) not 100% unicode safe.\n * Datetime will be returned as seconds since UNIX epoch.\n\n### query.toArray(options:object):array\nReturn an array of results as defined by \"options\", or all results if not specified.\n\nOptions can contain the following parameters:\n * first:number - The index of the first record to return. Defaults to 0.\n * last:number - The index of the last record to return. Defaults to the last row in the set.\n * format:string - How to format the rows in the result set. Currently, the only option is \"object\", and is (oddly enough) also the default.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanieloneill%2Fjsidbi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanieloneill%2Fjsidbi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanieloneill%2Fjsidbi/lists"}