Status MobileRecordStore::insertRecords(OperationContext* opCtx, std::vector<Record>* inOutRecords, const std::vector<Timestamp>& timestamps) { // Inserts record into SQLite table (or replaces if duplicate record id). MobileSession* session = MobileRecoveryUnit::get(opCtx)->getSession(opCtx, false); SqliteStatement insertStmt( *session, "INSERT OR REPLACE INTO \"", _ident, "\"(rec_id, data) VALUES(?, ?);"); for (auto& record : *inOutRecords) { const auto data = record.data.data(); const auto len = record.data.size(); _changeNumRecs(opCtx, 1); _changeDataSize(opCtx, len); RecordId recId = _nextId(); insertStmt.bindInt(0, recId.repr()); insertStmt.bindBlob(1, data, len); insertStmt.step(SQLITE_DONE); record.id = recId; insertStmt.reset(); } return Status::OK(); }
int main() { //insertDB(); insertStmt(); selectDB(); std::cout << "bool:" << std::is_fundamental<bool>::value << "\n"; std::cout << "short:" << std::is_fundamental<short>::value << "\n"; std::cout << "int:" << std::is_fundamental<int>::value << "\n"; std::cout << "double:" << std::is_fundamental<double>::value << "\n"; std::cout << "long:" << std::is_fundamental<long>::value << "\n"; std::cout << "long long:" << std::is_fundamental<long long>::value << "\n"; std::cout << "unsigned:" << std::is_fundamental<unsigned int>::value << "\n"; std::cout << "unsigned long:" << std::is_fundamental<unsigned long>::value << "\n"; std::cout << "unsigned long long:" << std::is_fundamental<unsigned long long>::value << "\n"; std::cout << "int*:" << std::is_fundamental<int*>::value << "\n"; std::cout << "const char*:" << std::is_fundamental<const char*>::value << "\n"; return 0; }