void testSerializationExactEquality(const T& val) {
  BlobEncoder encoder;
  T decodedVal;

  encoder(val);

  BlobDecoder decoder(encoder.data(), encoder.size());

  decoder(decodedVal);

  EXPECT_EQ(decodedVal, val);
}
Beispiel #2
0
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();
}
Beispiel #3
0
void RepoQuery::bindBlob(const char* paramName, const BlobEncoder& blob,
                         bool isStatic) {
  return bindBlob(paramName, blob.data(), blob.size(), isStatic);
}