[Gambas-user] result from select can be movefirts from ODBC?

d4t4full at ...626... d4t4full at ...626...
Sun May 21 19:03:05 CEST 2017


Piccoro,

All .MoveXXX methods except .MoveNext need a record count from the provider. You know that ODBC does not provide one, but some drivers do, and I also patched the component to try to fetch this count when possible.

Now, the driver may NOT be correctly configured in unixODBC, allowing some issues. For example, if I use FreeTDS with a Server_Version of 7.0 and try to connect to a MSSQL2005, the compinent will not be able to fetch rec counts even with the patch I mentioned. But if I just change the Server_Version to 7.2, voilà: I get record counts via the patch.

This is because FreeTDS will not allow (nor ODBC will emulate) cursors with the first version combination. But it will with the second.  Cursors is what enable a result set to skip back and forth. The patch simply remembers where the cursor is (if it exists), then jumps to the last record and fetches its ordinal; then it goes back to where it was originally, and returns the record count. But for all this to work both ODBC and the driver must somehow support cursors, either by design or emulated.

If you use the component test project I attached to one of your bug reports, enable GB.Debug and try your connection string (for these tests it's  best to try connstrings so you don't have to edit INIs like crazy just to test), the console will tell you whether cursors are present or not.

Bear in mind that it is possible to have cursors available but not a proper Gambas RecordCount though.

Hope it helps,
zxMarce.


On May 21, 2017, 12:41, at 12:41, PICCORO McKAY Lenz <mckaygerhard at ...1963....> wrote:
>now after some messaged between fabian and me, i continue in the list
>the
>problemm
>
>thanks fabian.. do you see that moveto do not permit due the grid does
>not
>fill in order.. so when the data event are raised the index are not
>secuencial so a "foward only" problem happened....
>
>and now u count and then send again the select:
>
>
>  $Result = db.Exec("select count(*) irows from sys_productos")
>  $iCount = $Result!irows
>
>$Result = db.Exec("select * from sys_productos") <- in sybase odbc
>seems
>this does not work afete a count using select
>
>
>seems there's a problem in odbc, this was i do in firts, but does not
>work,
>maybe i do in bad way..
>
>due right now i not have the odbc environment.. i'll test monday and
>post
>feedback here.. but seems the odbc module in gambas has a problem in
>this
>way, due does not permit make that.. or at least does not permit
>retrieve
>the results after made a select count
>
>
>Lenz McKAY Gerardo (PICCORO)
>http://qgqlochekone.blogspot.com
>
>2017-05-19 2:59 GMT-04:30 Fabien Bodard <gambas.fr at ...626...>:
>
>> 2017-05-18 17:13 GMT+02:00 PICCORO McKAY Lenz
><mckaygerhard at ...626...>:
>> > yes tobias, I already know.- in last years some bugs where
>discovered by
>> me
>> > ... the surprise its that those bugs were inside gambas since some
>time
>> ..
>> > that's probe that the usage of was very few and limited .. (i mean
>too
>> many
>> > mysql )
>> >
>> > but now i can not use, the corporation now used odbc for standard
>and
>> > gundows integration ... so i must use odbc inclusivelly for mysql
>!!!
>> Arrggg
>> >
>> > so now i implement your solution, and recors fill the grid .. but
>when i
>> > separate the database logic from the form .. now the recorset gives
>me
>> the
>> > "only forward" error ...
>> >
>> > i try to attadhed the project example ... some one can helpme? the
>mail
>> > list cut the message! i cannot attach project!
>>
>> send it to me :
>>
>> gambas.fr at ...626...
>> >
>> > Lenz McKAY Gerardo (PICCORO)
>> > http://qgqlochekone.blogspot.com
>> >
>> > 2017-05-17 18:49 GMT-04:00 Tobias Boege <taboege at ...626...>:
>> >
>> >> On Thu, 18 May 2017, Cristiano Guadagnino wrote:
>> >> > If your complaint is due to the fact that the only native
>> implementation
>> >> > for Gambas is the Mysql one, you have to understand that Mysql
>> (usually
>> >> in
>> >> > the form of MariaDB) is available on all linux distributions and
>it is
>> >> > free.
>> >> > One other free DBMS available for all linuxes is Postgresql, but
>this
>> is
>> >> > not even nearly as widely used as Mysql. I would not be very
>surprised
>> >> if,
>> >> > in fact, the great majority of Gambas developers were using
>Mysql.
>> What's
>> >> > wrong with that?
>> >> >
>> >>
>> >> (Just a quick interjection: Gambas does have a native PostgreSQL
>> driver.)
>> >>
>> >> --
>> >> "There's an old saying: Don't change anything... ever!" -- Mr.
>Monk
>> >>
>> >> ------------------------------------------------------------
>> >> ------------------
>> >> 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
>> >> Gambas-user at lists.sourceforge.net
>> >> 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
>> > Gambas-user at lists.sourceforge.net
>> > https://lists.sourceforge.net/lists/listinfo/gambas-user
>>
>>
>>
>> --
>> Fabien Bodard
>>
>> ------------------------------------------------------------
>> ------------------
>> 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
>> Gambas-user at lists.sourceforge.net
>> 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
>Gambas-user at lists.sourceforge.net
>https://lists.sourceforge.net/lists/listinfo/gambas-user



More information about the User mailing list