Home
last modified time | relevance | path

Searched refs:sql (Results 1 – 25 of 133) sorted by relevance

123456

/foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb/storage/src/sqlite/
Dsqlite_query_helper.cpp89 std::string sql = "SELECT b.data_key," in GetSelectAndFromClauseForRDB() local
97 sql += "a.*"; in GetSelectAndFromClauseForRDB()
100 sql += "a.'" + fieldName + "',"; in GetSelectAndFromClauseForRDB()
102 sql.pop_back(); in GetSelectAndFromClauseForRDB()
104sql += " FROM '" + tableName + "' AS a INNER JOIN " + DBConstant::RELATIONAL_PREFIX + tableName + … in GetSelectAndFromClauseForRDB()
106 return sql; in GetSelectAndFromClauseForRDB()
289 int SqliteQueryHelper::GetQuerySql(std::string &sql, bool onlyRowid) in GetQuerySql() argument
296 sql = AssembleSqlForSuggestIndex(querySqlForUse, FILTER_NATIVE_DATA_SQL); in GetQuerySql()
297 sql = !hasPrefixKey_ ? sql : (sql + " AND (key>=? AND key<=?) "); in GetQuerySql()
298 sql = keys_.empty() ? sql : (sql + " AND " + MapKeysInToSql(keys_.size())); in GetQuerySql()
[all …]
Dsqlite_single_ver_relational_storage_extend_executor.cpp43 …std::string sql = "select a.data_key, a.device, a.ori_device, a.timestamp, a.wtimestamp, a.flag, a… in GetQueryInfoSql() local
46 sql += ", b." + field.colName; in GetQueryInfoSql()
49 sql += ", b." + pk; in GetQueryInfoSql()
51sql += " from '" + DBCommon::GetLogTableName(tableName) + "' AS a LEFT JOIN '" + tableName + "' AS… in GetQueryInfoSql()
52 sql += " ON (a.data_key = b.rowid) WHERE "; in GetQueryInfoSql()
54 sql += " a.cloud_gid = ? or "; in GetQueryInfoSql()
56 sql += "a.hash_key = ?"; in GetQueryInfoSql()
57 querySql = sql; in GetQueryInfoSql()
64 std::string sql = "UPDATE " + tableName + " SET "; in GetFillDownloadAssetStatement() local
66 sql += field.colName + " = ?,"; in GetFillDownloadAssetStatement()
[all …]
Dsplit_device_log_table_manager.cpp23 std::string sql; in CalcPrimaryKeyHash() local
25 sql = "calc_hash(" + references + "'" + table.GetPrimaryKey().at(0) + "')"; in CalcPrimaryKeyHash()
27 sql = "calc_hash("; in CalcPrimaryKeyHash()
29 sql += "calc_hash(" + references + "'" + it.second + "')||"; in CalcPrimaryKeyHash()
31 sql.pop_back(); in CalcPrimaryKeyHash()
32 sql.pop_back(); in CalcPrimaryKeyHash()
33 sql += ")"; in CalcPrimaryKeyHash()
35 return sql; in CalcPrimaryKeyHash()
Dcollaboration_log_table_manager.cpp28 std::string sql; in CalcPrimaryKeyHash() local
30 sql = "calc_hash('" + identity + "'||calc_hash(" + references + "rowid))"; in CalcPrimaryKeyHash()
33 sql = "calc_hash(" + references + "'" + table.GetIdentifyKey().at(0) + "')"; in CalcPrimaryKeyHash()
35 sql = "calc_hash("; in CalcPrimaryKeyHash()
37 sql += "calc_hash(" + references + "'" + it + "')||"; in CalcPrimaryKeyHash()
39 sql.pop_back(); in CalcPrimaryKeyHash()
40 sql.pop_back(); in CalcPrimaryKeyHash()
41 sql += ")"; in CalcPrimaryKeyHash()
44 return sql; in CalcPrimaryKeyHash()
Dcloud_sync_log_table_manager.cpp23 std::string sql; in CalcPrimaryKeyHash() local
25 sql = "calc_hash(" + references + "'" + table.GetPrimaryKey().at(0) + "')"; in CalcPrimaryKeyHash()
31 sql = "calc_hash("; in CalcPrimaryKeyHash()
33 sql += "calc_hash(" + references + "'" + it + "')||"; in CalcPrimaryKeyHash()
35 sql.pop_back(); in CalcPrimaryKeyHash()
36 sql.pop_back(); in CalcPrimaryKeyHash()
37 sql += ")"; in CalcPrimaryKeyHash()
39 return sql; in CalcPrimaryKeyHash()
Dsqlite_single_ver_storage_executor_cache.cpp102 std::string sql = (executorState_ == ExecutorState::MAIN_ATTACH_CACHE) ? in RemoveDeviceDataInCacheMode() local
104 errCode = SQLiteUtils::GetStatement(dbHandle_, sql, statement); in RemoveDeviceDataInCacheMode()
129 std::string sql; in GetMinVersionCacheData() local
131 sql = MIGRATE_SELECT_MIN_VER_CACHEDATA_FROM_MAINHANDLE; in GetMinVersionCacheData()
133 sql = MIGRATE_SELECT_MIN_VER_CACHEDATA_FROM_CACHEHANDLE; in GetMinVersionCacheData()
139 int errCode = SQLiteUtils::GetStatement(dbHandle_, sql, statement); in GetMinVersionCacheData()
161 std::string sql; in MigrateRmDevData() local
163 sql = dataItem.value.empty() ? REMOVE_ALL_DEV_DATA_SQL : REMOVE_DEV_DATA_SQL; in MigrateRmDevData()
165sql = dataItem.value.empty() ? REMOVE_ALL_DEV_DATA_SQL_FROM_CACHEHANDLE: REMOVE_DEV_DATA_SQL_FROM_… in MigrateRmDevData()
171 int errCode = SQLiteUtils::GetStatement(dbHandle_, sql, statement); in MigrateRmDevData()
[all …]
Dsqlite_query_helper.h74 int GetQuerySqlStatement(sqlite3 *dbHandle, const std::string &sql, sqlite3_stmt *&statement);
79 int GetSyncDataCheckSql(std::string &sql);
88 int GetQuerySql(std::string &sql, bool onlyRowid);
89 int GetCountQuerySql(std::string &sql);
96 int GetRelationalMissQuerySql(const std::vector<std::string> &fieldNames, std::string &sql);
99 …int GetRelationalSyncDataQuerySql(std::string &sql, bool hasSubQuery, const std::vector<std::strin…
100 …tRelationalSyncDataQuerySqlWithLimit(const std::vector<std::string> &fieldNames, std::string &sql);
122 int GetSyncDataQuerySql(std::string &sql, bool hasSubQuery);
Dsqlite_log_table_manager.cpp25 for (const auto &sql : sqls) { in AddRelationalLogTableTrigger() local
26 int errCode = SQLiteUtils::ExecuteRawSQL(db, sql); in AddRelationalLogTableTrigger()
54 for (const auto &sql : logTableSchema) { in CreateRelationalLogTable() local
55 int errCode = SQLiteUtils::ExecuteRawSQL(db, sql); in CreateRelationalLogTable()
/foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb/test/unittest/common/interfaces/
Ddistributeddb_cloud_interfaces_relational_ext_test.cpp93 const std::string sql = "select get_raw_sys_time();"; variable
99 errCode = RelationalTestUtils::ExecSql(db, sql, nullptr, [curTime] (sqlite3_stmt *stmt) { in __anonc168eff30202()
116 std::string sql; in PrepareData() local
118 sql = "create table " + tableName + "(rowid INTEGER primary key, id int, name TEXT);"; in PrepareData()
120sql = "create table " + tableName + "(rowid int, id int, name TEXT, PRIMARY KEY(id, name));"; in PrepareData()
123 EXPECT_EQ(RelationalTestUtils::ExecSql(db, sql), E_OK); in PrepareData()
161 std::string sql = "insert into " + tableName + " VALUES(2, 1, 'zhangsan');"; variable
162 EXPECT_EQ(RelationalTestUtils::ExecSql(db, sql), E_OK);
168 sql = "select * from " + DBConstant::RELATIONAL_PREFIX + tableName + "_log;";
174 …errCode = RelationalTestUtils::ExecSql(db, sql, nullptr, [curTime, &resultCount] (sqlite3_stmt *st… in __anonc168eff30302()
[all …]
/foundation/multimedia/media_library/frameworks/innerkitsimpl/medialibrary_data_extension/src/
Dmedialibrary_file_operations.cpp316 static void BuildQueryColumns(const vector<string> &columns, string &sql) in BuildQueryColumns() argument
319 sql += col + ','; in BuildQueryColumns()
321 sql.pop_back(); // Remove last ',' in BuildQueryColumns()
387 vector<string> &selectionArgs, string &sql) in BuildCompatQuerySql() argument
389 sql += "SELECT "; in BuildCompatQuerySql()
390 BuildQueryColumns(columns, sql); in BuildCompatQuerySql()
391 sql += " FROM " + table; in BuildCompatQuerySql()
402 sql += " WHERE " + whereClause; in BuildCompatQuerySql()
423 static void BuildQueryFileSql(MediaLibraryCommand &cmd, vector<string> &selectionArgs, string &sql) in BuildQueryFileSql() argument
430 sql = "SELECT "; in BuildQueryFileSql()
[all …]
/foundation/distributeddatamgr/relational_store/frameworks/native/rdb/src/
Dsqlite_sql_builder.cpp41 std::string sql; in BuildDeleteString() local
42 sql.append("Delete ").append("FROM ").append(tableName).append( in BuildDeleteString()
44 return sql; in BuildDeleteString()
55 std::string sql; in BuildUpdateString() local
57 sql.append("UPDATE") in BuildUpdateString()
64 sql.append(split); in BuildUpdateString()
65 sql.append(key).append("=?"); in BuildUpdateString()
75 sql.append(BuildSqlStringFromPredicates(index, whereClause, group, order, limit, offset)); in BuildUpdateString()
76 return sql; in BuildUpdateString()
90 std::string sql; in BuildQueryString() local
[all …]
Drdb_store_impl.cpp143 std::string sql; in GetModifyTime() local
144 sql.append("select hash_key, timestamp/10000 from "); in GetModifyTime()
145 sql.append(logTable); in GetModifyTime()
146 sql.append(" where hash_key in ("); in GetModifyTime()
147 sql.append(GetSqlArgs(hashKeys.size())); in GetModifyTime()
148 sql.append(")"); in GetModifyTime()
149 auto resultSet = QueryByStep(sql, hashKeys); in GetModifyTime()
170 std::string sql; in GetModifyTimeByRowId() local
171 sql.append("select data_key, timestamp/10000 from "); in GetModifyTimeByRowId()
172 sql.append(logTable); in GetModifyTimeByRowId()
[all …]
/foundation/communication/netmanager_base/services/netstatsmanager/src/
Dnet_stats_database_helper.cpp71 int32_t NetStatsDatabaseHelper::ExecSql(const std::string &sql, void *recv, SqlCallback callback) in ExecSql() argument
74 int32_t ret = sqlite3_exec(sqlite_, sql.c_str(), callback, recv, &errMsg); in ExecSql()
75 NETMGR_LOG_D("EXEC SQL : %{public}s", sql.c_str()); in ExecSql()
85 std::string sql = "CREATE TABLE IF NOT EXISTS " + tableName + "(" + tableInfo + ");"; in CreateTable() local
86 int32_t ret = ExecSql(sql, nullptr, sqlCallback); in CreateTable()
111 …std::string sql = "INSERT INTO " + tableName + " (" + paramList + ") " + "VALUES" + " (" + params … in InsertData() local
112 int32_t ret = statement_.Prepare(sqlite_, sql); in InsertData()
141 …std::string sql = "SELECT * FROM " + tableName + " t WHERE 1=1 AND t.Date >= ?" + " AND t.Date <= … in SelectData() local
142 int32_t ret = statement_.Prepare(sqlite_, sql); in SelectData()
165 …std::string sql = "SELECT * FROM " + std::string(UID_TABLE) + " t WHERE 1=1 AND t.UID == ?" + " AN… in SelectData() local
[all …]
/foundation/distributeddatamgr/relational_store/frameworks/native/rdb/include/
Dsqlite_connection.h37 int Prepare(const std::string &sql, bool &outIsReadOnly);
38 int PrepareAndGetInfo(const std::string &sql, bool &outIsReadOnly, int &numParameters,
40 …int ExecuteSql(const std::string &sql, const std::vector<ValueObject> &bindArgs = std::vector<Valu…
41 …int ExecuteForChangedRowCount(int &changedRows, const std::string &sql, const std::vector<ValueObj…
42 int ExecuteForLastInsertedRowId(int64_t &outRowId, const std::string &sql,
44 int ExecuteGetLong(int64_t &outValue, const std::string &sql,
46 int ExecuteGetString(std::string &outValue, const std::string &sql,
48 std::shared_ptr<SqliteStatement> BeginStepQuery(int &errCode, const std::string &sql,
58 … int ExecuteForSharedBlock(int &rowNum, std::string sql, const std::vector<ValueObject> &bindArgs,
73 int PrepareAndBind(const std::string &sql, const std::vector<ValueObject> &bindArgs);
Drdb_store_impl.h100 std::shared_ptr<AbsSharedResultSet> QuerySql(const std::string &sql,
102 std::shared_ptr<AbsSharedResultSet> QuerySql(const std::string &sql,
105 …const std::string &sql, const std::vector<ValueObject> &bindArgs = std::vector<ValueObject>()) ove…
106 …int ExecuteAndGetLong(int64_t &outValue, const std::string &sql, const std::vector<ValueObject> &b…
107 int ExecuteAndGetString(std::string &outValue, const std::string &sql,
109 int ExecuteForLastInsertedRowId(int64_t &outValue, const std::string &sql,
111 int ExecuteForChangedRowCount(int64_t &outValue, const std::string &sql,
137 std::shared_ptr<ResultSet> QueryByStep(const std::string &sql,
139 …std::shared_ptr<ResultSet> QueryByStep(const std::string &sql, const std::vector<ValueObject> &arg…
173 int CheckAttach(const std::string &sql);
[all …]
/foundation/distributeddatamgr/relational_store/frameworks/native/rdb/mock/include/
Dsqlite_connection.h35 int Prepare(const std::string &sql, bool &outIsReadOnly);
36 int PrepareAndGetInfo(const std::string &sql, bool &outIsReadOnly, int &numParameters,
38 …int ExecuteSql(const std::string &sql, const std::vector<ValueObject> &bindArgs = std::vector<Valu…
39 …int ExecuteForChangedRowCount(int &changedRows, const std::string &sql, const std::vector<ValueObj…
40 int ExecuteForLastInsertedRowId(int64_t &outRowId, const std::string &sql,
42 int ExecuteGetLong(int64_t &outValue, const std::string &sql,
44 int ExecuteGetString(std::string &outValue, const std::string &sql,
46 std::shared_ptr<SqliteStatement> BeginStepQuery(int &errCode, const std::string &sql,
69 int PrepareAndBind(const std::string &sql, const std::vector<ValueObject> &bindArgs);
Drdb_store_impl.h60 …const std::string &sql, const std::vector<ValueObject> &bindArgs = std::vector<ValueObject>()) ove…
61 …int ExecuteAndGetLong(int64_t &outValue, const std::string &sql, const std::vector<ValueObject> &b…
62 int ExecuteAndGetString(std::string &outValue, const std::string &sql,
64 int ExecuteForLastInsertedRowId(int64_t &outValue, const std::string &sql,
66 int ExecuteForChangedRowCount(int64_t &outValue, const std::string &sql,
91 std::shared_ptr<ResultSet> QueryByStep(const std::string &sql,
93 …std::shared_ptr<ResultSet> QueryByStep(const std::string &sql, const std::vector<ValueObject> &arg…
104 int CheckAttach(const std::string &sql);
107 int BeginExecuteSql(const std::string &sql, SqliteConnection **connection);
108 int FreeTransaction(SqliteConnection *connection, const std::string &sql);
[all …]
/foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb/test/unittest/common/common/
Dnative_sqlite.cpp33 int NativeSqlite::ExecSql(sqlite3 *db, const std::string &sql) in ExecSql() argument
35 if (db == nullptr || sql.empty()) { in ExecSql()
39 int errCode = sqlite3_exec(db, sql.c_str(), nullptr, nullptr, &errMsg); in ExecSql()
47 int NativeSqlite::ExecSql(sqlite3 *db, const std::string &sql, const std::function<int (sqlite3_stm… in ExecSql() argument
50 if (db == nullptr || sql.empty()) { in ExecSql()
56 int ret = sqlite3_prepare_v2(db, sql.c_str(), -1, &stmt, nullptr); in ExecSql()
/foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb/storage/src/
Drelational_sync_data_inserter.cpp129 const std::string sql = "INSERT OR REPLACE INTO '" + insertTableName_ + "'" + in GetInsertStatement() local
131 int errCode = SQLiteUtils::GetStatement(db, sql, stmt); in GetInsertStatement()
178 …std::string sql = "DELETE FROM " + DBConstant::RELATIONAL_PREFIX + localTable_.GetTableName() + "_… in GetDeleteLogStmt() local
180 sql += "WHERE hash_key=?"; in GetDeleteLogStmt()
182 sql += "WHERE hash_key=? AND device=?"; in GetDeleteLogStmt()
185 int errCode = SQLiteUtils::GetStatement(db, sql, stmt); in GetDeleteLogStmt()
194 std::string sql = "DELETE FROM '" + insertTableName_ + "' WHERE rowid IN (" in GetDeleteSyncDataStmt() local
197 sql += "WHERE hash_key=?);"; in GetDeleteSyncDataStmt()
199 sql += "WHERE hash_key=? AND device=? AND flag&0x01=0);"; in GetDeleteSyncDataStmt()
201 int errCode = SQLiteUtils::GetStatement(db, sql, stmt); in GetDeleteSyncDataStmt()
[all …]
/foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb/test/unittest/common/storage/cloud/
Ddistributeddb_cloud_save_cloud_data_test.cpp106 std::string sql; in PrepareDataBase() local
108sql = "create table " + tableName + "(id int primary key, name TEXT, age REAL, sex INTEGER, image … in PrepareDataBase()
110sql = "create table " + tableName + "(id int, name TEXT, age REAL, sex INTEGER, image BLOB);"; in PrepareDataBase()
112sql = "create table " + tableName + "(id int, name TEXT, age REAL, sex INTEGER, image BLOB," \ in PrepareDataBase()
115 EXPECT_EQ(RelationalTestUtils::ExecSql(db, sql), E_OK); in PrepareDataBase()
128 sql = "insert into " + tableName + "(id, name, age)" \ in PrepareDataBase()
132 sql = "insert into " + tableName + "(id, name)" \ in PrepareDataBase()
136 EXPECT_EQ(RelationalTestUtils::ExecSql(db, sql), E_OK); in PrepareDataBase()
144 sql = "update " + DBCommon::GetLogTableName(tableName) + " set cloud_gid = '" + in PrepareDataBase()
147 sql = "update " + DBCommon::GetLogTableName(tableName) + " set cloud_gid = '" + in PrepareDataBase()
[all …]
/foundation/distributeddatamgr/datamgr_service/services/distributeddataservice/service/data_share/gaussdb_rd/src/oh_adapter/src/
Dsqlite_store_executor_impl.cpp115 std::string sql = "INSERT OR REPLACE INTO '" + collName + "' VALUES (?,?);"; in PutData() local
117 dbHandle_, sql, in PutData()
144 std::string sql = "INSERT INTO '" + collName + "' VALUES (?,?);"; in InsertData() local
146 dbHandle_, sql, in InsertData()
171 std::string sql = "SELECT value FROM '" + collName + "' WHERE key=?;"; in GetDataByKey() local
173 dbHandle_, sql, in GetDataByKey()
198 std::string sql = "SELECT value FROM '" + collName + "' WHERE key=?;"; in GetDataById() local
200 dbHandle_, sql, in GetDataById()
250 std::string sql = GeneralInsertSql(collName, key, isIdExist); in GetDataByFilter() local
254 dbHandle_, sql, in GetDataByFilter()
[all …]
/foundation/distributeddatamgr/kv_store/frameworks/libs/distributeddb/test/unittest/common/storage/
Ddistributeddb_relational_encrypted_db_test.cpp85 void ExecSqlAndAssertOK(sqlite3 *db, const std::string &sql) in ExecSqlAndAssertOK() argument
87 ASSERT_EQ(sqlite3_exec(db, sql.c_str(), nullptr, nullptr, nullptr), SQLITE_OK); in ExecSqlAndAssertOK()
161 string sql = variable
168 ExecSqlAndAssertOK(db, sql);
195 string sql = variable
202 ExecSqlAndAssertOK(db, sql);
229 string sql = variable
236 ExecSqlAndAssertOK(db, sql);
287 string sql = variable
294 ExecSqlAndAssertOK(db, sql);
[all …]
Ddistributeddb_relational_get_data_test.cpp63 const string sql = in CreateDBAndTable() local
67 errCode = sqlite3_exec(db, sql.c_str(), nullptr, nullptr, &zErrMsg); in CreateDBAndTable()
80 const string sql = in AddOrUpdateRecord() local
82 errCode = sqlite3_exec(db, sql.c_str(), nullptr, nullptr, nullptr); in AddOrUpdateRecord()
93 const string sql = "SELECT timestamp, flag \ in GetLogData() local
105 errCode = SQLiteUtils::GetStatement(db, sql, statement); in GetLogData()
153 int GetCount(sqlite3 *db, const string &sql, size_t &count) in GetCount() argument
156 int errCode = SQLiteUtils::GetStatement(db, sql, stmt); in GetCount()
169 void ExpectCount(sqlite3 *db, const string &sql, size_t expectCount) in ExpectCount() argument
172 ASSERT_EQ(GetCount(db, sql, count), E_OK); in ExpectCount()
[all …]
/foundation/communication/dsoftbus/core/common/utils/
Dsqlite3_utils.c130 NO_SANITIZE("cfi") static int32_t ExecuteSql(DbContext *ctx, const char *sql, uint32_t len, BindPar… in ExecuteSql() argument
136 if (sql == NULL || sql[0] == '\0') { in ExecuteSql()
140 rc = sqlite3_prepare_v2(ctx->db, sql, len, &ctx->stmt, NULL); in ExecuteSql()
173 NO_SANITIZE("cfi") static int32_t QueryData(DbContext *ctx, const char *sql, uint32_t len, BindPara… in QueryData() argument
177 rc = ExecuteSql(ctx, sql, len, cb, data); in QueryData()
275 const char *sql = g_sqliteMgr[id].sqlForCreate; in CreateTable() local
276 if (sql == NULL || sql[0] == '\0') { in CreateTable()
280 rc = sqlite3_exec(ctx->db, sql, NULL, NULL, &errMsg); in CreateTable()
291 char sql[SQL_DEFAULT_LEN] = {0}; in DeleteTable() local
297 rc = sprintf_s(sql, SQL_DEFAULT_LEN, "%s%s", SQL_DROP_TABLE, g_sqliteMgr[id].tableName); in DeleteTable()
[all …]
/foundation/communication/bluetooth_service/services/bluetooth/service/src/map_mse/
Dmap_mse_resource.cpp80 …std::string sql = "select uci, display_name, chat_state, last_activity, x_bt_uid, name, presence_a… in GetParticipantSql() local
86 sql.append(" and (convo_id like '%' || ? || '%' or name like '%' || ? || '%')"); in GetParticipantSql()
92 sql.append(" and (convo_id like ? || '%' or name like ? || '%')"); in GetParticipantSql()
94 sql.append(" and (convo_id like '%' || ? or name like '%' || ?)"); in GetParticipantSql()
98 return sql; in GetParticipantSql()
103 std::string sql = "select convo_id, name, last_activity, read_status, version_counter," in GetCvslistSql() local
107 sql.append(" and last_activity >= ?"); in GetCvslistSql()
110 sql.append(" and last_activity <= ?"); in GetCvslistSql()
114 sql.append(" and read_status = ?"); in GetCvslistSql()
118 sql.append(" and convo_id = ?"); in GetCvslistSql()
[all …]

123456