ODBC API translation - some problems

"Theo Bebekis" <[email protected]>
Newsgroups gmane.comp.lang.delphi.jedi
Message-ID <000701c397bb$3e57b600$8100a8c0@EPEKTASIS>
Hi there

I'm trying to use the translation in order to get the DSN names
installed in a machine. So I downloaded the msODBC04.zip from 
the API convertions page.

I have encountered many probles with it...
The translation is marked as "Unknown". So first I want to ask.
Are that translation tested by anyone?


One of the functions I'm trying to call is the 
    SQLRETURN  SQL_API SQLAllocHandle(SQLSMALLINT HandleType,
           SQLHANDLE InputHandle, SQLHANDLE *OutputHandle);

The function is translated as
function SQLAllocHandle(HandleType: SQLSMALLINT;
                        InputHandle: SQLHANDLE;
                        OutputHandle: PSQLHANDLE
         ): SQLRETURN; stdcall;

SQLHANDLE is defined in Microsoft's SQLTYPES.h as
    typedef void*     SQLHANDLE;
and is translated as
   SQLHANDLE = Pointer; 

The MSDN documentation for the SQLAllocHandle() says that

" If HandleType is SQL_HANDLE_ENV, then InputHandle is SQL_NULL_HANDLE. "

HandleType is a constant which determines what type of allocation
the caller wants to be done.

SQL_NULL_HANDLE is defined in Microsoft's SQL.h as
    #define SQL_NULL_HANDLE     0L
The translator translates as 
    SQL_NULL_HANDLE       = LongInt(0); 

Trying to call the SQLAllocHandle as is 
(passing SQL_NULL_HANDLE in order to get the ODBC environment) 
results in compile time errors stating that some types are not compatible.
Converting all params and args to Pointers results in no env handle.

Converting all params and args to LongInts everything works fine.

I'm a C newbe (almost a decade now) so I want to ask the gurus here how 
this SQLHANDLE should be tranlated?

Also there are problems regarding strings too.
Calling the SQLDataSources() reveals that some of the function's params 
are defined as SQLCHAR.

SQLCHAR is defined as UCHAR which is defined as a (Pascal) Byte.

Well, I don't know the way how to pass a string where a byte is
expected. Should I pass a pointer to its first Char?

If this translation is un-tested and/or there are some bugs in it
where can I find a credible one?

My best regards
Theo

-----------------------------------
Theo Bebekis
Thessaloniki, Greece
-----------------------------------



------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for your HP, Epson, Canon or Lexmark
Printer at MyInks.com. Free s/h on orders $50 or more to the US & Canada.
http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/mOAaAA/3exGAA/qnsNAA/i7folB/TM
---------------------------------------------------------------------~->

To unsubscribe from this group, send an email to:
[email protected]

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.