本文整理汇总了C++中RepoTxn类的典型用法代码示例。如果您正苦于以下问题:C++ RepoTxn类的具体用法?C++ RepoTxn怎么用?C++ RepoTxn使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RepoTxn类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VALUES
void UnitRepoProxy::InsertUnitStmt
::insert(RepoTxn& txn, int64& unitSn, const MD5& md5,
const uchar* bc, size_t bclen,
const uchar* bc_meta, size_t bc_meta_len,
const TypedValue* mainReturn,
const LineTable& lines) {
BlobEncoder linesBlob;
if (!prepared()) {
std::stringstream ssInsert;
ssInsert << "INSERT INTO " << m_repo.table(m_repoId, "Unit")
<< " VALUES(NULL, @md5, @bc, @bc_meta,"
" @mainReturn, @mergeable, @lines);";
txn.prepare(*this, ssInsert.str());
}
RepoTxnQuery query(txn, *this);
query.bindMd5("@md5", md5);
query.bindBlob("@bc", (const void*)bc, bclen);
query.bindBlob("@bc_meta",
bc_meta_len ? (const void*)bc_meta : (const void*)"",
bc_meta_len);
query.bindTypedValue("@mainReturn", *mainReturn);
query.bindBool("@mergeable", mainReturn->_count);
query.bindBlob("@lines", linesBlob(lines), /* static */ true);
query.exec();
unitSn = query.getInsertedRowid();
}
示例2: VALUES
void UnitRepoProxy::InsertUnitMergeableStmt
::insert(RepoTxn& txn, int64_t unitSn,
int ix, Unit::MergeKind kind, Id id,
TypedValue* value) {
if (!prepared()) {
std::stringstream ssInsert;
ssInsert << "INSERT INTO " << m_repo.table(m_repoId, "UnitMergeables")
<< " VALUES(@unitSn, @mergeableIx, @mergeableKind,"
" @mergeableId, @mergeableValue);";
txn.prepare(*this, ssInsert.str());
}
RepoTxnQuery query(txn, *this);
query.bindInt64("@unitSn", unitSn);
query.bindInt("@mergeableIx", ix);
query.bindInt("@mergeableKind", (int)kind);
query.bindId("@mergeableId", id);
if (value) {
assert(kind == MergeKind::Define ||
kind == MergeKind::PersistentDefine ||
kind == MergeKind::Global);
query.bindTypedValue("@mergeableValue", *value);
} else {
assert(kind == MergeKind::ReqDoc || kind == MergeKind::TypeAlias);
query.bindNull("@mergeableValue");
}
query.exec();
}
示例3: createSchema
void LitstrRepoProxy::createSchema(int repoId, RepoTxn& txn) {
std::stringstream ssCreate;
ssCreate << "CREATE TABLE " << m_repo.table(repoId, "Litstr")
<< "(litstrId INTEGER, litstr TEXT,"
" PRIMARY KEY (litstrId));";
txn.exec(ssCreate.str());
}
示例4: createSchema
void FuncRepoProxy::createSchema(int repoId, RepoTxn& txn) {
std::stringstream ssCreate;
ssCreate << "CREATE TABLE " << m_repo.table(repoId, "Func")
<< "(unitSn INTEGER, funcSn INTEGER, preClassId INTEGER,"
" name TEXT, top INTEGER,"
" extraData BLOB,"
" PRIMARY KEY (unitSn, funcSn));";
txn.exec(ssCreate.str());
}
示例5: createSchema
void PreClassRepoProxy::createSchema(int repoId, RepoTxn& txn) {
{
std::stringstream ssCreate;
ssCreate << "CREATE TABLE " << m_repo.table(repoId, "PreClass")
<< "(unitSn INTEGER, preClassId INTEGER, name TEXT,"
" hoistable INTEGER, extraData BLOB,"
" PRIMARY KEY (unitSn, preClassId));";
txn.exec(ssCreate.str());
}
}
示例6: createSchema
void UnitRepoProxy::createSchema(int repoId, RepoTxn& txn) {
{
std::stringstream ssCreate;
ssCreate << "CREATE TABLE " << m_repo.table(repoId, "Unit")
<< "(unitSn INTEGER PRIMARY KEY, md5 BLOB, bc BLOB, data BLOB, "
"UNIQUE (md5));";
txn.exec(ssCreate.str());
}
{
std::stringstream ssCreate;
ssCreate << "CREATE TABLE " << m_repo.table(repoId, "UnitLitstr")
<< "(unitSn INTEGER, litstrId INTEGER, litstr TEXT,"
" PRIMARY KEY (unitSn, litstrId));";
txn.exec(ssCreate.str());
}
{
std::stringstream ssCreate;
ssCreate << "CREATE TABLE " << m_repo.table(repoId, "UnitArray")
<< "(unitSn INTEGER, arrayId INTEGER, array BLOB,"
" PRIMARY KEY (unitSn, arrayId));";
txn.exec(ssCreate.str());
}
{
std::stringstream ssCreate;
ssCreate << "CREATE TABLE " << m_repo.table(repoId, "UnitMergeables")
<< "(unitSn INTEGER, mergeableIx INTEGER,"
" mergeableKind INTEGER, mergeableId INTEGER,"
" mergeableValue BLOB,"
" PRIMARY KEY (unitSn, mergeableIx));";
txn.exec(ssCreate.str());
}
{
std::stringstream ssCreate;
ssCreate << "CREATE TABLE " << m_repo.table(repoId, "UnitSourceLoc")
<< "(unitSn INTEGER, pastOffset INTEGER, line0 INTEGER,"
" char0 INTEGER, line1 INTEGER, char1 INTEGER,"
" PRIMARY KEY (unitSn, pastOffset));";
txn.exec(ssCreate.str());
}
}
示例7: VALUES
void Repo::InsertFileHashStmt::insert(RepoTxn& txn, const StringData* path,
const MD5& md5) {
if (!prepared()) {
std::stringstream ssInsert;
ssInsert << "INSERT INTO " << m_repo.table(m_repoId, "FileMd5")
<< " VALUES(@path, @md5);";
txn.prepare(*this, ssInsert.str());
}
RepoTxnQuery query(txn, *this);
query.bindStaticString("@path", path);
query.bindMd5("@md5", md5);
query.exec();
}
示例8: createSchema
void UnitRepoProxy::createSchema(int repoId, RepoTxn& txn) {
{
std::stringstream ssCreate;
ssCreate << "CREATE TABLE " << m_repo.table(repoId, "Unit")
<< "(unitSn INTEGER PRIMARY KEY, md5 BLOB, bc BLOB,"
" bc_meta BLOB, mainReturn BLOB, mergeable INTEGER,"
"lines BLOB, UNIQUE (md5));";
txn.exec(ssCreate.str());
}
{
std::stringstream ssCreate;
ssCreate << "CREATE TABLE " << m_repo.table(repoId, "UnitLitstr")
<< "(unitSn INTEGER, litstrId INTEGER, litstr TEXT,"
" PRIMARY KEY (unitSn, litstrId));";
txn.exec(ssCreate.str());
}
{
std::stringstream ssCreate;
ssCreate << "CREATE TABLE " << m_repo.table(repoId, "UnitArray")
<< "(unitSn INTEGER, arrayId INTEGER, array BLOB,"
" PRIMARY KEY (unitSn, arrayId));";
txn.exec(ssCreate.str());
}
{
std::stringstream ssCreate;
ssCreate << "CREATE TABLE " << m_repo.table(repoId, "UnitSourceLoc")
<< "(unitSn INTEGER, pastOffset INTEGER, line0 INTEGER,"
" char0 INTEGER, line1 INTEGER, char1 INTEGER,"
" PRIMARY KEY (unitSn, pastOffset));";
txn.exec(ssCreate.str());
}
{
std::stringstream ssCreate;
ssCreate << "CREATE TABLE " << m_repo.table(repoId, "UnitPreConst")
<< "(unitSn INTEGER, name TEXT, value BLOB, preConstId INTEGER,"
" PRIMARY KEY (unitSn, preConstId));";
txn.exec(ssCreate.str());
}
}
示例9: VALUES
void LitstrRepoProxy::InsertLitstrStmt::insert(RepoTxn& txn,
Id litstrId,
const StringData* litstr) {
if (!prepared()) {
std::stringstream ssInsert;
ssInsert << "INSERT INTO " << m_repo.table(m_repoId, "Litstr")
<< " VALUES(@litstrId, @litstr);";
txn.prepare(*this, ssInsert.str());
}
RepoTxnQuery query(txn, *this);
query.bindInt64("@litstrId", litstrId);
query.bindStaticString("@litstr", litstr);
query.exec();
}
示例10: VALUES
void UnitRepoProxy::InsertUnitArrayTypeTableStmt::insert(
RepoTxn& txn, int64_t unitSn, const ArrayTypeTable& att) {
if (!prepared()) {
std::stringstream ssInsert;
ssInsert << "INSERT INTO " << m_repo.table(m_repoId, "UnitArrayTypeTable")
<< " VALUES(@unitSn, @arrayTypeTable);";
txn.prepare(*this, ssInsert.str());
}
RepoTxnQuery query(txn, *this);
query.bindInt64("@unitSn", unitSn);
BlobEncoder dataBlob;
dataBlob(att);
query.bindBlob("@arrayTypeTable", dataBlob, /* static */ true);
query.exec();
}
示例11: VALUES
void PreClassRepoProxy::InsertPreClassStmt
::insert(const PreClassEmitter& pce, RepoTxn& txn,
int64_t unitSn, Id preClassId,
const StringData* name,
PreClass::Hoistable hoistable) {
if (!prepared()) {
std::stringstream ssInsert;
ssInsert << "INSERT INTO " << m_repo.table(m_repoId, "PreClass")
<< " VALUES(@unitSn, @preClassId, @name, @hoistable, "
"@extraData);";
txn.prepare(*this, ssInsert.str());
}
BlobEncoder extraBlob;
RepoTxnQuery query(txn, *this);
query.bindInt64("@unitSn", unitSn);
query.bindId("@preClassId", preClassId);
query.bindStaticString("@name", name);
query.bindInt("@hoistable", hoistable);
const_cast<PreClassEmitter&>(pce).serdeMetaData(extraBlob);
query.bindBlob("@extraData", extraBlob, /* static */ true);
query.exec();
}
示例12: VALUES
void FuncRepoProxy::InsertFuncStmt
::insert(const FuncEmitter& fe,
RepoTxn& txn, int64_t unitSn, int funcSn,
Id preClassId, const StringData* name,
bool top) {
if (!prepared()) {
std::stringstream ssInsert;
ssInsert << "INSERT INTO " << m_repo.table(m_repoId, "Func")
<< " VALUES(@unitSn, @funcSn, @preClassId, @name, "
" @top, @extraData);";
txn.prepare(*this, ssInsert.str());
}
BlobEncoder extraBlob;
RepoTxnQuery query(txn, *this);
query.bindInt64("@unitSn", unitSn);
query.bindInt("@funcSn", funcSn);
query.bindId("@preClassId", preClassId);
query.bindStaticString("@name", name);
query.bindBool("@top", top);
const_cast<FuncEmitter&>(fe).serdeMetaData(extraBlob);
query.bindBlob("@extraData", extraBlob, /* static */ true);
query.exec();
}