本文整理汇总了C++中ODBCStatement::Ref方法的典型用法代码示例。如果您正苦于以下问题:C++ ODBCStatement::Ref方法的具体用法?C++ ODBCStatement::Ref怎么用?C++ ODBCStatement::Ref使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ODBCStatement
的用法示例。
在下文中一共展示了ODBCStatement::Ref方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeof
Handle<Value> ODBCStatement::ExecuteNonQuery(const Arguments& args) {
DEBUG_PRINTF("ODBCStatement::ExecuteNonQuery\n");
HandleScope scope;
REQ_FUN_ARG(0, cb);
ODBCStatement* stmt = ObjectWrap::Unwrap<ODBCStatement>(args.Holder());
uv_work_t* work_req = (uv_work_t *) (calloc(1, sizeof(uv_work_t)));
execute_work_data* data =
(execute_work_data *) calloc(1, sizeof(execute_work_data));
data->cb = Persistent<Function>::New(cb);
data->stmt = stmt;
work_req->data = data;
uv_queue_work(
uv_default_loop(),
work_req,
UV_ExecuteNonQuery,
(uv_after_work_cb)UV_AfterExecuteNonQuery);
stmt->Ref();
return scope.Close(Undefined());
}
示例2: ThrowException
Handle<Value> ODBCStatement::Bind(const Arguments& args) {
DEBUG_PRINTF("ODBCStatement::Bind\n");
HandleScope scope;
if ( !args[0]->IsArray() ) {
return ThrowException(Exception::TypeError(
String::New("Argument 1 must be an Array"))
);
}
REQ_FUN_ARG(1, cb);
ODBCStatement* stmt = ObjectWrap::Unwrap<ODBCStatement>(args.Holder());
uv_work_t* work_req = (uv_work_t *) (calloc(1, sizeof(uv_work_t)));
bind_work_data* data =
(bind_work_data *) calloc(1, sizeof(bind_work_data));
//if we previously had parameters, then be sure to free them
//before allocating more
if (stmt->paramCount) {
int count = stmt->paramCount;
stmt->paramCount = 0;
Parameter prm;
//free parameter memory
for (int i = 0; i < count; i++) {
if (prm = stmt->params[i], prm.buffer != NULL) {
switch (prm.c_type) {
case SQL_C_WCHAR: free(prm.buffer); break;
case SQL_C_CHAR: free(prm.buffer); break;
case SQL_C_SBIGINT: delete (int64_t *)prm.buffer; break;
case SQL_C_DOUBLE: delete (double *)prm.buffer; break;
case SQL_C_BIT: delete (bool *)prm.buffer; break;
}
}
}
free(stmt->params);
}
data->stmt = stmt;
DEBUG_PRINTF("ODBCStatement::Bind m_hDBC=%X m_hDBC=%X m_hSTMT=%X\n",
data->stmt->m_hENV,
data->stmt->m_hDBC,
data->stmt->m_hSTMT
);
data->cb = Persistent<Function>::New(cb);
data->stmt->params = ODBC::GetParametersFromArray(
Local<Array>::Cast(args[0]),
&data->stmt->paramCount);
work_req->data = data;
uv_queue_work(
uv_default_loop(),
work_req,
UV_Bind,
(uv_after_work_cb)UV_AfterBind);
stmt->Ref();
return scope.Close(Undefined());
}