[Gambas Bug Tracker] Bug #1101: ODBC driver super buggy 2: rs.max return always negative and always -2 event in lasted

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Gambas Bug Tracker] Bug #1101: ODBC driver super buggy 2: rs.max return always negative and always -2 event in lasted

bugtracker
http://gambaswiki.org/bugtracker/edit?object=BUG.1101&from=L21haW4-

PICCORO LENZ MCKAY reported a new bug.

Summary
-------

ODBC driver super buggy 2: rs.max return always negative and always -2 event in lasted

Type             : Bug
Priority         : High
Gambas version   : 3.9
Product          : ODBC driver


Description
-----------

as i said in previous bug: some time ago i tried and found many bugs, but not reported due i using older linux..

tested in linuxmint, winbuntu, stupibuntu, debian lasted, and fedora
and with gambas versions from 3.1.1 to lasted (specifically 3.1.1, 3.4.2 and 3.9.X and trunk)

the next piece of code always return "-2" for Max in resulset:

Try rs = $conexionodbc.Exec(queryprices)
    If rs.Available Then  '
     
      ' BUG 2 Max from resulset in ODBC are negative!
      howmany = rsprices.Max '  <---- psst ¡always get here -2! no care the query, if there are a SP always -2

    Endif

this are very unconfortable, due for workaroud must made a select count(), that relies on another bug that i next to post right now!

for now i try to workaround with the rs.MoveNext using when


System information
------------------

[System]
Gambas=3.9.1
OperatingSystem=Linux
Kernel=3.2.0-0.bpo.4-686-pae
Architecture=x86
Distribution=debian 6.1
Desktop=
Theme=VenenuX
Language=es_VE.UTF-8
Memory=1695M

[Libraries]
Cairo=libcairo.so.2.11000.2
Curl=libcurl.so.4.2.0
DBus=libdbus-1.so.3.4.0
GStreamer=libgstreamer-0.10.so.0.27.0
GTK+2=libgtk-x11-2.0.so.0.2000.1
Poppler=libpoppler.so.5.0.0
QT4=libQtCore.so.4.7.4
SDL=libSDL-1.2.so.0.11.4
SQLite=libsqlite3.so.0.8.6

[Environment]
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-SDLMZFhfxe,guid=e84bee4349323ab2fdd0e833000d3724
DESKTOP_SESSION=openbox
DISPLAY=:0.0
GB_GUI=gb.qt4
GDMSESSION=openbox
GDM_LANG=es_VE.UTF-8
GDM_XSERVER_LOCATION=local
GNOME_KEYRING_CONTROL=/tmp/keyring-F6Av2Z
GNOME_KEYRING_PID=28945
HOME=<home>
LANG=es_VE.UTF-8
LOGNAME=<user>
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:<home>/.rvm/bin
PWD=<home>
SHELL=/bin/bash
SSH_AGENT_PID=28992
SSH_AUTH_SOCK=/tmp/ssh-MIgmw28954/agent.28954
TZ=:/etc/localtime
USER=<user>
USERNAME=<user>
WINDOWPATH=7:8:8:8:8
XAUTHORITY=<home>/.Xauthority
XDG_DATA_DIRS=/usr/local/share/:/usr/share/:/usr/share/gdm/
XDG_SESSION_COOKIE=b7d14e28769c4139a06b6f990000000c-1493388004.744958-1810097376



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Gambas Bug Tracker] Bug #1101: ODBC driver super buggy 2: rs.max return always negative and always -2 event in lasted

bugtracker
http://gambaswiki.org/bugtracker/edit?object=BUG.1101&from=L21haW4-

Comment #1 by zxMarce:

Actually, per practically any available documentation you can check, ODBC doesn't return a row count for SELECT statements.
I'll refer you to MSDN, for example (https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlrowcount-function), but you can also check IBM's docs, which say the exact same:

Quote:
  SQLRowCount Function

  Conformance
  Version Introduced: ODBC 1.0 Standards Compliance: ISO 92

  Summary
  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

