NCBI_NS_FTDS_CTLIB
65 const string& cursor_name,
66 const string&
query,
67 unsigned intfetch_size
70, m_FetchSize(fetch_size)
72 stringextra_msg =
"Cursor Name: \""+ cursor_name +
"\"; SQL Command: \""+
150 switch( res_type ) {
161 "executing a command", 122049 );
188 "ct_cursor(DECLARE) failed", 122001);
193 if(
GetQuery().find(
"select") != string::npos ||
194 GetQuery().find(
"SELECT") != string::npos) {
205 "ct_cursor(ROWS) failed", 122004);
228 "ct_cursor(open) failed", 122005);
256 switch( res_type ) {
271 "executing a command", 122016 );
299 const_cast<char*
>(upd_query.data()),
300 static_cast<CS_INT>(upd_query.size()),
302 "ct_cursor(update) failed", 122030);
319 while(
static_cast<unsigned int>(
GetResult().CurrentItemNo()) < item_num ) {
323unique_ptr<I_BlobDescriptor> desc(
GetResult().GetBlobDescriptor(item_num));
324 if(desc.get() !=
NULL) {
326 autolast_dot = strrchr(ctl_desc.
m_Desc.
name,
'.');
327 if(last_dot ==
NULL) {
328 returndesc.release();
340 returndesc.release();
347unique_ptr<I_BlobDescriptor> d_guard(desc);
357unique_ptr<I_BlobDescriptor> d_guard(desc);
374 "ct_cursor(delete) failed", 122040);
410 "ct_cursor(close) failed", 122020);
508memset(¶m_fmt, 0,
sizeof(param_fmt));
519 if( !
AssignCmdParam(param, param_name, param_fmt, declare_only) )
536 const string& cursor_name,
537 const string&
query,
538 unsigned intfetch_size)
543 stringextra_msg =
"Cursor Name: \""+ cursor_name +
"\"; SQL Command: \""+
query+
"\"";
550 if((q.find(
"update") == string::npos) &&
551(q.find(
"UPDATE") == string::npos))
554 if((q.find(
"for update") != string::npos) ||
555(q.find(
"FOR UPDATE") != string::npos))
564 const boolconnected_to_MSSQLServer =
583 if( connected_to_MSSQLServer ) {
587cur_feat =
" cursor FORWARD_ONLY SCROLL_LOCKS for ";
589cur_feat =
" cursor FORWARD_ONLY for ";
638 while(
m_LCmd->HasMoreResults()) {
639unique_ptr<CDB_Result>
r(
m_LCmd->Result());
642 stringbuff = upd_query +
" where current of "+
GetCmdName();
647 while(
cmd->HasMoreResults()) {
669 while(
static_cast<unsigned int>(
m_Res->CurrentItemNo()) < item_num) {
670 if(!
m_Res->SkipItem())
return0;
673unique_ptr<I_BlobDescriptor> desc(
m_Res->GetBlobDescriptor(item_num));
677 if(desc.get() !=
NULL 681|| memcmp(dsc->
m_Desc.
textptr,
"dummy textptr\0\0", 16) == 0) {
688 returndesc.release();
695unique_ptr<I_BlobDescriptor> d_guard(desc);
698 while(
m_LCmd->HasMoreResults()) {
713unique_ptr<I_BlobDescriptor> d_guard(desc);
718 while(
m_LCmd->HasMoreResults()) {
737 while(
m_LCmd->HasMoreResults()) {
747 while(
cmd->HasMoreResults()) {
789 while(
m_LCmd->HasMoreResults()) {
810buff =
"deallocate ";
812buff =
"deallocate cursor ";
820 while(
m_LCmd->HasMoreResults()) {
864 charval_buffer[16*1024];
873snprintf(val_buffer,
sizeof(val_buffer),
"%d",
val.Value());
878snprintf(val_buffer,
sizeof(val_buffer),
"%d",
879(
int)
val.Value());
884snprintf(val_buffer,
sizeof(val_buffer),
"%d",
885(
int)
val.Value());
892s8.copy(val_buffer, s8.size());
893val_buffer[s8.size()] =
'\0';
900 const string& s =
val.AsString();
901string::const_iterator c = s.begin();
903val_buffer[
i++] =
'\'';
904 while(c != s.end() &&
i<
sizeof(val_buffer) - 2) {
906val_buffer[
i++] =
'\'';
907val_buffer[
i++] = *c++;
909 if(c != s.end())
return false;
910val_buffer[
i++] =
'\'';
911val_buffer[
i] =
'\0';
917 val.Value(),
val.Size());
923 val.Value(),
val.Size());
929 val.Value(),
val.DataSize())
937snprintf(val_buffer,
sizeof(val_buffer),
"%E",
938(
double)
val.Value());
943snprintf(val_buffer,
sizeof(val_buffer),
"%E",
val.Value());
949 string t=
val.Value().AsString(
"M/D/Y h:m");
950snprintf(val_buffer,
sizeof(val_buffer),
"'%s'",
t.c_str());
956 string t=
val.Value().AsString(
"M/D/Y h:m:s");
957snprintf(val_buffer,
sizeof(val_buffer),
"'%s:%.3d'",
958 t.c_str(), (
int)(
val.Value().NanoSecond()/1000000));
965 lt.SetNanoSecond(
lt.NanoSecond() / 100 * 100);
968 val.GetSQLType(),
val.GetOffset()));
969snprintf(val_buffer,
sizeof(val_buffer),
"'%s'",
t.c_str());
976strcpy(val_buffer,
"NULL");
CDB_SendDataCmd * ConnSendDataCmd(I_BlobDescriptor &desc, size_t data_size, bool log_it=true, bool dump_results=true)
bool x_SendData(I_BlobDescriptor &desc, CDB_Stream &img, bool log_it=true)
void DropCmd(impl::CCommand &cmd)
CS_RETCODE Check(CS_RETCODE rc)
CTL_Connection & GetConnection(void)
virtual void SetHasFailed(bool flag=true)
void SetExecCntxInfo(const string &info)
const TDbgInfo & GetDbgInfo(void) const
void SetResult(CTL_RowResult *result)
bool AssignCmdParam(CDB_Object ¶m, const string ¶m_name, CS_DATAFMT ¶m_fmt, bool declare_only=false)
friend class CTL_CursorCmdExpl
bool ProcessResultInternal(CDB_Result &res)
bool HaveResult(void) const
CTL_RowResult * MakeCursorResult(void)
CS_COMMAND * x_GetSybaseCmd(void) const
void GetRowCount(int *cnt)
CTL_RowResult & GetResult(void)
friend class CTL_CursorResultExpl
virtual CDB_LangCmd * LangCmd(const string &lang_query)
These methods: LangCmd(), RPC(), BCPIn(), Cursor() and SendDataCmd() create and return a "command" ob...
bool x_SendData(I_BlobDescriptor &desc, CDB_Stream &img, bool log_it=true)
virtual CDB_SendDataCmd * SendDataCmd(I_BlobDescriptor &desc, size_t data_size, bool log_it=true, bool dump_results=true)
"Send-data" command
virtual ~CTL_CursorCmdExpl(void)
CTL_CursorResultExpl * GetResultSet(void) const
unique_ptr< CTL_LangCmd > m_LCmd
virtual bool UpdateBlob(unsigned int item_num, CDB_Stream &data, bool log_it=true)
I_BlobDescriptor * x_GetBlobDescriptor(unsigned int item_num)
virtual CDB_SendDataCmd * SendDataCmd(unsigned int item_num, size_t size, bool log_it=true, bool dump_results=true)
virtual CDB_Result * OpenCursor(void)
Open the cursor.
virtual int RowCount(void) const
Get the number of rows affected by the command Special case: negative on error or if there is no way ...
bool x_AssignParams(void)
virtual bool Delete(const string &table_name)
Delete the last fetched row.
const string GetCombinedQuery(void) const
virtual bool Update(const string &table_name, const string &upd_query)
Update the last fetched row.
virtual bool CloseCursor(void)
Close the cursor.
unique_ptr< CTL_CursorResultExpl > m_Res
virtual int RowCount(void) const
Get the number of rows affected by the command Special case: negative on error or if there is no way ...
CTL_CursorCmd(CTL_Connection &conn, const string &cursor_name, const string &query, unsigned int fetch_size)
virtual bool CloseCursor(void)
Close the cursor.
virtual bool Delete(const string &table_name)
Delete the last fetched row.
CS_RETCODE CheckSFBCP(CS_RETCODE rc, const char *msg, unsigned int msg_num)
CS_RETCODE CheckSFB(CS_RETCODE rc, const char *msg, unsigned int msg_num)
virtual CDB_Result * OpenCursor(void)
Open the cursor.
virtual bool Update(const string &table_name, const string &upd_query)
Update the last fetched row.
bool x_AssignParams(bool just_declare=false)
virtual CDB_SendDataCmd * SendDataCmd(unsigned int item_num, size_t size, bool log_it=true, bool dump_results=true)
virtual bool UpdateBlob(unsigned int item_num, CDB_Stream &data, bool log_it=true)
virtual ~CTL_CursorCmd(void)
bool ProcessResults(void)
I_BlobDescriptor * x_GetBlobDescriptor(unsigned int item_num)
const string & GetQuery(void) const
void SetCursorOpen(bool flag=true)
string GetCmdName(void) const
bool CursorIsDeclared(void) const
virtual bool HasFailed(void) const
const CDB_Params & GetBindParamsImpl(void) const
void DetachInterface(void)
bool CursorIsOpen(void) const
void SetCursorDeclared(bool flag=true)
static CDB_Result * Create_Result(CResult &result)
void DropCmd(impl::CCommand &cmd)
CDBConnParams::EServerType GetServerType(void)
CDB_Object * GetParam(unsigned int param_no) const
const string & GetParamName(unsigned int param_no) const
TStatus GetParamStatus(unsigned int param_no) const
unsigned int NofParams() const
static bool for_update_of(const string &q)
#define CTL_BLOB_DESCRIPTOR_TYPE_MAGNUM
#define CS_CURSOR_DECLARE
#define CS_CURSOR_DEALLOC
static CS_CONNECTION * conn
CS_RETCODE ct_cursor(CS_COMMAND *cmd, CS_INT type, CS_CHAR *name, CS_INT namelen, CS_CHAR *text, CS_INT tlen, CS_INT option)
CS_RETCODE ct_results(CS_COMMAND *cmd, CS_INT *result_type)
CS_RETCODE ct_send(CS_COMMAND *cmd)
static const char table_name[]
static const char * column
#define DATABASE_DRIVER_ERROR(message, err_code)
#define CHECK_DRIVER_ERROR(failed, message, err_code)
#define DATABASE_DRIVER_WARNING(message, err_code)
#define DATABASE_DRIVER_ERROR_EX(prev_exception, message, err_code)
virtual EDB_Type GetType() const =0
static CTimeFormat GetTimeFormat(ESyntax syntax, ESQLType sql_type=eDateTime, TOffset offset=null)
#define NCBI_CURRENT_FUNCTION
Get current function name.
#define NCBI_CATCH_ALL_X(err_subcode, message)
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static string Int8ToString(Int8 value, TNumToStringFlags flags=0, int base=10)
Convert Int8 to string.
static bool SplitInTwo(const CTempString str, const CTempString delim, string &str1, string &str2, TSplitFlags flags=0)
Split a string into two pieces using the specified delimiters.
Definition of all error codes used in dbapi libraries (dbapi_driver.lib and others).
<!DOCTYPE HTML >< html > n< header > n< title > PubSeq Gateway Help Page</title > n< style > n table
size_t binary_to_hex_string(char *buffer, size_t buffer_size, const void *value, size_t value_size, TBinaryToHexFlags flags=0)
string g_SubstituteParam(const string &query, const string &name, const string &val)
const struct ncbi::grid::netcache::search::fields::SIZE size
double r(size_t dimension_, const Int4 *score_, const double *prob_, double theta_)
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4