# sqlite-ohos **Repository Path**: HarmonyOS-tpc/sqlite-ohos ## Basic Information - **Project Name**: sqlite-ohos - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2021-09-17 - **Last Updated**: 2023-11-15 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Sqlite Sqlite contains an optimized version of the openharmony database wrapper API native code that along with newer optimized sqlite versions provide better performance than the current database API in generally all cases. # Usage Instructions SQLiteOpenHelper - A helper class to manage database creation and version management * Create a writable database using getWritableDatabase() available in helper class db = SQLiteOpenHelper.getWritableDatabase(); * Create a Table after establishing a database connection with execSQL() API. db.execSQL("CREATE TABLE TABLE_NAME (COL_NAMES & COL_TYPES)"); * Perform CRUD operations using the opened database connection using ValueBucket class ValuesBucket values = new ValuesBucket(); values.putString(COLUMN_AME, VALUE); values.putInteger(COLUMN_AME, VALUE); db.insert(TABLE_NAME, values, whereClause, null); db.update(TABLE_NAME, values, whereClause, null); db.delete(TABLE_NAME, values, whereClause, null); db.close(); # Installation Instructions Prerequisite : 1. Download sqlite-amalgamation from offical website to sqlite3x support. https://sqlite.org/2021/sqlite-amalgamation-3350400.zip 2. Include the sqlite3.c and sqlite3.h files into src/main/cpp/sqlite of sqlite_ohos library module. 1.For using sqlite_ohos module in sample application,include the below library dependency to generate hap/sqlite_ohos.har. Modify entry build.gradle as below : ``` dependencies { implementation project(path: ':sqlite_ohos') } ``` 2.For using sqlite_ohos in separate application, make sure to add "sqlite_ohos.har" in libs folder of "entry" module. Modify entry build.gradle as below : ``` dependencies { implementation fileTree(dir: 'libs', include: ['*.har']) } ``` 3.For using sqlite-ohos from remote repository in separate application, add the below dependency in "entry" build.gradle. Modify entry build.gradle as below : ``` dependencies { implementation 'io.openharmony.tpc.thirdlib:sqlite-ohos:1.0.0' } ``` # License Copyright (C) 2017-2021 requery.io Copyright (C) 2005-2012 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.