Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#24 Error retriving HyperFile string field as date

open
nobody
None
5
2005-07-04
2005-07-04
head123
No

An occur when a char field identified as date is blank.

I'have modified the function TSqlCursorOdbc.getDate in
DbxOpenOdbc.pas and it seems work.

with fOdbcHostVarAddress.ptrSqlDateStruct^ do
// Integer(Value^) := ((365 * 1900) + 94) + Trunc(
EncodeDate(Year, Month, Day) );
try
Integer(Value^) := ((365 * 1900) + 94) + Trunc(
EncodeDate(Year, Month, Day) );
except //EL
//Renvoyer une valeur null pur la date
IsBlank := True;
Integer(Value^) := 0
end;

Discussion

  • Logged In: YES
    user_id=644745

    Interestingly. What DBMS for you?

     
  • Logged In: YES
    user_id=644745

    Try such variant:

    function TSqlCursorOdbc.getDate(...
    ...
    IsBlank := (fColValueSizePtr^ = OdbcApi.
    SQL_NULL_DATA) or
    (fColValueSizePtr^ = OdbcApi.SQL_NO_TOTAL) or
    (fOdbcHostVarAddress.ptrAnsiChar^ = ' ');

     
  • head123
    head123
    2005-07-18

    Logged In: YES
    user_id=1307053

    The DBMS is HyperFile. It's the DBMS of the french
    developpement tools WINDEV.
    Your code works but I had to replace ' ' by ''
    So :
    function TSqlCursorOdbc.getDate(...
    ...
    IsBlank := (fColValueSizePtr^ = OdbcApi.
    SQL_NULL_DATA) or
    (fColValueSizePtr^ = OdbcApi.SQL_NO_TOTAL) or
    (fOdbcHostVarAddress.ptrAnsiChar^ = '' );

    Thanks a lot !