Unix Technical Forum

OCCI - Timestamp

This is a discussion on OCCI - Timestamp within the Oracle Miscellaneous forums, part of the Oracle Database category; --> Hi I am trying to use OCI from Oracle XE when using toText with precision to minutes and secunds ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database > Oracle Miscellaneous

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-08-2008, 11:13 AM
t
 
Posts: n/a
Default OCCI - Timestamp

Hi

I am trying to use OCI from Oracle XE

when using toText with precision to minutes and secunds program breaks

however when I am using only 'YYYY-MM-DD HH24' - format everything is OK



string date1;
Timestamp ts1;
ts1.fromText("2000-02-29 11:10:10", "YYYY-MM-DD HH24:MI:SS", "", env);
// date1 = ts1.toText ("YYYY-MM-DD HH24:MI:SS", 0, ""); <----
dasn't work !!!!!
date1 = ts1.toText ("YYYY-MM-DD HH24", 0, "");


I am using VC++ .NET Oracle Expressedition OCI (Oracla C interface)

thanks for help

t.



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 11:14 AM
KM
 
Posts: n/a
Default Re: OCCI - Timestamp



t wrote:
> Hi
>
> I am trying to use OCI from Oracle XE
>
> when using toText with precision to minutes and secunds program breaks
>
> however when I am using only 'YYYY-MM-DD HH24' - format everything is OK
>
>
>
> string date1;
> Timestamp ts1;
> ts1.fromText("2000-02-29 11:10:10", "YYYY-MM-DD HH24:MI:SS", "", env);
> // date1 = ts1.toText ("YYYY-MM-DD HH24:MI:SS", 0, ""); <----
> dasn't work !!!!!
> date1 = ts1.toText ("YYYY-MM-DD HH24", 0, "");
>
>
> I am using VC++ .NET Oracle Expressedition OCI (Oracla C interface)
>
> thanks for help
>
> t.
>
>
>

When you say it does not work, what exactly happens? Do you get some
error message? What error message do you see? Are you sure you are using
VC++7.1?

-km

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #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;

}




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-08-2008, 11:14 AM
t
 
Posts: n/a
Default Re: OCCI - Timestamp

the same problem is when trying to convert Number to string:

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

it converts but after all is asertion problem while exiting 'while' clause

t.




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:42 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com