source
stringlengths
14
113
code
stringlengths
10
21.3k
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
// Find all the records that start with "Li" in the NAME column, for example, Lisa. let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.beginsWith("NAME", "Li");
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
// Find all the records that end with "se" in the NAME column, for example, Rose. let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.endsWith("NAME", "se");
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.isNull("NAME");
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.isNotNull("NAME");
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
// Find all the records that are similar to "os" in the NAME column, for example, Rose. let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.like("NAME", "%os%");
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
// Find the strings that match "?h*g" in the NAME column. let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.glob("NAME", "?h*g");
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
// Find the records that are greater than or equal to 10 and less than or equal to 50 in the AGE column. let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.between("AGE", 10, 50);
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
// Find the records that are less than 10 or greater than 50 in the AGE column. let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.notBetween("AGE", 10, 50);
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
// Find all the records that are greater than 18 in the AGE column. let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.greaterThan("AGE", 18);
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
// Find all the records that are less than 20 in the AGE column. let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.lessThan("AGE", 20);
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
// Find all the records that are greater than or equal to 18 in the AGE column. let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.greaterThanOrEqualTo("AGE", 18);
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
// Find all the records that are less than or equal to 20 in the AGE column. let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.lessThanOrEqualTo("AGE", 20);
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.orderByAsc("NAME");
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.orderByDesc("AGE");
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.equalTo("NAME", "Rose").distinct();
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.equalTo("NAME", "Rose").limitAs(3);
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.equalTo("NAME", "Rose").limitAs(-1).offsetAs(3);
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.groupBy(["AGE", "NAME"]);
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.indexedBy("SALARY");
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
// Find records that are within [18, 20] in the AGE column. let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.in("AGE", [18, 20]);
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
// Find the records that are not within [Lisa, Rose] in the NAME column. let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.notIn("NAME", ["Lisa", "Rose"]);
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
// Find the records that do not contain the string "os" in the NAME column, for example, Lisa. let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.notContains("NAME", "os");
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
// Find the records that are not "os" in the NAME column, for example, Rose. let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.notLike("NAME", "os");
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
// Set the RDB store version. import { UIAbility } from '@kit.AbilityKit'; import { BusinessError } from '@kit.BasicServicesKit'; import { window } from '@kit.ArkUI'; let store: relationalStore.RdbStore | undefined = undefined; class EntryAbility extends UIAbility { onWindowStageCreate(windowStage: window.WindowSta...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
let value1 = "Lisa"; let value2 = 18; let value3 = 100.5; let value4 = new Uint8Array([1, 2, 3, 4, 5]); // You can use either of the following: const valueBucket1: relationalStore.ValuesBucket = { 'NAME': value1, 'AGE': value2, 'SALARY': value3, 'CODES': value4 }; const valueBucket2: relationalStore.ValuesBuck...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
let value1 = "Lisa"; let value2 = 18; let value3 = 100.5; let value4 = new Uint8Array([1, 2, 3, 4, 5]); // You can use either of the following: const valueBucket1: relationalStore.ValuesBucket = { 'NAME': value1, 'AGE': value2, 'SALARY': value3, 'CODES': value4 }; const valueBucket2: relationalStore.ValuesBuck...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; let value1 = "Lisa"; let value2 = 18; let value3 = 100.5; let value4 = new Uint8Array([1, 2, 3, 4, 5]); // You can use either of the following: const valueBucket1: relationalStore.ValuesBucket = { 'NAME': value1, 'AGE': value2, 'SALARY': value3, 'CODES': ...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; let value1 = "Lisa"; let value2 = 18; let value3 = 100.5; let value4 = new Uint8Array([1, 2, 3, 4, 5]); // You can use either of the following: const valueBucket1: relationalStore.ValuesBucket = { 'NAME': value1, 'AGE': value2, 'SALARY': value3, 'CODES': ...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; let value1 = "Lisa"; let value2 = 18; let value3 = 100.5; let value4 = new Uint8Array([1, 2, 3, 4, 5]); // You can use either of the following: const valueBucket1: relationalStore.ValuesBucket = { 'NAME': value1, 'AGE': value2, 'SALARY': value3, 'CODES': ...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { sendableRelationalStore } from '@kit.ArkData'; const valuesBucket: relationalStore.ValuesBucket = { "NAME": 'hangman', "AGE": 18, "SALARY": 100.5, "CODES": new Uint8Array([1, 2, 3]) }; const sendableValuesBucket = sendableRelationalStore.toSendableValuesBucket(valuesBucket); if (store != undefined) {...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
let value1 = "Lisa"; let value2 = 18; let value3 = 100.5; let value4 = new Uint8Array([1, 2, 3, 4, 5]); let value5 = "Jack"; let value6 = 19; let value7 = 101.5; let value8 = new Uint8Array([6, 7, 8, 9, 10]); let value9 = "Tom"; let value10 = 20; let value11 = 102.5; let value12 = new Uint8Array([11, 12, 13, 14, 15]); ...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; let value1 = "Lisa"; let value2 = 18; let value3 = 100.5; let value4 = new Uint8Array([1, 2, 3, 4, 5]); let value5 = "Jack"; let value6 = 19; let value7 = 101.5; let value8 = new Uint8Array([6, 7, 8, 9, 10]); let value9 = "Tom"; let value10 = 20; let value11 = 102...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; let value1 = "Lisa"; let value2 = 18; let value3 = 100.5; let value4 = new Uint8Array([1, 2, 3, 4, 5]); let value5 = "Jack"; let value6 = 19; let value7 = 101.5; let value8 = new Uint8Array([6, 7, 8, 9, 10]); let value9 = "Tom"; let value10 = 20; let value11 = 102...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; let value1 = "Lisa"; let value2 = 18; let value3 = 100.5; let value4 = new Uint8Array([1, 2, 3, 4, 5]); let value5 = "Jack"; let value6 = 19; let value7 = 101.5; let value8 = new Uint8Array([6, 7, 8, 9, 10]); let value9 = "Tom"; let value10 = 20; let value11 = 102...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; let value1 = "Lisa"; let value2 = 18; let value3 = 100.5; let value4 = new Uint8Array([1, 2, 3, 4, 5]); let value5 = "Jack"; let value6 = 19; let value7 = 101.5; let value8 = new Uint8Array([6, 7, 8, 9, 10]); let value9 = "Tom"; let value10 = 20; let value11 = 102...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
let value1 = "Rose"; let value2 = 22; let value3 = 200.5; let value4 = new Uint8Array([1, 2, 3, 4, 5]); // You can use either of the following: const valueBucket1: relationalStore.ValuesBucket = { 'NAME': value1, 'AGE': value2, 'SALARY': value3, 'CODES': value4 }; const valueBucket2: relationalStore.ValuesBuck...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
let value1 = "Rose"; let value2 = 22; let value3 = 200.5; let value4 = new Uint8Array([1, 2, 3, 4, 5]); // You can use either of the following: const valueBucket1: relationalStore.ValuesBucket = { 'NAME': value1, 'AGE': value2, 'SALARY': value3, 'CODES': value4 }; const valueBucket2: relationalStore.ValuesBuck...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; let value1 = "Rose"; let value2 = 22; let value3 = 200.5; let value4 = new Uint8Array([1, 2, 3, 4, 5]); // You can use either of the following: const valueBucket1: relationalStore.ValuesBucket = { 'NAME': value1, 'AGE': value2, 'SALARY': value3, 'CODES': ...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; let value1 = "Rose"; let value2 = 22; let value3 = 200.5; let value4 = new Uint8Array([1, 2, 3, 4, 5]); // You can use either of the following: const valueBucket1: relationalStore.ValuesBucket = { 'NAME': value1, 'AGE': value2, 'SALARY': value3, 'CODES': ...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; let value1 = "Rose"; let value2 = 22; let value3 = 200.5; let value4 = new Uint8Array([1, 2, 3, 4, 5]); // You can use either of the following: const valueBucket1: relationalStore.ValuesBucket = { 'NAME': value1, 'AGE': value2, 'SALARY': value3, 'CODES': ...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.equalTo("NAME", "Lisa"); if (store != undefined) { (store as relationalStore.RdbStore).delete(predicates, (err, rows) => { if (err) { console.error(`Delete failed, code is ${err.code},message is ${err.message}`); return; } ...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.equalTo("NAME", "Lisa"); if (store != undefined) { (store as relationalStore.RdbStore).delete(predicates).then((rows: Number) => { console.info(`Delete rows: ${rows}`); }).catch((er...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.equalTo("NAME", "Lisa"); if (store != undefined) { try { let rows: Number = (store as relationalStore.RdbStore).deleteSync(predicates); console.info(`Delete rows: ${rows}`); } c...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.equalTo("NAME", "Rose"); if (store != undefined) { (store as relationalStore.RdbStore).query(predicates, async (err, resultSet) => { if (err) { console.error(`Query failed, code is ${err.code},message is ${err.message}`); retur...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.equalTo("NAME", "Rose"); if (store != undefined) { (store as relationalStore.RdbStore).query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"], async (err, resultSet) => { if (err) { console.error(`Query failed, code is ${err.code...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.equalTo("NAME", "Rose"); if (store != undefined) { (store as relationalStore.RdbStore).query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]).then(async (resultSet: relationalStore.R...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.equalTo("NAME", "Rose"); if (store != undefined) { try { let resultSet: relationalStore.ResultSet = (store as relationalStore.RdbStore).querySync(predicates, ["ID", "NAME", "AGE", "SA...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { distributedDeviceManager } from '@kit.DistributedServiceKit'; import { BusinessError } from '@kit.BasicServicesKit'; let dmInstance: distributedDeviceManager.DeviceManager; let deviceId: string | undefined = undefined; try { dmInstance = distributedDeviceManager.createDeviceManager("com.example.appdatamgrv...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { distributedDeviceManager } from '@kit.DistributedServiceKit'; import { BusinessError } from '@kit.BasicServicesKit'; let dmInstance: distributedDeviceManager.DeviceManager; let deviceId: string | undefined = undefined; try { dmInstance = distributedDeviceManager.createDeviceManager("com.example.appdatamgrv...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
if (store != undefined) { (store as relationalStore.RdbStore).querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = 'sanguo'", async (err, resultSet) => { if (err) { console.error(`Query failed, code is ${err.code},message is ${err.message}`); return; } console.info(`ResultSet col...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
// <-> means to calculate vector similarity, and <=> means to calculate the cosine distance. const querySql = "select id, repr <-> '[1.5,5.6]' as distance from test ORDER BY repr <-> '[1.5,5.6]' limit 10 offset 1;"; let resultSet = await store.querySql(querySql); // Aggregate query. GROUP BY supports multiple columns....
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
if (store != undefined) { (store as relationalStore.RdbStore).querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = ?", ['sanguo'], async (err, resultSet) => { if (err) { console.error(`Query failed, code is ${err.code},message is ${err.message}`); return; } console.info(`ResultSe...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; if (store != undefined) { (store as relationalStore.RdbStore).querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = 'sanguo'").then(async (resultSet: relationalStore.ResultSet) => { console.info(`ResultSet column names: ${resultSet.columnNames},...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
// Query the top 10 records with ID of 1 and the similarity to [1.5, 2.5] is less than 0.5, and sort them in ascending order by similarity. const querySql = "select id, repr <-> ? as distance from test where id = ? and repr <-> ? < 0.5 ORDER BY repr <-> ? limit 10;"; const vectorValue: Float32Array = new Float32Array([...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; if (store != undefined) { try { let resultSet: relationalStore.ResultSet = (store as relationalStore.RdbStore).querySqlSync("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = 'sanguo'"); console.info(`ResultSet column names: ${resultSet.columnName...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
const SQL_DELETE_TABLE = "DELETE FROM test WHERE name = 'zhangsan'"; if (store != undefined) { (store as relationalStore.RdbStore).executeSql(SQL_DELETE_TABLE, (err) => { if (err) { console.error(`ExecuteSql failed, code is ${err.code},message is ${err.message}`); return; } console.info('Delet...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
const SQL_DELETE_TABLE = "DELETE FROM test WHERE name = ?"; if (store != undefined) { (store as relationalStore.RdbStore).executeSql(SQL_DELETE_TABLE, ['zhangsan'], (err) => { if (err) { console.error(`ExecuteSql failed, code is ${err.code},message is ${err.message}`); return; } console.info('...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; const SQL_DELETE_TABLE = "DELETE FROM test WHERE name = 'zhangsan'"; if (store != undefined) { (store as relationalStore.RdbStore).executeSql(SQL_DELETE_TABLE).then(() => { console.info('Delete table done.'); }).catch((err: BusinessError) => { console....
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; // Check the RDB store integrity. if (store != undefined) { const SQL_CHECK_INTEGRITY = 'PRAGMA integrity_check'; (store as relationalStore.RdbStore).execute(SQL_CHECK_INTEGRITY).then((data) => { console.info(`check result: ${data}`); }).catch((err: Busi...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
// FLOATVECTOR(2) is a vector property with a dimension of 2. The subsequent repr operation should be performed based on this dimension. let createSql = "CREATE TABLE test (ID INTEGER PRIMARY KEY,REPR FLOATVECTOR(2));"; // Create a table. await store!.execute(createSql); // Insert data using parameter binding. let inse...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; if (store != null) { let txId: number; (store as relationalStore.RdbStore).beginTrans().then((txId: number) => { (store as relationalStore.RdbStore).execute("DELETE FROM TEST WHERE age = ? OR age = ?", txId, ["18", "20"]) .then(() => { (store ...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; // Check the RDB store integrity. if (store != undefined) { const SQL_CHECK_INTEGRITY = 'PRAGMA integrity_check'; try { let data = (store as relationalStore.RdbStore).executeSync(SQL_CHECK_INTEGRITY); console.info(`check result: ${data}`); } catch (e...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
let PRIKey = [1, 4, 2, 3]; if (store != undefined) { (store as relationalStore.RdbStore).getModifyTime("EMPLOYEE", "NAME", PRIKey, (err, modifyTime: relationalStore.ModifyTime) => { if (err) { console.error(`getModifyTime failed, code is ${err.code},message is ${err.message}`); return; } let s...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; let PRIKey = [1, 2, 3]; if (store != undefined) { (store as relationalStore.RdbStore).getModifyTime("EMPLOYEE", "NAME", PRIKey) .then((modifyTime: relationalStore.ModifyTime) => { let size = modifyTime.size; }) .catch((err: BusinessError) => { ...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
let value1 = "Lisa"; let value2 = 18; let value3 = 100.5; let value4 = new Uint8Array([1, 2, 3]); if (store != undefined) { (store as relationalStore.RdbStore).beginTransaction(); const valueBucket: relationalStore.ValuesBucket = { 'NAME': value1, 'AGE': value2, 'SALARY': value3, 'CODES': value4 ...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; if (store != null) { let txId: number; (store as relationalStore.RdbStore).beginTrans().then((txId: number) => { (store as relationalStore.RdbStore).execute("DELETE FROM TEST WHERE age = ? OR age = ?", txId, ["18", "20"]) .then(() => { (store ...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; if (store != undefined) { (store as relationalStore.RdbStore).createTransaction().then((transaction: relationalStore.Transaction) => { transaction.execute("DELETE FROM test WHERE age = ? OR age = ?", [21, 20]).then(() => { transaction.commit(); })....
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
let value1 = "Lisa"; let value2 = 18; let value3 = 100.5; let value4 = new Uint8Array([1, 2, 3]); if (store != undefined) { (store as relationalStore.RdbStore).beginTransaction(); const valueBucket: relationalStore.ValuesBucket = { 'NAME': value1, 'AGE': value2, 'SALARY': value3, 'CODES': value4 ...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; if (store != null) { let txId: number; (store as relationalStore.RdbStore).beginTrans().then((txId: number) => { (store as relationalStore.RdbStore).execute("DELETE FROM TEST WHERE age = ? OR age = ?", txId, ["18", "20"]) .then(() => { (store ...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; let value1 = "Lisa"; let value2 = 18; let value3 = 100.5; let value4 = new Uint8Array([1, 2, 3]); if (store != undefined) { try { (store as relationalStore.RdbStore).beginTransaction(); const valueBucket: relationalStore.ValuesBucket = { 'NAME': v...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; if (store != null) { let txId: number; (store as relationalStore.RdbStore).beginTrans().then((txId: number) => { (store as relationalStore.RdbStore).execute("DELETE FROM TEST WHERE age = ? OR age = ?", txId, ["18", "20"]) .then(() => { (store ...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
if (store != undefined) { (store as relationalStore.RdbStore).backup("dbBackup.db", (err) => { if (err) { console.error(`Backup failed, code is ${err.code},message is ${err.message}`); return; } console.info('Backup success.'); }); }
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; if (store != undefined) { let promiseBackup = (store as relationalStore.RdbStore).backup("dbBackup.db"); promiseBackup.then(() => { console.info('Backup success.'); }).catch((err: BusinessError) => { console.error(`Backup failed, code is ${err.code},...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
if (store != undefined) { (store as relationalStore.RdbStore).restore("dbBackup.db", (err) => { if (err) { console.error(`Restore failed, code is ${err.code},message is ${err.message}`); return; } console.info('Restore success.'); }); }
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; if (store != undefined) { let promiseRestore = (store as relationalStore.RdbStore).restore("dbBackup.db"); promiseRestore.then(() => { console.info('Restore success.'); }).catch((err: BusinessError) => { console.error(`Restore failed, code is ${err.c...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
if (store != undefined) { (store as relationalStore.RdbStore).setDistributedTables(["EMPLOYEE"], (err) => { if (err) { console.error(`SetDistributedTables failed, code is ${err.code},message is ${err.message}`); return; } console.info('SetDistributedTables successfully.'); }); }
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; if (store != undefined) { (store as relationalStore.RdbStore).setDistributedTables(["EMPLOYEE"]).then(() => { console.info('SetDistributedTables successfully.'); }).catch((err: BusinessError) => { console.error(`SetDistributedTables failed, code is ${e...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
if (store != undefined) { (store as relationalStore.RdbStore).setDistributedTables(["EMPLOYEE"], relationalStore.DistributedType.DISTRIBUTED_CLOUD, (err) => { if (err) { console.error(`SetDistributedTables failed, code is ${err.code},message is ${err.message}`); return; } console.info('SetDist...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
if (store != undefined) { (store as relationalStore.RdbStore).setDistributedTables(["EMPLOYEE"], relationalStore.DistributedType.DISTRIBUTED_CLOUD, { autoSync: true }, (err) => { if (err) { console.error(`SetDistributedTables failed, code is ${err.code},message is ${err.message}`); return; }...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; if (store != undefined) { (store as relationalStore.RdbStore).setDistributedTables(["EMPLOYEE"], relationalStore.DistributedType.DISTRIBUTED_CLOUD, { autoSync: true }).then(() => { console.info('SetDistributedTables successfully.'); }).catch((err: Bu...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { distributedDeviceManager } from '@kit.DistributedServiceKit'; import { BusinessError } from '@kit.BasicServicesKit'; let dmInstance: distributedDeviceManager.DeviceManager; let deviceId: string | undefined = undefined; try { dmInstance = distributedDeviceManager.createDeviceManager("com.example.appdatamgrv...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { distributedDeviceManager } from '@kit.DistributedServiceKit'; import { BusinessError } from '@kit.BasicServicesKit'; let dmInstance: distributedDeviceManager.DeviceManager; let deviceId: string | undefined = undefined; try { dmInstance = distributedDeviceManager.createDeviceManager("com.example.appdatamgrv...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { distributedDeviceManager } from '@kit.DistributedServiceKit'; import { BusinessError } from '@kit.BasicServicesKit'; let dmInstance: distributedDeviceManager.DeviceManager; let deviceIds: Array<string> = []; try { dmInstance = distributedDeviceManager.createDeviceManager("com.example.appdatamgrverify"); ...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { distributedDeviceManager } from '@kit.DistributedServiceKit'; import { BusinessError } from '@kit.BasicServicesKit'; let dmInstance: distributedDeviceManager.DeviceManager; let deviceIds: Array<string> = []; try { dmInstance = distributedDeviceManager.createDeviceManager("com.example.appdatamgrverify"); ...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
if (store != undefined) { (store as relationalStore.RdbStore).cloudSync(relationalStore.SyncMode.SYNC_MODE_CLOUD_FIRST, (progressDetails) => { console.info(`Progess: ${progressDetails}`); }, (err) => { if (err) { console.error(`Cloud sync failed, code is ${err.code},message is ${err.message}`); ...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; if (store != undefined) { (store as relationalStore.RdbStore).cloudSync(relationalStore.SyncMode.SYNC_MODE_CLOUD_FIRST, (progressDetail: relationalStore.ProgressDetails) => { console.info(`progress: ${progressDetail}`); }).then(() => { console.info('Cl...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
const tables = ["table1", "table2"]; if (store != undefined) { (store as relationalStore.RdbStore).cloudSync(relationalStore.SyncMode.SYNC_MODE_CLOUD_FIRST, tables, (progressDetail: relationalStore.ProgressDetails) => { console.info(`Progess: ${progressDetail}`); }, (err) => { if (err) { console.erro...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; const tables = ["table1", "table2"]; if (store != undefined) { (store as relationalStore.RdbStore).cloudSync(relationalStore.SyncMode.SYNC_MODE_CLOUD_FIRST, tables, (progressDetail: relationalStore.ProgressDetails) => { console.info(`progress: ${progressDet...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { distributedDeviceManager } from '@kit.DistributedServiceKit'; import { BusinessError } from '@kit.BasicServicesKit'; let storeObserver = (devices: Array<string>) => { if (devices != undefined) { for (let i = 0; i < devices.length; i++) { console.info(`device= ${devices[i]} data changed`); } ...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { distributedDeviceManager } from '@kit.DistributedServiceKit'; import { BusinessError } from '@kit.BasicServicesKit'; let storeObserver = (devices: Array<string>) => { if (devices != undefined) { for (let i = 0; i < devices.length; i++) { console.info(`device= ${devices[i]} data changed`); } ...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; let changeInfos = (changeInfos: Array<relationalStore.ChangeInfo>) => { for (let i = 0; i < changeInfos.length; i++) { console.info(`changeInfos = ${changeInfos[i]}`); } }; try { if (store != undefined) { (store as relationalStore.RdbStore).on('data...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; let storeObserver = () => { console.info(`storeObserver`); }; try { if (store != undefined) { (store as relationalStore.RdbStore).on('storeObserver', false, storeObserver); } } catch (err) { let code = (err as BusinessError).code; let message = (err...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; let progressDetail = (progressDetail: relationalStore.ProgressDetails) => { console.info(`progress: ${progressDetail}`); }; try { if (store != undefined) { (store as relationalStore.RdbStore).on('autoSyncProgress', progressDetail); } } catch (err) { l...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; let sqlExecutionInfo = (sqlExecutionInfo: relationalStore.SqlExecutionInfo) => { console.info(`sql: ${sqlExecutionInfo.sql[0]}`); console.info(`totalTime: ${sqlExecutionInfo.totalTime}`); console.info(`waitTime: ${sqlExecutionInfo.waitTime}`); console.info...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; let storeObserver = (devices: Array<string>) => { if (devices != undefined) { for (let i = 0; i < devices.length; i++) { console.info(`device= ${devices[i]} data changed`); } } }; try { if (store != undefined) { // The Lambda expression ca...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { distributedDeviceManager } from '@kit.DistributedServiceKit'; import { BusinessError } from '@kit.BasicServicesKit'; let storeObserver = (devices: Array<string>) => { if (devices != undefined) { for (let i = 0; i < devices.length; i++) { console.info(`device= ${devices[i]} data changed`); } ...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; let storeObserver = () => { console.info(`storeObserver`); }; try { if (store != undefined) { (store as relationalStore.RdbStore).on('storeObserver', false, storeObserver); } } catch (err) { let code = (err as BusinessError).code; let message = (err...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; let progressDetail = (progressDetail: relationalStore.ProgressDetails) => { console.info(`progress: ${progressDetail}`); }; try { if (store != undefined) { (store as relationalStore.RdbStore).on('autoSyncProgress', progressDetail); } } catch (err) { l...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
import { BusinessError } from '@kit.BasicServicesKit'; try { if (store != undefined) { (store as relationalStore.RdbStore).off('statistics'); } } catch (err) { let code = (err as BusinessError).code; let message = (err as BusinessError).message; console.error(`Unregister observer failed, code is ${code},...
application-dev\reference\apis-arkdata\js-apis-data-relationalStore.md
if (store != undefined) { (store as relationalStore.RdbStore).emit('storeObserver'); }