[prev in list] [next in list] [prev in thread] [next in thread] 

List:       mysql-odbc
Subject:    RE: Anyone know the c syntax for
From:       "Devore, Jacob" <JDevore () Blackisle ! com>
Date:       2002-01-05 0:52:47
[Download RAW message or body]

Do I need to do something when I insert it into the database?  Like use the
DATE_FORMAT function when I do the insert?  I used DATE_FORMAT in the select
and it seemed to return different sizes, but the data was still garbage, 3
garbage characters then a null then 0xcc all the way till the end of the
size the database thinks it should be

Thanks,

jake

-----Original Message-----
From: Venu [mailto:venu@mysql.com]
Sent: Friday, January 04, 2002 3:59 PM
To: Devore, Jacob; 'Nick Gorham'
Cc: myodbc@lists.mysql.com
Subject: RE: Anyone know the c syntax for


Hi,


> -----Original Message-----
> From: Devore, Jacob [mailto:JDevore@Blackisle.com]
> Sent: Friday, January 04, 2002 3:34 PM
> To: 'Nick Gorham'
> Cc: myodbc@lists.mysql.com
> Subject: RE: Anyone know the c syntax for
>
>
> Do you know if there is an issue with getting it as a string?  For some
> reason the odbc call doesn't fill in the data correctly.  Also, how do I
> request the timestamp from the server so that it returns data in this
> format?

Try by bounding buffers through SQL_TIMESTAMP_STRUCT with C
data type as SQL_C_TIMESTAMP. Here is the log from ODBC test..

SQLExecDirect:
 In:	hstmt = 0x00751908, szSqlStr = "select * from t_tstotime1;",
		  		cbSqlStr = -3
	Return:	SQL_SUCCESS=0

Get Data All:
"col1", "col2", "col3"
2001-08-02, 20:01:08, 2001-08-02 18:20:45
1 row fetched from 3 columns.

SQLExecDirect:
 In:	            hstmt = 0x00751908, szSqlStr = "select * from
t_tstotime1;",
		  	cbSqlStr = -3
	Return:	SQL_SUCCESS=0

SQLFetch:
	In:		StatementHandle = 0x00751908
	Return:	SQL_SUCCESS=0

SQLGetData:
	In:		Statementhandle = 0x00751908, ColumnNumber = 3,
			TargetType = SQL_C_TIMESTAMP=11, TargetValuePtr =
0x000898F0, BufferLength =
300,
			StrLen_or_IndPtr = 0x00085A38
	Return:	SQL_SUCCESS=0
	Out:		*TargetValuePtr = 2001-08-02 18:20:45.000000000,
			*StrLen_or_IndPtr = 16

Regards, Venu
--
For technical support contracts, go to https://order.mysql.com
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /   Mr. Venu <venu@mysql.com>
 / /|_/ / // /\ \/ /_/ / /__  MySQL AB, Developer
/_/  /_/\_, /___/\___\_\___/  California, USA
       <___/  www.mysql.com
>
> Thanks,
>
> jake
>
> -----Original Message-----
> From: Nick Gorham [mailto:nick@lurcher.org]
> Sent: Friday, January 04, 2002 3:15 PM
> To: Devore, Jacob
> Cc: myodbc@lists.mysql.com
> Subject: Re: Anyone know the c syntax for
>
>
>
>
> "Devore, Jacob" wrote:
>
> > getting a datetime from the sql server?  ODBC says the type is 11, which
> is
> > defined in the odbc header files, and the size is 19 bytes.  When I try
to
> > fill out the data it puts garbage in the there.
>
> Well, it should be one of these if you get it as a SQL_TIMESTAMP
>
> typedef struct tagTIMESTAMP_STRUCT
> {
>         SQLSMALLINT    year;
>         SQLUSMALLINT   month;
>         SQLUSMALLINT   day;
>         SQLUSMALLINT   hour;
>         SQLUSMALLINT   minute;
>         SQLUSMALLINT   second;
>         SQLUINTEGER    fraction;
> } TIMESTAMP_STRUCT;
>
> But if its length 19, I suspect you are getting it as a string, If you
still
> want it as a string, its probably
>
> yyyy-mm-dd hh:mm:ss.ffffffff
>
> with the seconds optional, 19 would be just the date and time.
>
> SQL_TIMESTAMP may well be easyier than a string YMMV.
>
> Nick Gorham
>
> ---------------------------------------------------------------------
> Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
> posting. To request this thread, e-mail myodbc-thread4470@lists.mysql.com
>
> To unsubscribe, send a message to the address shown in the
> List-Unsubscribe header of this message. If you cannot see it,
> e-mail myodbc-unsubscribe@lists.mysql.com instead.
>


---------------------------------------------------------------------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail myodbc-thread4471@lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail myodbc-unsubscribe@lists.mysql.com instead.

---------------------------------------------------------------------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail myodbc-thread4472@lists.mysql.com

To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail myodbc-unsubscribe@lists.mysql.com instead.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic