void testSerializationExactEquality(const T& val) { BlobEncoder encoder; T decodedVal; encoder(val); BlobDecoder decoder(encoder.data(), encoder.size()); decoder(decodedVal); EXPECT_EQ(decodedVal, val); }
void UnitRepoProxy::insertUnitLineTable(int repoId, RepoTxn& txn, int64_t unitSn, LineTable& lineTable) { RepoStmt stmt(m_repo); stmt.prepare( folly::format( "INSERT INTO {} VALUES(@unitSn, @data);", m_repo.table(repoId, "UnitLineTable") ).str()); RepoTxnQuery query(txn, stmt); BlobEncoder dataBlob; dataBlob.encode(lineTable); query.bindInt64("@unitSn", unitSn); query.bindBlob("@data", dataBlob, /* static */ true); query.exec(); }
void RepoQuery::bindBlob(const char* paramName, const BlobEncoder& blob, bool isStatic) { return bindBlob(paramName, blob.data(), blob.size(), isStatic); }