MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / SetPragma

Function SetPragma

tensorflow/core/lib/db/sqlite.cc:84–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82}
83
84Status SetPragma(Sqlite* db, const char* pragma, const StringPiece& value) {
85 if (value.empty()) return Status::OK();
86 for (auto p = value.begin(); p < value.end(); ++p) {
87 if (!(('0' <= *p && *p <= '9') || ('A' <= *p && *p <= 'Z') ||
88 ('a' <= *p && *p <= 'z') || *p == '-')) {
89 return errors::InvalidArgument("Illegal pragma character");
90 }
91 }
92 SqliteStatement stmt;
93 TF_RETURN_IF_ERROR( // We can't use Bind*() pragma statements.
94 db->Prepare(strings::StrCat("PRAGMA ", pragma, "=", value), &stmt));
95 bool unused_done;
96 return stmt.Step(&unused_done);
97}
98
99const StringPiece GetEnv(const char* var) {
100 const char* val = std::getenv(var);

Callers 2

EnvPragmaFunction · 0.85
OpenMethod · 0.85

Calls 7

InvalidArgumentFunction · 0.85
StrCatFunction · 0.50
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
PrepareMethod · 0.45
StepMethod · 0.45

Tested by

no test coverage detected