本文整理汇总了C++中PreparedStatement::SetParamString方法的典型用法代码示例。如果您正苦于以下问题:C++ PreparedStatement::SetParamString方法的具体用法?C++ PreparedStatement::SetParamString怎么用?C++ PreparedStatement::SetParamString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PreparedStatement
的用法示例。
在下文中一共展示了PreparedStatement::SetParamString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ViewExists
bool TdsDatabaseLayer::ViewExists(const wxString& view)
{
bool bReturn = false;
// Keep these variables outside of scope so that we can clean them up
// in case of an error
PreparedStatement* pStatement = NULL;
DatabaseResultSet* pResult = NULL;
#ifndef DONT_USE_DATABASE_LAYER_EXCEPTIONS
try
{
#endif
wxString query = _("exec sp_tables ?, NULL, NULL, '''VIEW'''");
pStatement = PrepareStatement(query);
if (pStatement)
{
pStatement->SetParamString(1, view);
pResult = pStatement->ExecuteQuery();
if (pResult)
{
if (pResult->Next())
{
//wxPrintf(_("View found: '%s'\n"), pResult->GetResultString(_("TABLE_NAME")));
if(view.CmpNoCase(pResult->GetResultString(_("TABLE_NAME"))) == 0)
{
bReturn = true;
}
}
}
}
#ifndef DONT_USE_DATABASE_LAYER_EXCEPTIONS
}
catch (DatabaseLayerException& e)
{
if (pResult != NULL)
{
CloseResultSet(pResult);
pResult = NULL;
}
if (pStatement != NULL)
{
CloseStatement(pStatement);
pStatement = NULL;
}
throw e;
}
#endif
if (pResult != NULL)
{
CloseResultSet(pResult);
pResult = NULL;
}
if (pStatement != NULL)
{
CloseStatement(pStatement);
pStatement = NULL;
}
return bReturn;
}
示例2: GetColumns
wxArrayString FirebirdDatabaseLayer::GetColumns(const wxString& table)
{
// Initialize variables
wxArrayString returnArray;
// Keep these variables outside of scope so that we can clean them up
// in case of an error
PreparedStatement* pStatement = NULL;
DatabaseResultSet* pResult = NULL;
#ifndef DONT_USE_DATABASE_LAYER_EXCEPTIONS
try
{
#endif
wxString tableUpperCase = table.Upper();
wxString query = _("SELECT RDB$FIELD_NAME FROM RDB$RELATION_FIELDS WHERE RDB$RELATION_NAME=?;");
pStatement = PrepareStatement(query);
if (pStatement)
{
pStatement->SetParamString(1, tableUpperCase);
pResult = pStatement->ExecuteQuery();
if (pResult)
{
while (pResult->Next())
{
returnArray.Add(pResult->GetResultString(1).Trim());
}
}
}
#ifndef DONT_USE_DATABASE_LAYER_EXCEPTIONS
}
catch (DatabaseLayerException& e)
{
if (pResult != NULL)
{
CloseResultSet(pResult);
pResult = NULL;
}
if (pStatement != NULL)
{
CloseStatement(pStatement);
pStatement = NULL;
}
throw e;
}
#endif
if (pResult != NULL)
{
CloseResultSet(pResult);
pResult = NULL;
}
if (pStatement != NULL)
{
CloseStatement(pStatement);
pStatement = NULL;
}
return returnArray;
}
示例3: GetColumns
wxArrayString PostgresDatabaseLayer::GetColumns(const wxString& table)
{
// Initialize variables
wxArrayString returnArray;
// Keep these variables outside of scope so that we can clean them up
// in case of an error
PreparedStatement* pStatement = NULL;
DatabaseResultSet* pResult = NULL;
#ifndef DONT_USE_DATABASE_LAYER_EXCEPTIONS
try
{
#endif
wxString query = _("SELECT column_name FROM information_schema.columns WHERE table_name=? ORDER BY ordinal_position;");
pStatement = PrepareStatement(query);
if (pStatement)
{
pStatement->SetParamString(1, table);
pResult = pStatement->ExecuteQuery();
if (pResult)
{
while (pResult->Next())
{
returnArray.Add(pResult->GetResultString(1));
}
}
}
#ifndef DONT_USE_DATABASE_LAYER_EXCEPTIONS
}
catch (DatabaseLayerException& e)
{
if (pResult != NULL)
{
CloseResultSet(pResult);
pResult = NULL;
}
if (pStatement != NULL)
{
CloseStatement(pStatement);
pStatement = NULL;
}
throw e;
}
#endif
if (pResult != NULL)
{
CloseResultSet(pResult);
pResult = NULL;
}
if (pStatement != NULL)
{
CloseStatement(pStatement);
pStatement = NULL;
}
return returnArray;
}
示例4: ViewExists
bool FirebirdDatabaseLayer::ViewExists(const wxString& view)
{
// Initialize variables
bool bReturn = false;
// Keep these variables outside of scope so that we can clean them up
// in case of an error
PreparedStatement* pStatement = NULL;
DatabaseResultSet* pResult = NULL;
#ifndef DONT_USE_DATABASE_LAYER_EXCEPTIONS
try
{
#endif
wxString viewUpperCase = view.Upper();
wxString query = _("SELECT COUNT(*) FROM RDB$RELATIONS WHERE RDB$SYSTEM_FLAG=0 AND RDB$VIEW_BLR IS NOT NULL AND RDB$RELATION_NAME=?;");
pStatement = PrepareStatement(query);
if (pStatement)
{
pStatement->SetParamString(1, viewUpperCase);
pResult = pStatement->ExecuteQuery();
if (pResult)
{
if (pResult->Next())
{
if(pResult->GetResultInt(1) != 0)
{
bReturn = true;
}
}
}
}
#ifndef DONT_USE_DATABASE_LAYER_EXCEPTIONS
}
catch (DatabaseLayerException& e)
{
if (pResult != NULL)
{
CloseResultSet(pResult);
pResult = NULL;
}
if (pStatement != NULL)
{
CloseStatement(pStatement);
pStatement = NULL;
}
throw e;
}
#endif
if (pResult != NULL)
{
CloseResultSet(pResult);
pResult = NULL;
}
if (pStatement != NULL)
{
CloseStatement(pStatement);
pStatement = NULL;
}
return bReturn;
}
示例5: ViewExists
bool PostgresDatabaseLayer::ViewExists(const wxString& view)
{
// Initialize variables
bool bReturn = false;
// Keep these variables outside of scope so that we can clean them up
// in case of an error
PreparedStatement* pStatement = NULL;
DatabaseResultSet* pResult = NULL;
#ifndef DONT_USE_DATABASE_LAYER_EXCEPTIONS
try
{
#endif
wxString query = _("SELECT COUNT(*) FROM information_schema.tables WHERE table_type='VIEW' AND table_name=?;");
pStatement = PrepareStatement(query);
if (pStatement)
{
pStatement->SetParamString(1, view);
pResult = pStatement->ExecuteQuery();
if (pResult)
{
if (pResult->Next())
{
if(pResult->GetResultInt(1) != 0)
{
bReturn = true;
}
}
}
}
#ifndef DONT_USE_DATABASE_LAYER_EXCEPTIONS
}
catch (DatabaseLayerException& e)
{
if (pResult != NULL)
{
CloseResultSet(pResult);
pResult = NULL;
}
if (pStatement != NULL)
{
CloseStatement(pStatement);
pStatement = NULL;
}
throw e;
}
#endif
if (pResult != NULL)
{
CloseResultSet(pResult);
pResult = NULL;
}
if (pStatement != NULL)
{
CloseStatement(pStatement);
pStatement = NULL;
}
return bReturn;
}