<commit_before>android-sqlite-generator
========================

# What

This compiler will generate you db class, content provider and several helper class for you from a describing file. You can set several options like package name, database name, database version, content authority and others.

# Download

You can find releases here on [GitHub][3].

# How to run

	java -jar <generator>.jar --in=<folder of json files> --config=<path to config json> --out=<output folder>


Run the above command. There are only 2 parameters.

- **in** : folder which contains json files that describe the database
- **out** : path to put generated files. Please note that packagename will be used to generate subfolders
- **config** : a json file which holds the configuration of the database. It can reside in the specified "**in**" folder.

Don't forget to add the content provider to the AndroidManifest.

```xml
<provider android:name="PACKAGE.NAMEDB" android:authorities="AUTHORITY">
```

# Generated Classes

By default, the following files will be generated.
#####[name]DB.java
- This is the main database. It extends `SQLiteOpenHelper` and contains all necessary code for maintaining the database and column names and positions.

#####[contentprovidername].java
- This class is the content provider to use. It's your run of the mill android `ContentProvider`.

#####[contentprovidername]Client.java
- The client provides easy access to CRUD operations on any described table. Below are the methods provided

```
- get[tablename]With[Unique]
- getAll[tablename]
- add[tablename]
- remove[tablename]With[Unique]
- removeAll[tablename]
- update[tablename]
- removee[tablename]With[Unique]
```

#####[contentprovidername]BatchClient.java
- The batch client works the same as above, but is used for batched `ContentProviderOperation`. It contains methods to easily start a batch of `ContentProviderOperation` and commit it with the correct authority. It contains basically the same methods as above.
<commit_msg>Included Gradle instructions<commit_after>android-sqlite-generator
========================

# What

This compiler will generate you db class, content provider and several helper class for you from a describing file. You can set several options like package name, database name, database version, content authority and others.

# Download

You can find releases here on [GitHub][3].

# How to run

	java -jar <generator>.jar --in=<folder of json files> --config=<path to config json> --out=<output folder>


Run the above command. There are only 2 parameters.

- **in** : folder which contains json files that describe the database
- **out** : path to put generated files. Please note that packagename will be used to generate subfolders
- **config** : a json file which holds the configuration of the database. It can reside in the specified "**in**" folder.

Don't forget to add the content provider to the AndroidManifest.

```xml
<provider android:name="PACKAGE.NAMEDB" android:authorities="AUTHORITY">
```

### Gradle configuration

On Android Studio, you can use Gradle to generate files. Just put downloaded sqlitegenerator.jar on your app/libs folder and create a new task on build.gradle:

```groovy
task generateDb(type: Exec){
    def config="libs/db.json"
    def definitions="libs/tables"
    def out="build/generated/source/buildConfig/debug/"

    commandLine 'java', '-jar', 'libs/sqlitegenerator.jar','--in=' + definitions \
    , '--config=' +  config, '--out=' + out
}

preBuild.dependsOn generateDb
```

# Generated Classes

By default, the following files will be generated.
#####[name]DB.java
- This is the main database. It extends `SQLiteOpenHelper` and contains all necessary code for maintaining the database and column names and positions.

#####[contentprovidername].java
- This class is the content provider to use. It's your run of the mill android `ContentProvider`.

#####[contentprovidername]Client.java
- The client provides easy access to CRUD operations on any described table. Below are the methods provided

```
- get[tablename]With[Unique]
- getAll[tablename]
- add[tablename]
- remove[tablename]With[Unique]
- removeAll[tablename]
- update[tablename]
- removee[tablename]With[Unique]
```

#####[contentprovidername]BatchClient.java
- The batch client works the same as above, but is used for batched `ContentProviderOperation`. It contains methods to easily start a batch of `ContentProviderOperation` and commit it with the correct authority. It contains basically the same methods as above.

{'fraction_non_alphanumeric': 0.1037673496364838, 'fraction_numerical': 0.0008812513769552765, 'mean_word_length': 4.850515463917525, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5841815', 'n_tokens_mistral': 1217, 'n_tokens_neox': 1180, 'n_words': 538}