<commit_before># react-native-sqlite

A binding for sqlite3 for React Native. Allows a database to be opened and for SQL queries to be run on it.

Really early version right now, the API might change and I'm still figuring out the best way to do things with React Native.

Written by <NAME>
([almostobsolete.net](http://almostobsolete.net) and
[tomparslow.co.uk](http://tomparslow.co.uk)) as part of Active Inbox
([activeinboxhq.com](http://activeinboxhq.com/)).

## Installation

Install using npm with `npm install --save react-native-sqlite`

You then need to add the Objective C part to your XCode project. Drag
`AIBSQLite.xcodeproj` from the `node_modules/react-native-sqlite` folder into your XCode projec. Click on the your project in XCode, goto `Build Phases` then `Link Binary With Libraries` and add `libAIBSQLite.a` and `libsqlite3.dylib`.

NOTE: Make sure you don't have the `AIBSQLite` project open seperately in XCode otherwise it won't work.

## Usage

```javascript
var sqlite = require('./react-native-sqlite');
sqlite.open("filename.sqlite", function (error, database) {
  if (error) {
    console.log("Failed to open database:", error);
    return;
  }
  var sql = "SELECT a, b FROM table WHERE field=? AND otherfield=?";
  var params = ["somestring", 99];
  database.executeSQL(sql, params, rowCallback, completeCallback);<commit_msg>Fixed the require line which imports react-native-sqlite in the README.md example<commit_after># react-native-sqlite

A binding for sqlite3 for React Native. Allows a database to be opened and for SQL queries to be run on it.

Really early version right now, the API might change and I'm still figuring out the best way to do things with React Native.

Written by <NAME>
([almostobsolete.net](http://almostobsolete.net) and
[tomparslow.co.uk](http://tomparslow.co.uk)) as part of Active Inbox
([activeinboxhq.com](http://activeinboxhq.com/)).

## Installation

Install using npm with `npm install --save react-native-sqlite`

You then need to add the Objective C part to your XCode project. Drag
`AIBSQLite.xcodeproj` from the `node_modules/react-native-sqlite` folder into your XCode projec. Click on the your project in XCode, goto `Build Phases` then `Link Binary With Libraries` and add `libAIBSQLite.a` and `libsqlite3.dylib`.

NOTE: Make sure you don't have the `AIBSQLite` project open seperately in XCode otherwise it won't work.

## Usage

```javascript
var sqlite = require('react-native-sqlite');
sqlite.open("filename.sqlite", function (error, database) {
  if (error) {
    console.log("Failed to open database:", error);
    return;
  }
  var sql = "SELECT a, b FROM table WHERE field=? AND otherfield=?";
  var params = ["somestring", 99];
  database.executeSQL(sql, params, rowCallback, completeCallback);
{'fraction_non_alphanumeric': 0.10482708933717579, 'fraction_numerical': 0.002881844380403458, 'mean_word_length': 4.6214574898785425, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1706269', 'n_tokens_mistral': 879, 'n_tokens_neox': 846, 'n_words': 337}