odbc a way to know if a sql DDL was susessfully or not?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

odbc a way to know if a sql DDL was susessfully or not?

PICCORO McKAY Lenz
due the odbc does not provide a record count like mysql does (cos provider
may o nor offer) on every sql query..

how we can know if a DDL sql (i mean a select, a dropt table, or a create
table) was excecuted using the result object and without a try catch method?


Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com
------------------------------------------------------------------------------
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
|

Re: odbc a way to know if a sql DDL was susessfully or not?

Benoît Minisini
Le 24/05/2017 à 15:47, PICCORO McKAY Lenz a écrit :
> due the odbc does not provide a record count like mysql does (cos provider
> may o nor offer) on every sql query..
>
> how we can know if a DDL sql (i mean a select, a dropt table, or a create
> table) was excecuted using the result object and without a try catch method?
>
>
> Lenz McKAY Gerardo (PICCORO)
> http://qgqlochekone.blogspot.com

The record count is only for Result objects. So you should not get it
for a CREATE or a DROP TABLE statement.

A record count of -1 means that you have to use the MoveNext() method
until the Available property is False to get each record. Once done,
then you know how many records you get.

I think the reason is that the underlying ODBC driver sends the result
line by line, whereas the others (MySQL, PostgreSQL and SQLite drivers)
send all the lines by default.

Maybe the ODBC driver should store the entire query result in memory to
simulate a standard Result object when it is internally "move forward" only?

--
Benoît Minisini

------------------------------------------------------------------------------
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
|

Re: odbc a way to know if a sql DDL was susessfully or not?

PICCORO McKAY Lenz
please pardom me, i explain me better:

i mean: how can i know if a DDL like CREATE or DROP TABLE was executed
correctly without error , using the result object and not a try/catch block!

Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com

2017-05-24 9:58 GMT-04:00 Benoît Minisini <[hidden email]>:

> Le 24/05/2017 à 15:47, PICCORO McKAY Lenz a écrit :
>
>> due the odbc does not provide a record count like mysql does (cos provider
>> may o nor offer) on every sql query..
>>
>> how we can know if a DDL sql (i mean a select, a dropt table, or a create
>> table) was excecuted using the result object and without a try catch
>> method?
>>
>>
>> Lenz McKAY Gerardo (PICCORO)
>> http://qgqlochekone.blogspot.com
>>
>
> The record count is only for Result objects. So you should not get it for
> a CREATE or a DROP TABLE statement.
>
> A record count of -1 means that you have to use the MoveNext() method
> until the Available property is False to get each record. Once done, then
> you know how many records you get.
>
> I think the reason is that the underlying ODBC driver sends the result
> line by line, whereas the others (MySQL, PostgreSQL and SQLite drivers)
> send all the lines by default.
>
> Maybe the ODBC driver should store the entire query result in memory to
> simulate a standard Result object when it is internally "move forward" only?
>
> --
> Benoît Minisini
>
------------------------------------------------------------------------------
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
|

Re: odbc a way to know if a sql DDL was susessfully or not?

PICCORO McKAY Lenz
umm any idea : how can i know if using odbc a DDL like CREATE or DROP TABLE
was executed correctly without error , BUT using the result object and not
a try/catch block!

Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com

2017-05-24 10:07 GMT-04:00 PICCORO McKAY Lenz <[hidden email]>:

