本文整理汇总了C++中PreparedStatement::close方法的典型用法代码示例。如果您正苦于以下问题:C++ PreparedStatement::close方法的具体用法?C++ PreparedStatement::close怎么用?C++ PreparedStatement::close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PreparedStatement
的用法示例。
在下文中一共展示了PreparedStatement::close方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: executeUpdate
void JDBCTemplate::executeUpdate(std::string sql, int type, object *obj)
{
Connection *conn = 0;
try
{
//调用钩子方法
conn = this->getConnection();
PreparedStatement *pstmt = conn->prepareStatement(sql);
//调用原语操作
this->setUpdateSqlValue(type,pstmt,obj);
pstmt->executeUpdate();
pstmt->close();
}
catch(Exception *err)
{
err->printStackTrace();
}
//JAVA TO C++ CONVERTER TODO TASK: There is no native C++ equivalent to the exception 'finally' clause:
finally
{
try
{
conn->close();
}
catch (SQLException *e)
{
e->printStackTrace();
}
}
}
示例2: nuodb_statement_close
int nuodb_statement_close(struct nuodb *db, struct nuodb_statement **st) {
try {
if (st && *st) {
PreparedStatement *stmt = reinterpret_cast<PreparedStatement *>(*st);
stmt->close();
*st = 0;
}
return 0;
} catch (SQLException &e) {
return setError(db, e);
}
}
示例3: nuodb_statement_prepare
int nuodb_statement_prepare(struct nuodb *db, const char *sql,
struct nuodb_statement **st, int *parameter_count) {
PreparedStatement *stmt = 0;
try {
stmt = db->conn->prepareStatement(sql, RETURN_GENERATED_KEYS);
*parameter_count = stmt->getParameterMetaData()->getParameterCount();
*st = reinterpret_cast<struct nuodb_statement *>(stmt);
return 0;
} catch (SQLException &e) {
if (stmt) {
stmt->close();
}
return setError(db, e);
}
}
示例4:
Collection *JDBCTemplate::getByCondition(std::string sql, object *qm)
{
Collection *col = std::vector();
Connection *conn = 0;
try
{
//调用钩子方法
conn = this->getConnection();
//调用原语操作
sql = this->prepareQuerySql(sql, qm);
PreparedStatement *pstmt = conn->prepareStatement(sql);
//调用原语操作
this->setQuerySqlValue(pstmt, qm);
ResultSet *rs = pstmt->executeQuery();
while(rs->next())
{
//调用原语操作
col->add(this->rs2Object(rs));
}
rs->close();
pstmt->close();
}
catch(Exception *err)
{
err->printStackTrace();
}
//JAVA TO C++ CONVERTER TODO TASK: There is no native C++ equivalent to the exception 'finally' clause:
finally
{
try
{
conn->close();
}
catch (SQLException *e)
{
e->printStackTrace();
}
}
return col;
}