[Gambas-devel] Gambas & ODBC
Andrea Bortolan
andrea_bortolan at ...112...
Mon Jan 10 10:24:26 CET 2005
--- Benoit Minisini <gambas at ...1...> ha
scritto:
> Can you try to use english variable names and, more
> important, english error
> messages in your code please ?
Yes of course, probably I missed somethings in the
code review, Sorry.
>
> I didn't understand why you had to to modify
> Result.c ? Your commentary is not
> clear. There is NO reason that the fact that ODBC
> function returns (-1) when
> the query is OK goes out from the ODBC driver.
>
> Can you give me more precision ?
>
In ODBC the Execute API or the ExecDirect API are
capable to submit the SQL statement to the ODBC
driver. Those API return the info about the sql
execution, if all worked ok or if an error occurred.
If the query executed ok those API reurn SQL_SUCCESS.
After the execute statement you can decide to retrieve
the result set informations: number and type of
coloumns, number or row affected by the SQL ecc.
In order to get the number of row affected by the sql
submitted there is only one ODBC API :SQLRowCount.
The ODBC reference of this function is :
SQLRowCount returns the number of rows affected by an
UPDATE, INSERT, or DELETE statement; an SQL_ADD,
SQL_UPDATE_BY_BOOKMARK, or SQL_DELETE_BY_BOOKMARK
operation in SQLBulkOperations; or an SQL_UPDATE or
SQL_DELETE operation in SQLSetPos.
As you can see if the SQL statement is a SELECT *...
this function does not return the number of rows
selected.
Many ODBC driver however are capable to returns the
number of rows selecet even if this is not the
standard and is not in the ODBC specificatio, MySQL is
one . But not all ODBC driver can do this....the
iSeries ODBC driver cannot. So in order to have a code
that wors following the ODBC specification and the
standard I modified the Result.c in order to add a
check on the number of rows. In case the row variable
is -1 I force a fetch on the result. If there are no
more data in the result, the ODBC rise an error that
must be catched by the application to get the end of
data and to stop fetching.
Please help me in finding a better way to implement
this part of code, I'm not a developer and probably I
miss something.
Thank for your help, Andrea.
___________________________________
Nuovo Yahoo! Messenger: E' molto più divertente: Audibles, Avatar, Webcam, Giochi, Rubrica
Scaricalo ora!
http://it.messenger.yahoo.it
More information about the Devel
mailing list