So, unless some not-so-easy mechanism is implemented, no ODBC interface will return you a row count for SELECTs.
The problem implementing the mechanism is that not all queries return a Result, for example the USE <database> command in MSSQL.

A high level ODBC interface would have a ton of things to take into account just to check whether a row count is returnable, necessary or even factible.
Add to that difficulty the fact that ODBC is actually not a driver per-se, but a driver manager and the problem only gets worse, because not all drivers implement all calls.

The -2 returned is, IIRC, actually an internal flag (this could need correction) to signal some low-level Gambas interfaces how to act when using ODBC.

Regards,
zxMarce.



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Gambas Bug Tracker] Bug #1101: ODBC driver super buggy 2: rs.max return always negative and always -2 event in lasted

bugtracker
In reply to this post by bugtracker
http://gambaswiki.org/bugtracker/edit?object=BUG.1101&from=L21haW4-

Comment #2 by PICCORO LENZ MCKAY:

i noyed u only cited mocosoft papers.. dont know about mocosoft like papers..  mocosoft tendts to change everything depends of their convenience...

odbc its today standardized by SQL Access Group in the Unix and mainframe field so please cited a right paper.. not windo/like



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Gambas Bug Tracker] Bug #1101: ODBC driver super buggy 2: rs.max return always negative and always -2 event in lasted

zxMarce
In reply to this post by bugtracker
Hehe... you're right. But I also cited IBM's ODBC docs for its DB2, and you can also check Easysoft's excellent C tutorials at http://www.easysoft.com/developer/languages/c/odbc_tutorial.html. Speaking about Easysoft, I myself made a command line ODBC tool to connect with ConnectionStrings and run queries in C with Easysoft's tutorials... And I absolutely suck at C. That good are those tutorials!

Also, in case you didn't know, Microsoft was one of the leading forces behind drafting ODBC, as this quote from Wikipedia says:

ODBC was originally developed by Microsoft and Progress DataDirect during the early 1990s, and became the basis for the Call Level Interface (CLI) standardized by SQL Access Group in the Unix and mainframe field.

So by using their docs you know that that is the standard. Well, at least theirs... They suck at Windows (and OS making and privacy respecting in general), yes, but they sometimes pull nice tricks off their hats like ODBC. And that is not the only standard they helped draft.

But anyway both MS and IBM  (at least when I read the docs to make the Gambas component work again) were kind enough to mark clearly any deviations or differences from the standard in their ODBC docs.

Hope that helps,
zxMarce.

On May 3, 2017, 21:19, at 21:19, [hidden email] wrote:

>http://gambaswiki.org/bugtracker/edit?object=BUG.1101&from=L21haW4-
>
>Comment #2 by PICCORO LENZ MCKAY:
>
>i noyed u only cited mocosoft papers.. dont know about mocosoft like
>papers..  mocosoft tendts to change everything depends of their
>convenience...
>
>odbc its today standardized by SQL Access Group in the Unix and
>mainframe field so please cited a right paper.. not windo/like
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Gambas Bug Tracker] Bug #1101: ODBC driver super buggy 2: rs.max return always negative and always -2 event in lasted

PICCORO McKAY Lenz
2017-05-03 22:04 GMT-04:00 <[hidden email]>:

> Also, in case you didn't know, Microsoft was one of the leading forces
> behind drafting

yeah.. i use sybase the original software behind the SQL server and the
only way to connect to its odbc (inclusivelly internally always used odbc
bridgeds, so then m$ its reasonable to are behind that papers)


> But anyway both MS and IBM  (at least when I read the docs to make the
> Gambas component work again) were kind enough to mark clearly any
> deviations or differences from the standard in their ODBC docs.
>
u are the mantainer and author of the ODBC componet? i used extensivelly
the ODBC component and i was thinking that i'm the only used deeply..
tomorrow i'll test again a SP that will retrieve a thousands  of rows...
(currently i make it with a dummy table, production will retrieve thousands)