> please pardom me, i explain me better:
>
> i mean: how can i know if a DDL like CREATE or DROP TABLE was executed
> correctly without error , using the result object and not a try/catch block!
>
> Lenz McKAY Gerardo (PICCORO)
> http://qgqlochekone.blogspot.com
>
> 2017-05-24 9:58 GMT-04:00 Benoît Minisini <[hidden email]>:
>
>> Le 24/05/2017 à 15:47, PICCORO McKAY Lenz a écrit :
>>
>>> due the odbc does not provide a record count like mysql does (cos
>>> provider
>>> may o nor offer) on every sql query..
>>>
>>> how we can know if a DDL sql (i mean a select, a dropt table, or a create
>>> table) was excecuted using the result object and without a try catch
>>> method?
>>>
>>>
>>> Lenz McKAY Gerardo (PICCORO)
>>> http://qgqlochekone.blogspot.com
>>>
>>
>> The record count is only for Result objects. So you should not get it for
>> a CREATE or a DROP TABLE statement.
>>
>> A record count of -1 means that you have to use the MoveNext() method
>> until the Available property is False to get each record. Once done, then
>> you know how many records you get.
>>
>> I think the reason is that the underlying ODBC driver sends the result
>> line by line, whereas the others (MySQL, PostgreSQL and SQLite drivers)
>> send all the lines by default.
>>
>> Maybe the ODBC driver should store the entire query result in memory to
>> simulate a standard Result object when it is internally "move forward" only?
>>
>> --
>> Benoît Minisini
>>
>
>
------------------------------------------------------------------------------
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
|

Re: odbc a way to know if a sql DDL was susessfully or not?

Cristiano Guadagnino
PICCORO, the usual way to know if a sql statement succeeded or not is by
checking the sqlcode.
Negative sqlcodes indicate a problem.
Odbc should support returning sqlcodes to the caller.
Can you check if you have any sqlcodes returned to you in the results?
Oh and btw... What's wrong with using a try/catch?

Cris


Il 24 mag 2017 7:35 PM, "PICCORO McKAY Lenz" <[hidden email]> ha
scritto:

> umm any idea : how can i know if using odbc a DDL like CREATE or DROP TABLE
> was executed correctly without error , BUT using the result object and not
> a try/catch block!
>
> Lenz McKAY Gerardo (PICCORO)
> http://qgqlochekone.blogspot.com
>
> 2017-05-24 10:07 GMT-04:00 PICCORO McKAY Lenz <[hidden email]>:
>
> > please pardom me, i explain me better:
> >
> > i mean: how can i know if a DDL like CREATE or DROP TABLE was executed
> > correctly without error , using the result object and not a try/catch
> block!
> >
> > Lenz McKAY Gerardo (PICCORO)
> > http://qgqlochekone.blogspot.com
> >
> > 2017-05-24 9:58 GMT-04:00 Benoît Minisini <[hidden email]>
> :
> >
> >> Le 24/05/2017 à 15:47, PICCORO McKAY Lenz a écrit :
> >>
> >>> due the odbc does not provide a record count like mysql does (cos
> >>> provider
> >>> may o nor offer) on every sql query..
> >>>
> >>> how we can know if a DDL sql (i mean a select, a dropt table, or a
> create
> >>> table) was excecuted using the result object and without a try catch
> >>> method?
> >>>
> >>>
> >>> Lenz McKAY Gerardo (PICCORO)
> >>> http://qgqlochekone.blogspot.com
> >>>
> >>
> >> The record count is only for Result objects. So you should not get it
> for
> >> a CREATE or a DROP TABLE statement.
> >>
> >> A record count of -1 means that you have to use the MoveNext() method
> >> until the Available property is False to get each record. Once done,
> then
> >> you know how many records you get.
> >>
> >> I think the reason is that the underlying ODBC driver sends the result
> >> line by line, whereas the others (MySQL, PostgreSQL and SQLite drivers)
> >> send all the lines by default.
> >>
> >> Maybe the ODBC driver should store the entire query result in memory to
> >> simulate a standard Result object when it is internally "move forward"
> only?
> >>
> >> --
> >> Benoît Minisini
> >>
> >
> >
> ------------------------------------------------------------
> ------------------
> 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
|

Re: odbc a way to know if a sql DDL was susessfully or not?

PICCORO McKAY Lenz
2017-05-24 14:21 GMT-04:00 Cristiano Guadagnino <[hidden email]>:

