Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 883504c
Showing
14 changed files
with
1,870 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015 andpor | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# react-native-sqlite-storage | ||
SQLite Native Plugin for React Native | ||
|
||
Inspired by fantastic work done by Chris Brody I did not want to re-invent the wheel. The original Cordova plugin was written so well and adhered to latest WebSQL API that there was no need to come up with anything much different. So the Cordova plugin was ported to React Native. | ||
|
||
This is iOS binding only for now. Initial release - fully working. Tested so far with Simulators. | ||
|
||
How to use (npm is coming): | ||
|
||
1. Download the code into your node_modules subdirectory in your React Native project root $(PRJ_SRC)/node_modules/react-native-sqlite-storage | ||
2. Drag the SQLite Xcode project as a dependency project into your React Native XCode project | ||
3. Add libSQL.a (from Workspace location) to the required Libraries and Frameworks. | ||
4. Add var SQLite = require('react-native-sqlite-storage') to your index.ios.js | ||
5. Add JS application code to use SQLite API in your index.ios.js etc. | ||
6. | ||
|
||
Enjoy! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* SQLite.h | ||
* | ||
* Created by Andrzej Porebski on 10/29/15. | ||
* Copyright (c) 2015 Andrzej Porebski. | ||
* | ||
* This software is largely based on the SQLLite Storage Cordova Plugin created by Chris Brody & Davide Bertola. | ||
* The implementation was adopted and converted to use React Native bindings. | ||
* | ||
* See https://github.com/litehelpers/Cordova-sqlite-storage | ||
* | ||
* This library is available under the terms of the MIT License (2008). | ||
* See http://opensource.org/licenses/alphabetical for full text. | ||
*/ | ||
|
||
#import <RCTBridgeModule.h> | ||
|
||
// Used to remove dependency on sqlite3.h in this header: | ||
struct sqlite3; | ||
|
||
enum WebSQLError { | ||
UNKNOWN_ERR = 0, | ||
DATABASE_ERR = 1, | ||
VERSION_ERR = 2, | ||
TOO_LARGE_ERR = 3, | ||
QUOTA_ERR = 4, | ||
SYNTAX_ERR = 5, | ||
CONSTRAINT_ERR = 6, | ||
TIMEOUT_ERR = 7 | ||
}; | ||
typedef int WebSQLError; | ||
|
||
@interface SQLite : NSObject <RCTBridgeModule> { | ||
NSMutableDictionary *openDBs; | ||
} | ||
|
||
@property (nonatomic, copy) NSMutableDictionary *openDBs; | ||
@property (nonatomic, copy) NSMutableDictionary *appDBPaths; | ||
|
||
// Open / Close | ||
-(void) open: (NSDictionary *) options success:(RCTResponseSenderBlock)success error:(RCTResponseSenderBlock)error; | ||
-(void) close: (NSDictionary *) options success:(RCTResponseSenderBlock)success error:(RCTResponseSenderBlock)error; | ||
-(void) delete: (NSDictionary *) options success:(RCTResponseSenderBlock)success error:(RCTResponseSenderBlock)error; | ||
|
||
// Batch processing interface | ||
-(void) backgroundExecuteSqlBatch: (NSDictionary *) options success:(RCTResponseSenderBlock)success error:(RCTResponseSenderBlock)error; | ||
-(void) executeSqlBatch: (NSDictionary *) options success:(RCTResponseSenderBlock)success error:(RCTResponseSenderBlock)error; | ||
|
||
// Single requests interface | ||
-(void) backgroundExecuteSql:(NSDictionary *) options success:(RCTResponseSenderBlock)success error:(RCTResponseSenderBlock)error; | ||
-(void) executeSql:(NSDictionary *) options success:(RCTResponseSenderBlock)success error:(RCTResponseSenderBlock)error; | ||
|
||
@end |
Oops, something went wrong.