同步操作将从 HarmonyOS-TPC/Activeohos 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
Activeohos : Activeohos is an active record style ORM (object relational mapper). What does that mean exactly? Well, Activeohos allows you to save and retrieve SQLite database records without ever writing a single SQL statement. Each database record is wrapped neatly into a class with methods like save() and delete().
Activeohos does so much more than this though. Accessing the database is a hassle, to say the least. Activeohos takes care of all the setup and messy stuff, and all with just a few simple steps of configuration.
The following core classes are the essential interface to Activeohos: ActiveHarmony - Hepls in initializing the database with given configuration Annotation: Manages resolving the @column, @Table annotation Model - Defines the methods for creating, managing the database
The steps to initialize the database and Activeohos: -> make MyApplication(it will change as per your application name) to extends Application class eg: public class MyApplication extends Application {} //This helps in initialization and dispose of the ActiveHarmony
-> Load libsqlcipher.so
SQLiteDatabase.loadLibs(this);
NOTE: Keep application name to "MyApplication"(libsqlcipher.so dependency)
-> Create Class which extends Model class and define the required columns in table. For example:
@Table(name = "Details", id = "_id")
public class Details extends Model {
@Column(name = "Age")
private String age;
@Column(name = "id")
private long id;
}
-> Create new Configuration.Builder object, add the required Model class and set the package name of the sample app
Configuration.Builder configurationBuilder = new Configuration.Builder(this);
configurationBuilder.addModelClasses(Details.class);
configurationBuilder.setPackageName("com.activeharmony.sample"); // use your sample app package name
ActiveHarmony.initialize(configurationBuilder.create());
Please refer the sample app for the CURD operation's
For using Activeohos module in your sample application, add below dependencies in "entry" module to generate hap/har:
Modify entry build.gradle as below :
dependencies {
implementation project(path: ':library')
implementation 'io.openharmony.tpc.thirdlib:ohos-database-sqlcipher:1.0.2'
}
For using Activeohos in separate application, add the below dependencies and include "Activeohos.har" in libs folder of "entry" module :
Modify entry build.gradle as below :
dependencies {
implementation fileTree(dir: 'libs', include: ['*.har'])
implementation 'io.openharmony.tpc.thirdlib:ohos-database-sqlcipher:1.0.2'
}
For using Activeohos from a remote repository in separate application, add the below dependencies : Modify entry build.gradle as below :
dependencies {
implementation 'io.openharmony.tpc.thirdlib:Activeohos:1.0.0'
implementation 'io.openharmony.tpc.thirdlib:ohos-database-sqlcipher:1.0.2'
}
Copyright (C) 2010 Michael Pardo
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.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。