> PICCORO, the usual way to know if a sql statement succeeded or not is by
> checking the sqlcode.
> Negative sqlcodes indicate a problem.
> Odbc should support returning sqlcodes to the caller.
> Can you check if you have any sqlcodes returned to you in the results?
>
oh men i not cheked that.. i asumed always return -1

lest try and report feedback here!


> Oh and btw... What's wrong with using a try/catch?
>
> Cris
>
>
> Il 24 mag 2017 7:35 PM, "PICCORO McKAY Lenz" <[hidden email]> ha
> scritto:
>
> > umm any idea : how can i know if using odbc a DDL like CREATE or DROP
> TABLE
> > was executed correctly without error , BUT using the result object and
> not
> > a try/catch block!
> >
> > Lenz McKAY Gerardo (PICCORO)
> > http://qgqlochekone.blogspot.com
> >
> > 2017-05-24 10:07 GMT-04:00 PICCORO McKAY Lenz <[hidden email]>:
> >
> > > please pardom me, i explain me better:
> > >
> > > i mean: how can i know if a DDL like CREATE or DROP TABLE was executed
> > > correctly without error , using the result object and not a try/catch
> > block!
> > >
> > > Lenz McKAY Gerardo (PICCORO)
> > > http://qgqlochekone.blogspot.com
> > >
> > > 2017-05-24 9:58 GMT-04:00 Benoît Minisini <
> [hidden email]>
> > :
> > >
> > >> Le 24/05/2017 à 15:47, PICCORO McKAY Lenz a écrit :
> > >>
> > >>> due the odbc does not provide a record count like mysql does (cos
> > >>> provider
> > >>> may o nor offer) on every sql query..
> > >>>
> > >>> how we can know if a DDL sql (i mean a select, a dropt table, or a
> > create
> > >>> table) was excecuted using the result object and without a try catch
> > >>> method?
> > >>>
> > >>>
> > >>> Lenz McKAY Gerardo (PICCORO)
> > >>> http://qgqlochekone.blogspot.com
> > >>>
> > >>
> > >> The record count is only for Result objects. So you should not get it
> > for
> > >> a CREATE or a DROP TABLE statement.
> > >>
> > >> A record count of -1 means that you have to use the MoveNext() method
> > >> until the Available property is False to get each record. Once done,
> > then
> > >> you know how many records you get.
> > >>
> > >> I think the reason is that the underlying ODBC driver sends the result
> > >> line by line, whereas the others (MySQL, PostgreSQL and SQLite
> drivers)
> > >> send all the lines by default.
> > >>
> > >> Maybe the ODBC driver should store the entire query result in memory
> to
> > >> simulate a standard Result object when it is internally "move forward"
> > only?
> > >>
> > >> --
> > >> Benoît Minisini
> > >>
> > >
> > >
> > ------------------------------------------------------------
> > ------------------
> > 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
>
------------------------------------------------------------------------------
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
|

Re: odbc a way to know if a sql DDL was susessfully or not?

Benoît Minisini
Le 24/05/2017 à 20:30, PICCORO McKAY Lenz a écrit :

> 2017-05-24 14:21 GMT-04:00 Cristiano Guadagnino <[hidden email]>:
>
>> PICCORO, the usual way to know if a sql statement succeeded or not is by
>> checking the sqlcode.
>> Negative sqlcodes indicate a problem.
>> Odbc should support returning sqlcodes to the caller.
>> Can you check if you have any sqlcodes returned to you in the results?
>>
> oh men i not cheked that.. i asumed always return -1
>
> lest try and report feedback here!
>
>
>> Oh and btw... What's wrong with using a try/catch?
>>
>> Cris
>>
Failing SQL statements must raise en error that you have to catch with
the TRY or CATCH instructions.

Regards,

--
Benoît Minisini

------------------------------------------------------------------------------
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
|

Re: odbc a way to know if a sql DDL was susessfully or not?

