Menu

#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

  • Vadim V.Lopushanskiy

    Logged In: YES
    user_id=644745

    Interestingly. What DBMS for you?

     
  • Vadim V.Lopushanskiy

    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 !

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.