{"_id":"@aliustaoglu/react-native-sqlite-storage","_rev":"3-896afaa45485207460205845f509b487","name":"@aliustaoglu/react-native-sqlite-storage","dist-tags":{"latest":"7.2.1"},"versions":{"7.1.0":{"name":"@aliustaoglu/react-native-sqlite-storage","version":"7.1.0","keywords":["react-native-sqlite-storage","react-native-sqlite","react-component","reactnative","react-native","sqlite","sqlite3","ios","android","promise","cordova-sqlite-storage"],"author":{"name":"Andrzej Porebski x La Gregance"},"license":"MIT","_id":"@aliustaoglu/react-native-sqlite-storage@7.1.0","maintainers":[{"name":"aliustaoglu","email":"aliustaoglu@yahoo.com"}],"homepage":"https://github.com/aliustaoglu/react-native-sqlite-storage","bugs":{"url":"https://github.com/aliustaoglu/react-native-sqlite-storage/issues"},"dist":{"shasum":"c267b46250c01a2dd8b9d6ec0dad3bde3e27f7c7","tarball":"https://registry.npmjs.org/@aliustaoglu/react-native-sqlite-storage/-/react-native-sqlite-storage-7.1.0.tgz","fileCount":66,"integrity":"sha512-j8UVQLGBJ6eLymb8MP5rgvQpHVHD4JSAkc9sGtVmQ2odAzmMbB51Ncr7Eh++u9uhv/o+xUtKqghFIWiF/JIKJQ==","signatures":[{"sig":"MEQCICX2Fwt7VMBDz2lVy/nNq048ZTaO2snKxIxuLlEEFubVAiBWaODoTycjwzf6ikM4gM2xKPJnU7Bk4pXkyJHgxDiAbA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":16085612},"main":"sqlite.js","gitHead":"5a8dd10db06a9c56fd1f112f17f178f63b33db09","scripts":{"test":"echo \"Error: no test specified yet\" && exit 1"},"_npmUser":{"name":"aliustaoglu","email":"aliustaoglu@yahoo.com"},"repository":{"url":"git+https://github.com/aliustaoglu/react-native-sqlite-storage.git","type":"git"},"_npmVersion":"10.9.4","description":"SQLite3 bindings for React Native (Android & iOS)","directories":{},"_nodeVersion":"22.21.1","_hasShrinkwrap":false,"devDependencies":{"react":"16.13.1","react-native":"^0.63.2","react-native-windows":"^0.63.6"},"peerDependencies":{"react-native":">=0.14.0"},"_npmOperationalInternal":{"tmp":"tmp/react-native-sqlite-storage_7.1.0_1767657741657_0.4355485876905112","host":"s3://npm-registry-packages-npm-production"}},"7.2.0":{"name":"@aliustaoglu/react-native-sqlite-storage","version":"7.2.0","keywords":["react-native-sqlite-storage","react-native-sqlite","react-component","reactnative","react-native","sqlite","sqlite3","ios","android","promise","cordova-sqlite-storage"],"author":{"name":"Andrzej Porebski x La Gregance"},"license":"MIT","_id":"@aliustaoglu/react-native-sqlite-storage@7.2.0","maintainers":[{"name":"aliustaoglu","email":"aliustaoglu@yahoo.com"}],"homepage":"https://github.com/aliustaoglu/react-native-sqlite-storage","bugs":{"url":"https://github.com/aliustaoglu/react-native-sqlite-storage/issues"},"dist":{"shasum":"e4f8bd8cdb8f809bedb9d0fbb9ba78e3570d23fa","tarball":"https://registry.npmjs.org/@aliustaoglu/react-native-sqlite-storage/-/react-native-sqlite-storage-7.2.0.tgz","fileCount":65,"integrity":"sha512-cYBDNBv9nzA60fMAmMbDidS2VqW3XQs1JZ8uwO/5Jxeqru0nsbOrJSh50YVt1LptLc/TS2ippVAf1m9dB8qPFA==","signatures":[{"sig":"MEQCIFalIAc1EcrH6xG5ISZlzqWTW1CLthATdRcYrH1W8b8gAiB7xAwKPeVNENTYh0vPMT5nbzMi1s0keg3I2L3JtSPl1w==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":16086065},"main":"sqlite.js","gitHead":"541805f6086ecd939ebb01e9b595487e186e215f","scripts":{"test":"echo \"Error: no test specified yet\" && exit 1"},"_npmUser":{"name":"aliustaoglu","email":"aliustaoglu@yahoo.com"},"repository":{"url":"git+https://github.com/aliustaoglu/react-native-sqlite-storage.git","type":"git"},"_npmVersion":"10.9.4","description":"SQLite3 bindings for React Native (Android & iOS)","directories":{},"_nodeVersion":"22.21.1","_hasShrinkwrap":false,"devDependencies":{"react":"16.13.1","react-native":"^0.63.2","react-native-windows":"^0.63.6"},"peerDependencies":{"react-native":">=0.14.0"},"_npmOperationalInternal":{"tmp":"tmp/react-native-sqlite-storage_7.2.0_1768183459290_0.5683260340929712","host":"s3://npm-registry-packages-npm-production"}},"7.2.1":{"name":"@aliustaoglu/react-native-sqlite-storage","version":"7.2.1","description":"SQLite3 bindings for React Native (Android & iOS)","main":"sqlite.js","scripts":{"test":"echo \"Error: no test specified yet\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/aliustaoglu/react-native-sqlite-storage.git"},"keywords":["react-native-sqlite-storage","react-native-sqlite","react-component","reactnative","react-native","sqlite","sqlite3","ios","android","promise","cordova-sqlite-storage"],"author":{"name":"Andrzej Porebski x La Gregance"},"license":"MIT","bugs":{"url":"https://github.com/aliustaoglu/react-native-sqlite-storage/issues"},"homepage":"https://github.com/aliustaoglu/react-native-sqlite-storage","peerDependencies":{"react-native":">=0.14.0"},"devDependencies":{"react":"16.13.1","react-native":"^0.63.2","react-native-windows":"^0.63.6"},"_id":"@aliustaoglu/react-native-sqlite-storage@7.2.1","gitHead":"715faec869fdc1033f1bc7cc14a6d08ff23769b0","_nodeVersion":"22.21.1","_npmVersion":"10.9.4","dist":{"integrity":"sha512-NxGhiXm9bHd9gJWazgNd+LIq+k2tRY2vHd/rSyrGM0RP7/isydkA1gZAuZ9PLxOcg9lmyzqVjyOJuhhO3PL7Wg==","shasum":"9c05cd93161a4c279bffe745559c266753a6a944","tarball":"https://registry.npmjs.org/@aliustaoglu/react-native-sqlite-storage/-/react-native-sqlite-storage-7.2.1.tgz","fileCount":65,"unpackedSize":16086070,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDrjZIMOpf0aRgmh2/UTHvWFVDeu+RvyNPBNHhLFnZjOAIgIXLf1Tjqv9E0BWplf0CcsYl9Hsrr1bFtMcPAHyBvbJ4="}]},"_npmUser":{"name":"aliustaoglu","email":"aliustaoglu@yahoo.com"},"directories":{},"maintainers":[{"name":"aliustaoglu","email":"aliustaoglu@yahoo.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/react-native-sqlite-storage_7.2.1_1774894661600_0.3471263082194327"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-06T00:02:21.583Z","modified":"2026-03-30T18:17:42.091Z","7.1.0":"2026-01-06T00:02:22.033Z","7.2.0":"2026-01-12T02:04:19.668Z","7.2.1":"2026-03-30T18:17:41.977Z"},"bugs":{"url":"https://github.com/aliustaoglu/react-native-sqlite-storage/issues"},"author":{"name":"Andrzej Porebski x La Gregance"},"license":"MIT","homepage":"https://github.com/aliustaoglu/react-native-sqlite-storage","keywords":["react-native-sqlite-storage","react-native-sqlite","react-component","reactnative","react-native","sqlite","sqlite3","ios","android","promise","cordova-sqlite-storage"],"repository":{"type":"git","url":"git+https://github.com/aliustaoglu/react-native-sqlite-storage.git"},"description":"SQLite3 bindings for React Native (Android & iOS)","maintainers":[{"name":"aliustaoglu","email":"aliustaoglu@yahoo.com"}],"readme":"# react-native-sqlite-storage\n\nThis is a fork of https://github.com/andpor/react-native-sqlite-storage in order to:\n - Have a well maintained repository to fix bug (Android 11 fix: https://github.com/andpor/react-native-sqlite-storage/issues/462)\n - Have same SQLite version on iOS & Android, independent of OS version, and up to date (version: 3.43.1 - 2023-09-11)\n - Add extra extensions (UUID)\n - Make easy to build & update SQLite version and driver\n\nSQLite3 Native Plugin for React Native for both Android & iOS.\n\nFeatures:\n  1. iOS and Android supported via identical JavaScript API.\n  2. Android in pure Java and Native modes\n  3. SQL transactions\n  4. JavaScript interface via plain callbacks or Promises.\n  5. Pre-populated SQLite database import from application bundle and sandbox\n  6. Same version of SQLite independent of OS version with JSON, UUID, REGEX & BASE64 extensions (version: 3.43.1 - 2023-09-11)\n\nThere are sample apps provided in test directory that can be used in with the AwesomeProject generated by React Native. All you have to do is to copy one of those files into your AwesomeProject replacing index.ios.js.\n\nPlease let me know your projects that use these SQLite React Native modules. I will list them in the reference section. If there are any features that you think would benefit this library please post them.\n\nThe library has been tested with React 18.2, React Native 0.72.0 and XCode 15.4 - it works fine out of the box without any need for tweaks or code changes.\n\n\n# Installation\n```\n# Install this lib as an alias of react-native-sqlite-storage\nyarn add react-native-sqlite-storage@npm:@boltcode/react-native-sqlite-storage\n\n# Add typescript if need\nyarn add -D @types/react-native-sqlite-storage\n```\n\nAs react-native-sqlite-storage original repository is kind of industry standard for React Native and is used in a lot of awesome library (typeorm for example),\nusing an alias make us able to use this package as it was the original one, so package that depend on `react-native-sqlite-storage` will not break.  \n\nAlso note that you should continue to import the library like:\n```ts\n# CommonJS\nvar SQLite = require('react-native-sqlite-storage');\n\n# Typescript\nimport SQLite from 'react-native-sqlite-storage';\n```\n\n## iOS\n\nDon't forget to run `cd ios && pod install && cd ..` to link the library with iOS.\n\n## Android\n\nSince we now only use the SQLite version bundled with this library, there is no extra steps on Android.  \nNote: if you come from the original repository you may delete what you added in `react-native.config.js` under `dependency -> platforms -> android`.\n\n# How to use\n\n## Promises\n\nPromise are not enable by default, if you want to enable it, run:\n```javascript\nSQLite.enablePromise(false);\n```\nIn the following documentation, we consider `enablePromise` is enable.\n\n## Opening a database\n\nOpening a database is slightly different between iOS and Android. Where as on Android the location of the database file is fixed, there are three choices of where the database file can be located on iOS. The 'location' parameter you provide to openDatabase call indicated where you would like the file to be created. This parameter is neglected on Android.\n\nWARNING: the default location on iOS has changed in version 3.0.0 - it is now a no-sync location as mandated by Apple so the release is backward incompatible.\n\n\nTo open a database in default no-sync location (affects iOS *only*)::\n\n```js\nconst db = await SQLite.openDatabase({name: 'my.db', location: 'default'});\n```\n\nTo specify a different location (affects iOS *only*):\n\n```js\nconst db = await SQLite.openDatabase({name: 'my.db', location: 'Library'});\n```\n\nwhere the `location` option may be set to one of the following choices:\n- `default`: `Library/LocalDatabase` subdirectory - *NOT* visible to iTunes and *NOT* backed up by iCloud\n- `Library`: `Library` subdirectory - backed up by iCloud, *NOT* visible to iTunes\n- `Documents`: `Documents` subdirectory - visible to iTunes and backed up by iCloud\n- `Shared`:  app group's shared container - *see next section*\n\n\n## Opening a database in an App Group's Shared Container (iOS)\n\nIf you have an iOS app extension which needs to share access to the same DB instance as your main app, you must use the shared container of a registered app group.\n\nAssuming you have already set up an app group and turned on the \"App Groups\" entitlement of both the main app and app extension, setting them to the same app group name, the following extra steps must be taken:\n\n#### Step 1 - supply your app group name in all needed `Info.plist`s\n\nIn both `ios/MY_APP_NAME/Info.plist` and `ios/MY_APP_EXT_NAME/Info.plist` (along with any other app extensions you may have), you simply need to add the `AppGroupName` key to the main dictionary with your app group name as the string value:\n\n```xml\n<plist version=\"1.0\">\n<dict>\n  <!-- ... -->\n  <key>AppGroupName</key>\n  <string>MY_APP_GROUP_NAME</string>\n  <!-- ... -->\n</dict>\n</plist>\n```\n\n#### Step 2 - set shared database location\n\nWhen calling `SQLite.openDatabase` in your React Native code, you need to set the `location` param to `'Shared'`:\n\n```js\nawait SQLite.openDatabase({name: 'my.db', location: 'Shared'});\n```\n\n## Importing a pre-populated database.\n\nYou can import an existing - prepopulated database file into your application. Depending on your instructions in openDatabase call, the sqlite-storage will look at different places to locate you pre-populated database file.\n\n\nUse this flavor of openDatabase call, if your folder is called www and data file is named the same as the dbName - testDB in this example\n\n```js\nawait SQLite.openDatabase({name : \"testDB\", createFromLocation : 1});\n```\n\nUse this flavor of openDatabase call if your folder is called data rather than www or your filename does not match the name of the db. In this case db is named testDB but the file is mydbfile.sqlite which is located in a data subdirectory of www\n\n```js\nawait SQLite.openDatabase({name : \"testDB\", createFromLocation : \"~data/mydbfile.sqlite\"});\n```\n\nUse this flavor of openDatabase call if your folder is not in application bundle but in app sandbox i.e. downloaded from some remote location. In this case the source file is located in data subdirectory of Documents location (iOS) or FilesDir (Android).\n\n```js\nawait SQLite.openDatabase({name : \"testDB\", createFromLocation : \"/data/mydbfile.sqlite\"});\n```\n\n## Additional options for pre-populated database file\n\nYou can provide additional instructions to sqlite-storage to tell it how to handle your pre-populated database file. By default, the source file is copied over to the internal location which works in most cases but sometimes this is not really an option particularly when the source db file is large. In such situations you can tell sqlite-storage you do not want to copy the file but rather use it in read-only fashion via direct access. You accomplish this by providing an additional optional readOnly parameter to openDatabase call\n\n```js\nawait SQLite.openDatabase({name : \"testDB\", readOnly: true, createFromLocation : \"/data/mydbfile.sqlite\"});\n```\n\nNote that in this case, the source db file will be open in read-only mode and no updates will be allowed. You cannot delete a database that was open with readOnly option. For Android, the read only option works with pre-populated db files located in FilesDir directory because all other assets are never physically located on the file system but rather read directly from the app bundle.\n\n## Attaching another database\n\nSqlite3 offers the capability to attach another database to an existing database-instance, i.e. for making cross database JOINs available.\nThis feature allows to SELECT and JOIN tables over multiple databases with only one statement and only one database connection.\nTo archieve this, you need to open both databases and to call the attach()-method of the destination (or master) -database to the other ones.\n\n```js\nconst dbSecond = await SQLite.openDatabase({name: 'second'});\nconst dbMaster = await SQLite.openDatabase({name: 'master'});\nawait dbMaster.attach(\"second\", \"second\");\n```\n\nThe first argument of attach() is the name of the database, which is used in SQLite.openDatabase(). The second argument is the alias, that is used to query on tables of the attached database.\n\nThe following statement would select data from the master database and include the \"second\"-database within a simple SELECT/JOIN-statement:\n\n```sql\nSELECT * FROM user INNER JOIN second.subscriptions s ON s.user_id = user.id\n```\n\nTo detach a database, just use the detach()-method:\n\n```js\nawait dbMaster.detach('second');\n```\n\nFor sure, their is also Callback-support available for attach() and detach().\n\n# Acknowledgements\n\nThank you to all authors & contributors of the following repository, PR, issues, without whom it would not have been possible:\n - https://github.com/andpor/react-native-sqlite-storage\n - https://github.com/liteglue/Android-sqlite-connector\n - https://github.com/brodybits/Android-sqlite-ext-native-driver\n - https://github.com/OutSystems/Android-sqlite-connector/pull/1\n - https://github.com/OutSystems/Android-sqlite-native-driver/pull/1\n - https://github.com/andpor/react-native-sqlite-storage/issues/462\n - https://github.com/andpor/react-native-sqlite-storage/pull/494\n - https://github.com/sqlg/gluegentools/\n - https://github.com/brodybits/libb64-core/\n - https://github.com/liteglue/sqlite-amalgamation/\n - https://github.com/brodybits/sqlite3-base64\n - https://github.com/brodybits/sqlite3-regexp-cached\n\n# How to reproduce\n\nIf you want to know how this repository is build & managed, you can follow the documentation under [docs folder](docs/how_to_reproduce.md)","readmeFilename":"README.md"}