本文整理汇总了C++中SqlStatement::Get方法的典型用法代码示例。如果您正苦于以下问题:C++ SqlStatement::Get方法的具体用法?C++ SqlStatement::Get怎么用?C++ SqlStatement::Get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SqlStatement
的用法示例。
在下文中一共展示了SqlStatement::Get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Exp
void Exp(const char *s, SqlStatement sql)
{
DDUMP(s);
DDUMP(sql.Get(PGSQL));
qtf << "\n:: ";
Put(s, ".From;.Where;.OrderBy");
qtf << "\n:: ";
Put(SqlCompile(PGSQL, sql.Get(PGSQL)), " from; where; order by");
}
示例2: SaveTest
//==============================================================================================
// Save the new test row data to the database.
void TestGrid::SaveTest(bool prompt) {
ASSERT(connection);
ASSERT(connection->session->IsOpen());
ASSERT(IsCursor());
int row = GetCursor();
SqlStatement sts;
// Inserting a new test
if (IsNewRow()) {
Set(PROCESSORDER, GetNextProcessOrder());
sts = SqlStatement(SqlInsert(TESTS)(THISBACK(FieldLayout), true /*nokey, let database generate from sequence */));
if (WhenToolBarNeedsUpdating) WhenToolBarNeedsUpdating(UrpGrid::USERADDEDROW);
// Updating an existing test
} else {
sts = SqlStatement(SqlUpdate(TESTS)(THISBACK(FieldLayout)).Where(TESTID == Get(TESTID)));
if (WhenToolBarNeedsUpdating) WhenToolBarNeedsUpdating(UrpGrid::USERCHANGEDDATA);
}
// Wrap in a SqlStatement object, which will somehow either call the SqlUpdate or
// SqlInsert operator SqlStatement() const, which then constructs a string and forms
// the constructor "explicit SqlStatement(const String& s) : text(s) {}", and so
// sets the text member. I don't know what the explicit command means.
// Transform to proper Sql; Sql will not be properly formed until the dialect of the
// connection is determined, in this case PGSQL. Do not use GetText().
// This calls SqlCompile(dialect, text) to finalize the "text" member contents.
String controlScript = sts.Get(connection->GetDialect());
LOG(controlScript);
int rsp = 1;
if (prompt) {
rsp = PromptOKCancel(CAT << "Script being applied: " << controlScript);
}
if (rsp == 1) {
if (!connection->SendAddDataScript(controlScript)) {
// Beep
return;
}
if (IsNewRow()) {
if (connection->GetRowsProcessed() > 0) {
int testid = connection->GetInsertedId("tests", "testid");
if (testid >= 0) {
SetTestId(row, testid);
}
}
}
}
}
示例3: Compile
String Sql::Compile(const SqlStatement& s)
{
byte dialect = GetDialect();
ASSERT(dialect);
return s.Get(dialect);
}