PICCORO McKAY Lenz
In reply to this post by PICCORO McKAY Lenz
2017-05-24 14:30 GMT-04:00 PICCORO McKAY Lenz <[hidden email]>:

> 2017-05-24 14:21 GMT-04:00 Cristiano Guadagnino <[hidden email]>:
>
>> PICCORO, the usual way to know if a sql statement succeeded or not is by
>> checking the sqlcode.
>> Negative sqlcodes indicate a problem.
>> Odbc should support returning sqlcodes to the caller.
>> Can you check if you have any sqlcodes returned to you in the results?
>>
>
the code return as -1 meas TRUE in gambas, and where when false? i found
that behaviour:
1) if the sql was correct, returns "-1" that in gambas means TRUE (very
confusin respect odbc)
2) if the sql are bad or invalid, retun a null object so there's no "-1" or
whatever possible check!!!
3) if the sql are correct but the resuilt are not expected (i mean there's
no rows in table) returns "-1" too, that's the problem






> oh men i not cheked that.. i asumed always return -1
>
> lest try and report feedback here!
>
>
>> Oh and btw... What's wrong with using a try/catch?
>>
>> Cris
>>
>>
>> Il 24 mag 2017 7:35 PM, "PICCORO McKAY Lenz" <[hidden email]> ha
>> scritto:
>>
>> > umm any idea : how can i know if using odbc a DDL like CREATE or DROP
>> TABLE
>> > was executed correctly without error , BUT using the result object and
>> not
>> > a try/catch block!
>> >
>> > Lenz McKAY Gerardo (PICCORO)
>> > http://qgqlochekone.blogspot.com
>> >
>> > 2017-05-24 10:07 GMT-04:00 PICCORO McKAY Lenz <[hidden email]>:
>> >
>> > > please pardom me, i explain me better:
>> > >
>> > > i mean: how can i know if a DDL like CREATE or DROP TABLE was executed
>> > > correctly without error , using the result object and not a try/catch
>> > block!
>> > >
>> > > Lenz McKAY Gerardo (PICCORO)
>> > > http://qgqlochekone.blogspot.com
>> > >
>> > > 2017-05-24 9:58 GMT-04:00 Benoît Minisini <
>> [hidden email]>
>> > :
>> > >
>> > >> Le 24/05/2017 à 15:47, PICCORO McKAY Lenz a écrit :
>> > >>
>> > >>> due the odbc does not provide a record count like mysql does (cos
>> > >>> provider
>> > >>> may o nor offer) on every sql query..
>> > >>>
>> > >>> how we can know if a DDL sql (i mean a select, a dropt table, or a
>> > create
>> > >>> table) was excecuted using the result object and without a try catch
>> > >>> method?
>> > >>>
>> > >>>
>> > >>> Lenz McKAY Gerardo (PICCORO)
>> > >>> http://qgqlochekone.blogspot.com
>> > >>>
>> > >>
>> > >> The record count is only for Result objects. So you should not get it
>> > for
>> > >> a CREATE or a DROP TABLE statement.
>> > >>
>> > >> A record count of -1 means that you have to use the MoveNext() method
>> > >> until the Available property is False to get each record. Once done,
>> > then
>> > >> you know how many records you get.
>> > >>
>> > >> I think the reason is that the underlying ODBC driver sends the
>> result
>> > >> line by line, whereas the others (MySQL, PostgreSQL and SQLite
>> drivers)
>> > >> send all the lines by default.
>> > >>
>> > >> Maybe the ODBC driver should store the entire query result in memory
>> to
>> > >> simulate a standard Result object when it is internally "move
>> forward"
>> > only?
>> > >>
>> > >> --
>> > >> Benoît Minisini
>> > >>
>> > >
>> > >
>> > ------------------------------------------------------------
>> > ------------------
>> > 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
>>
>
>

------------------------------------------------------------------------------
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

error-odbc.png (39K) Download Attachment