当前位置: 首页>>代码示例>>C++>>正文


C++ CDbStmt类代码示例

本文整理汇总了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);
		}
	}
}
开发者ID:BackupTheBerlios,项目名称:smx-svn,代码行数:29,代码来源:sql.cpp

示例2: EvalRow

void qObjODBC::EvalRow(qCtx *ctx, qStr *out, qArgAry *args)
{
	assert(myStmt.RowCount()!=-1);
	if (myStmt.RowCount() == -1)
		return;
	out->PutN(myStmt.RowCount());
}
开发者ID:BackupTheBerlios,项目名称:smx-svn,代码行数:7,代码来源:sql.cpp

示例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);
	}
}
开发者ID:BackupTheBerlios,项目名称:smx-svn,代码行数:10,代码来源:sql.cpp

示例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());
		}
	}
}
开发者ID:BackupTheBerlios,项目名称:smx-svn,代码行数:16,代码来源:sql.cpp

示例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;
}
开发者ID:BackupTheBerlios,项目名称:smx-svn,代码行数:18,代码来源:sql.cpp

示例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());
			}
		}
	}
}
开发者ID:BackupTheBerlios,项目名称:smx-svn,代码行数:19,代码来源:sql.cpp

示例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);
	}
}
开发者ID:BackupTheBerlios,项目名称:smx-svn,代码行数:39,代码来源:sql.cpp

示例8: EvalSkipRows

void qObjODBC::EvalSkipRows(qCtx *ctx, qStr *out, qArgAry *args)
{
	int val = ParseInt((*args)[0]);
	myStmt.Skip(val);
}
开发者ID:BackupTheBerlios,项目名称:smx-svn,代码行数:5,代码来源:sql.cpp

示例9:

	inline SQLLEN &GetInd() {
		return myIndPtr[myStmt->BufIndex()];
	}
开发者ID:1029384756wait,项目名称:smx,代码行数:3,代码来源:sql.cpp


注:本文中的CDbStmt类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。