>
> Hope that helps,
> zxMarce.
>
> On May 3, 2017, 21:19, at 21:19, [hidden email] wrote:
> >http://gambaswiki.org/bugtracker/edit?object=BUG.1101&from=L21haW4-
> >
> >Comment #2 by PICCORO LENZ MCKAY:
> >
> >i noyed u only cited mocosoft papers.. dont know about mocosoft like
> >papers..  mocosoft tendts to change everything depends of their
> >convenience...
> >
> >odbc its today standardized by SQL Access Group in the Unix and
> >mainframe field so please cited a right paper.. not windo/like
> ------------------------------------------------------------
> ------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, Slashdot.org! http://sdm.link/slashdot
> _______________________________________________
> Gambas-user mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Gambas Bug Tracker] Bug #1101: ODBC driver super buggy 2: rs.max return always negative and always -2 event in lasted

bugtracker
In reply to this post by bugtracker
http://gambaswiki.org/bugtracker/edit?object=BUG.1101&from=L21haW4-

Comment #3 by zxMarce:

(sorry for the delay in replying)

Hehe... you're right. But I also quoted IBM's ODBC docs for its DB2, and you can also check Easysoft's excellent C tutorials at http://www.easysoft.com/developer/languages/c/odbc_tutorial.html. Speaking about Easysoft, I myself made a command line ODBC tool to connect with ConnectionStrings and run queries in C with Easysoft's tutorials... And I absolutely suck at C. That good are those tutorials!

Also, in case you didn't know, Microsoft was one of the leading forces behind drafting ODBC, as this quote from Wikipedia says:

"ODBC was originally developed by Microsoft and Progress DataDirect during the early 1990s, and became the basis for the Call Level Interface (CLI) standardized by SQL Access Group in the Unix and mainframe field."

So by using their docs you know that that is the standard. Well, at least theirs... They suck at Windows (and OS making and privacy respecting in general), yes, but they sometimes pull nice tricks off their hats like ODBC. And that is not the only standard they helped draft.

But anyway both MS and IBM (at least when I read the docs to make the Gambas component work again) were kind enough to mark clearly any deviations or differences from the standard in their ODBC docs.

Hope that helps,
zxMarce.



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Gambas Bug Tracker] Bug #1101: ODBC driver super buggy 2: rs.max return always negative and always -2 event in lasted

bugtracker
In reply to this post by bugtracker
http://gambaswiki.org/bugtracker/edit?object=BUG.1101&from=L21haW4-

Comment #4 by PICCORO LENZ MCKAY:

for close this bug, we need >
* or update the gambas wiki documentation (please all languajes)
* or provide better handle of the rs.count that perdon me, its very confuse provide such method and no retrieve desired results

the gambas documentation said http://gambaswiki.org/wiki/comp/gb.db/result/max that returns rs.cound -1 but the rs.count return -1 so this always return -1..

as ZXMARGE said many odbc layers does not provide mechanish to count and offer those values

if there its the case, and some implementations are planned this must be market in the wiki or let open this bug for now.. i'll watching it!

I noted a obvous problem here! too many mysql here! my-poor-sql its not the only DB in the world!



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Gambas Bug Tracker] Bug #1101: ODBC driver super buggy 2: rs.max return always negative and always -2 event in lasted

bugtracker
In reply to this post by bugtracker
http://gambaswiki.org/bugtracker/edit?object=BUG.1101&from=L21haW4-

Comment #5 by Benoît MINISINI:

I have updated the documentation of the Result.Count property, to explain that ODBC connections may return the -1 value.



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Gambas Bug Tracker] Bug #1101: ODBC driver super buggy 2: rs.max return always negative and always -2 event in lasted

bugtracker
In reply to this post by bugtracker
http://gambaswiki.org/bugtracker/edit?object=BUG.1101&from=L21haW4-

Comment #6 by PICCORO LENZ MCKAY:

hello all, based on documentation from ZXMARGE the count must retunr in INSERTS at leaast. .but seems not! so MAX neither!



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gambas-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-user
Loading...