A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/dbcopy__common_8cpp_source.html below:

NCBI C++ ToolKit: src/sample/app/dbapi/dbcopy_common.cpp Source File

88

conn_from->Connect(

"anyone"

,

"allowed"

,

"TAPER"

,

"DBAPI_Sample"

);

89

conn_to->Connect(

"anyone"

,

"allowed"

,

"MS_DEV1"

,

"DBAPI_Sample"

);

91

unique_ptr<IStatement> stmt_from(conn_from->GetStatement());

92

unique_ptr<IStatement> stmt_to(conn_to->GetStatement());

96  sql

=

" CREATE TABLE #source_table( \n" 97  "attribute_id INT, \n" 98  "attribute_name VARCHAR(128), \n" 99  "attribute_value VARCHAR(255) \n" 101

stmt_from->ExecuteUpdate(

sql

);

106  sql

=

" CREATE TABLE #destination_table( \n" 107  "attribute_id INT, \n" 108  "attribute_name VARCHAR(128), \n" 109  "attribute_value VARCHAR(255) \n" 111

stmt_to->ExecuteUpdate(

sql

);

118

conn_tmp->Connect(

"anyone"

,

"allowed"

,

"TAPER"

);

121  sql

=

"INSERT INTO #source_table VALUES(@attr_id, @attr_name, @attr_value)"

;

124

unique_ptr<ICallableStatement> auto_stmt(conn_tmp->GetCallableStatement(

"sp_server_info"

));

125

auto_stmt->Execute();

128

stmt_from->ExecuteUpdate(

"BEGIN TRANSACTION"

);

129  while

(auto_stmt->HasMoreResults()) {

130

unique_ptr<IResultSet> rs(auto_stmt->GetResultSet());

134

stmt_from->SetParam(rs->GetVariant(1),

"@attr_id"

);

135

stmt_from->SetParam(rs->GetVariant(2),

"@attr_name"

);

136

stmt_from->SetParam(rs->GetVariant(3),

"@attr_value"

);

138

stmt_from->ExecuteUpdate(

sql

);

139

stmt_from->ClearParamList();

143

stmt_from->ExecuteUpdate(

"COMMIT TRANSACTION"

);

149  sql

=

"INSERT INTO #destination_table VALUES(@attr_id, @attr_name, @attr_value)"

;

152

stmt_from->SendSql(

"SELECT * FROM #source_table"

);

155

stmt_to->ExecuteUpdate(

"BEGIN TRANSACTION"

);

156  while

(stmt_from->HasMoreResults()) {

157

unique_ptr<IResultSet> rs(stmt_from->GetResultSet());

161

stmt_to->SetParam(rs->GetVariant(1),

"@attr_id"

);

162

stmt_to->SetParam(rs->GetVariant(2),

"@attr_name"

);

163

stmt_to->SetParam(rs->GetVariant(3),

"@attr_value"

);

165

stmt_to->ExecuteUpdate(

sql

);

166

stmt_to->ClearParamList();

170

stmt_to->ExecuteUpdate(

"COMMIT TRANSACTION"

);

175

stmt_to->SendSql(

"SELECT * FROM #destination_table"

);

176  while

(stmt_to->HasMoreResults()) {

177

unique_ptr<IResultSet> rs(stmt_to->GetResultSet());

182

rs->GetVariant(1).GetInt4() <<

'\t'

<<

183

rs->GetVariant(2).GetString() <<

'\t'

<<

184

rs->GetVariant(3).GetString() <<

191

cerr << ex.

GetMsg

() << endl;

194

cerr <<

"Unknown error"

<< endl;

CErrHandler - custom error handler.

virtual bool HandleIt(CDB_Exception *ex)

Handle the exceptions resulting from a native API call, one-by-one.

@ eTakeOwnership

An object can take ownership of another.

virtual I_DriverContext * GetDriverContext()=0

Returns the pointer to the general driver interface.

virtual IConnection * CreateConnection(EOwnership ownership=eNoOwnership)=0

@ eBulkInsert

Bulk insert mode.

IDataSource * CreateDs(const string &driver_name, const map< string, string > *attr=0, const string &tag=kEmptyStr)

static CDriverManager & GetInstance()

int GetDBErrCode(void) const

virtual void PushDefConnMsgHandler(CDB_UserHandler *h, EOwnership ownership=eNoOwnership)=0

Add `per-connection' err.message handler "h" to the stack of default handlers which are inherited by ...

virtual void PushCntxMsgHandler(CDB_UserHandler *h, EOwnership ownership=eNoOwnership)=0

Add message handler "h" to process 'context-wide' (not bound to any particular connection) error mess...

const string & GetMsg(void) const

Get message string.

int DemoDbCopyTable(void)

DemoDbCopy - copy one table to another.


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