本文整理汇总了C++中CDbStmt类的典型用法代码示例。如果您正苦于以下问题:C++ CDbStmt类的具体用法?C++ CDbStmt怎么用?C++ CDbStmt使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CDbStmt类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Execute
void qObjODBC::Execute(qCtx *ctx, qStr *out, const char *sql, CStr &body, CStr &head, CStr &foot)
{
if (!myConn) {
ctx->Throw(out, 302, myConn.GetErrorMsg());
return;
}
myStmt = myConn.Execute(sql);
if (!myStmt) {
ctx->Throw(out, 302, myStmt.GetErrorMsg());
return;
}
if ( ! ( body.IsEmpty() && head.IsEmpty() && foot.IsEmpty() ) ) {
if (myStmt.Bind()) {
bool ok = myStmt.Next();
ctx->MapObj(&ok, (QOBJFUNC) EvalBreak, "break");
if (!head.IsEmpty()) ctx->Parse(head, out);
ok = ok && !myStmt.Done();
while (ok) {
ctx->Parse(body, out);
if (ok)
ok = myStmt.Next();
}
if (!foot.IsEmpty()) ctx->Parse(foot, out);
}
}
}
示例2: EvalRow
void qObjODBC::EvalRow(qCtx *ctx, qStr *out, qArgAry *args)
{
assert(myStmt.RowCount()!=-1);
if (myStmt.RowCount() == -1)
return;
out->PutN(myStmt.RowCount());
}
示例3: EvalColName
void qObjODBC::EvalColName(qCtx *ctx, qStr *out, qArgAry *args)
{
assert(myStmt.RowCount()!=-1);
if (myStmt.RowCount() == -1)
return;
CDbCol *col;
if ((col = GetEvalCol(ctx, args))) {
out->PutS(col->Name);
}
}
示例4: EvalCol
void qObjODBC::EvalCol(qCtx *ctx, qStr *out, qArgAry *args)
{
assert(myStmt.RowCount()!=-1);
if (myStmt.RowCount() == -1)
return;
CDbCol *col;
if ((col = GetEvalCol(ctx, args))) {
int ind = col->GetInd();
if (myStmt.HasData() && SQL_HAS_DATA(ind)) {
col->ConvBuf();
col->RTrim();
if (col->GetBuf() && *col->GetBuf())
out->PutS(col->GetBuf());
}
}
}
示例5:
CDbCol *qObjODBC::GetEvalCol(qCtx *ctx, qArgAry *args)
{
CDbCol *col = 0;
if (args->Count() > 0) {
CStr index = (*args)[0];
index.Trim();
if (!index.IsEmpty()) {
if (isdigit(index[0])) {
col = myStmt.Column(atoi(index)-1);
} else {
strlwr(index.GetBuffer());
col = myStmt.Column((const char *)index);
}
}
}
return col;
}
示例6: EvalColumn
void qObjODBC::EvalColumn(qCtx *ctx, qStr *out, qArgAry *args)
{
assert(myStmt.RowCount()!=-1);
if (myStmt.RowCount() == -1)
return;
CDbCol *col;
if ((col = GetEvalCol(ctx, args))) {
int ind = col->GetInd();
if (myStmt.HasData() && SQL_HAS_DATA(ind)) {
col->ConvBuf();
if (ind >= 0) {
int n = min((SQLINTEGER)ind, col->DispSize);
out->PutS(col->GetBuf(), n);
} else {
out->PutS(col->GetBuf());
}
}
}
}
示例7: EvalEnumCol
void qObjODBC::EvalEnumCol(qCtx *ctx, qStr *out, qArgAry *args)
{
assert(myStmt.RowCount()!=-1);
if (myStmt.RowCount() == -1)
return;
if (args->Count() == 0)
return;
int num, type, size;
const char *name=0;
const char *value=0;
bool ok = true;
qCtxTmp sub(ctx);
sub.MapObj(&num, "num");
sub.MapObj(&name, "name");
sub.MapObj(&value, "value");
sub.MapObj(&type, "type");
sub.MapObj(&size, "size");
sub.MapObj(&ok, (QOBJFUNC) EvalBreak, "break");
CDbCol *col;
for(num = 1; ok && num <= myStmt.ColCount(); ++num) {
col = myStmt.Column(num-1);
name = col->Name;
if (myStmt.HasData() && SQL_HAS_DATA(col->GetInd())) {
col->ConvBuf();
col->RTrim();
value = col->GetBuf();
} else {
value = 0;
}
type = col->Type;
size = col->Size;
sub.qCtx::Parse(args->GetAt(0), out);
}
}
示例8: EvalSkipRows
void qObjODBC::EvalSkipRows(qCtx *ctx, qStr *out, qArgAry *args)
{
int val = ParseInt((*args)[0]);
myStmt.Skip(val);
}
示例9:
inline SQLLEN &GetInd() {
return myIndPtr[myStmt->BufIndex()];
}