View Single Post

   
  #3 (permalink)  
Old 04-08-2008, 11:14 AM
t
 
Posts: n/a
Default Re: OCCI - Timestamp


- with code as below I can convert to text but is assertion problem

- when I am quiting 'while' clause ocurs assertion error when automaticly
trying to delete pointer (as I gues - is during deletion of some pointer)

- VC++.NET from Visual Studio version 7.1



here is an example:

#include <iostream>

#include "occi.h"

using namespace oracle:cci;

using namespace std;



int sql__(int yyy)

{

Environment *env;

Connection *conn;

Statement *stmt;

string sqlStmt;

string user = "HR";

string passwd = "zxzxc";

string db = "XE";

char * dataRCC = new char[20];

string tt44;

std::string p1;

std::string p2;

int nr;

env = Environment::createEnvironment (Environment:EFAULT);

conn = env->createConnection( user, passwd, db);

sqlStmt = "SELECT * FROM Tabela1";

stmt = conn->createStatement (sqlStmt);

ResultSet *rset = stmt->executeQuery ();

try

{

while (rset->next ())

{

p1 = rset->getString (1);

p2 = rset->getString (2);

nr = rset->getInt (3);

Timestamp dd = rset->getTimestamp(4);

string _tt44=dd.toText("yyyy-mm-dd hh24:mi:ss",0);

Number p5 = rset->getNumber(5);

// string p55 = p5.toText(env, "999999999999999999.9999");

} // here crashes with assertion fails

// goes to xmemory module

// void deallocate(pointer _Ptr, size_type)

// { // deallocate object at _Ptr, ignore size

// operator delete(_Ptr);

// }

// and stops

}

catch ( SQLException ex)

{

cout<<"Exception thrown for insertBind"<<endl;

cout<<"Error number: "<< ex.getErrorCode() << endl;

int KKK = ex.getErrorCode();

cout<<ex.getMessage() << endl;

}

stmt->closeResultSet (rset);

conn->terminateStatement (stmt);

env->terminateConnection (conn);

Environment::terminateEnvironment (env);

delete dataRCC;

return 0;

}




Reply With Quote