1. ODBC dates
Matt, after upgrading to 1.3 all my dates are coming back {7,7,7}. Any Ideas
george
2. Re: ODBC dates
Matt, I suspect there's a difference between what mysql and EUdb return
for a date field. I changed 1.3 convert date to
elsif dt = SQL_TYPE_DATE then
str = {str[2]*256+str[1], str[4]*256 +str[3], str[6]*256+str[5]}
return str
and it started to work again...
george
3. Re: ODBC dates
George Walters wrote:
>
> Matt, I suspect there's a difference between what mysql and EUdb return
> for a date field. I changed 1.3 convert date to
>
> }}}
<eucode>
> elsif dt = SQL_TYPE_DATE then
>
> str = {str[2]*256+str[1], str[4]*256 +str[3], str[6]*256+str[5]}
>
> return str
> </eucode>
{{{
>
> and it started to work again...
Hmmm...that's interesting. I think I originally tested it with Access,
and the SQL_TYPE_DATE came back as a string. I just downloaded MySQL,
so I'll see if I can figure out a better way to do this.
Matt Lewis
4. ODBC dates
I'm using Matt's ODBC wrapper and have a question about Data base dates. The
code below fetches a date as follows
"1996-06-29" is in the data base
the code below fetches
{201,7,6,0,29,0}
--------------- here's the code ----------------
for i = 1 to len do
size = cols[i][HC_SIZE]
strlen = peek4s( cols[i][HC_STRLEN] )
if strlen > size then
handle_cols[hstmt] = cols
bindColumn( hstmt, i, strlen )
cols = handle_cols[hstmt]
size = cols[i][HC_SIZE]
ok = c_func( SQLExtendedFetch, {getHandleODBC(hstmt), SQL_FETCH_RELATIVE,
0, 0, 0})
strlen = peek4s( cols[i][HC_STRLEN] )
end if
if strlen then
record[i] = convertData( peek( {cols[i][HC_PTR], strlen} ),
cols[i][HC_DATATYPE] )
end if
The date type is correct (91) but the peek({cols[i][HC_PTR] gets the above
representation for a date. Anyone understand this?
george
5. Re: ODBC dates
- Posted by Louis at cwshop.com
Oct 02, 2003
Well, if you got {204,7,6,0,29,0} it would have made perfect sense to me.=
In that case, the numbers are in low-high pairs, which is a common way to=
store 16 bit numbers in a byte-addressable computer.
7*256+204=3D1996
0*256+6=3D6
0*256+29=3D29
Maybe the base date is not year zero.
Louis.
*********** REPLY SEPARATOR ***********
On 10/2/2003 at 1:42 PM George Walters wrote:
>I'm using Matt's ODBC wrapper and have a question about Data base dates.
>The code below fetches a date as {201,7,6,0,29,0}
>
>when the database date is "1996-06-29"