Re: ODBC C API question(s)

Venu Anuganti <[email protected]>
Newsgroups gmane.comp.db.mysql.odbc
Organization Yahoo! Inc
Message-ID <[email protected]>
1. There is no direct equivalent for the mysql_fetch_lengths; But you 
could use SQLDescribeCol or SQLColAttribute(s) with SQL_ATTR_DESC_LENGTH 
to get column length. But you need to iterate through all fields like..

SQLExecDirect("select..");
SQLNumResultCols(&colCount);

for (i=1; i <= colCount; i++) {
    SQLColAttribute(colCount, SQL_ATTR_DESC_LENGTH)..
}

PS: its not a real example; but it is just a psedo code.

2. SQLDriverConnect has wrong usage; either you need to have valid 
window handle; else pass NULL for parameter 2.

3. UIDs/PWDs are optional. If you provide it overwrites the DSN UID/PWD. 
MySQL allows to store UID/PWD in DSN but few databases will not allow to 
store PWD due to security; For example; Oracle will not let you specify 
PWD in DSN.

4. For complete ODBC; check:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/dasdkodbcoverview.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcabout_this_manual.asp


Patrick Galbraith wrote:
> Hi all,
> 
> I have been using the MySQL client API for quite some time now and am in 
> the middle of utilising ODBC C API for a current project. I'm wondering 
> if there is an equivalent call in ODBC for 'mysql_fetch_lengths' ?
> 
> Also, I am wondering what the difference is between
> 
> 
> SQLDriverConnect(dbc, (void *)1, "DSN=myodbc3patg", SQL_NTS,
>       outstr, sizeof(outstr), &outstrlen,
>             SQL_DRIVER_COMPLETE);
> 
> This fails, and I don't know why.
> 
> 
> But this works:
> 
> SQLConnect(V_OD_hdbc, (SQLCHAR*) "myodbc3patg", SQL_NTS,
>  (SQLCHAR*) "", SQL_NTS,
>  (SQLCHAR*) "", SQL_NTS);
> 
> What is the difference between the two? Is there any benefit/detriment 
> to either? The first snippet is from Easysoft's site, the second from 
> the tutorial on UNIX odbc.
> 
> I often see that people use a UID/Password with  ODBC  DSN. Why use a 
> password and also a DSN? I thought the DSN provides that? If one uses a 
> DSN with UID/Pass, does the UID/Password for the DSN get over-written?
> 
> Also, where are some good sites for the ODBC C API, with examples, 
> descriptions of the API calls? I have found info at Easysoft's website 
> as well as UnixODBC website. It seems that so much ODBC programming is 
> targeted for GUIs. Mine is all system-level that I want to accomplish.
> 
> Kind regards, thanks in advance!
> 
> Patrick
> 

-- 
MySQL ODBC Mailing List
For list archives: http://lists.mysql.com/myodbc
To unsubscribe:    http://lists.mysql.com/[email protected]
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.