Re: Change to gb.db.odbc to use ODBC Connection Strings.

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

Re: Change to gb.db.odbc to use ODBC Connection Strings.

zxMarce
Benoît,

Hi. I'm attaching a quick and dirty main.c module for ODBC. I made the changes below to the latest revision in SVN.

This module includes two new calls. One to get a proper record count for statements (GetRecordCount()), and another for proper ODBC error retrieval (reportODBCError()).
I'm planning on adding the error retrieval routine to most debug calls when I finally get to tidy the module, so one can check what exactly went wrong with ODBC.

GetRecordCount() basically gets to the last record, grabs its row number and returns it as the row count. It tries not to alter the current rowset position.
If for any reason it cannot do it (for example due to having a non-scrollable rowset), it will return the usual -1 for backwards-compatibility with the original SQLRowCount().

I tested it several times with two different MSSql servers at work using different FreeTDS protocol versions and even over the internet, and it seems to work.
If you smell anything suspicious in it, just say the word!

Regards,
zxMarce.


------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Gambas-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-devel

gb.db.odbc-main.c.tar.gz (20K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Change to gb.db.odbc to use ODBC Connection Strings.

Benoît Minisini
Le 26/02/2016 12:46, ML a écrit :

> Benoît,
>
> Hi. I'm attaching a quick and dirty main.c module for ODBC. I made
> the changes below to the latest revision in SVN.
>
> This module includes two new calls. One to get a proper record count
> for statements (GetRecordCount()), and another for proper ODBC error
> retrieval (reportODBCError()). I'm planning on adding the error
> retrieval routine to most debug calls when I finally get to tidy the
> module, so one can check what exactly went wrong with ODBC.
>
> GetRecordCount() basically gets to the last record, grabs its row
> number and returns it as the row count. It tries not to alter the
> current rowset position. If for any reason it cannot do it (for
> example due to having a non-scrollable rowset), it will return the
> usual -1 for backwards-compatibility with the original
> SQLRowCount().
>
> I tested it several times with two different MSSql servers at work
> using different FreeTDS protocol versions and even over the internet,
> and it seems to work. If you smell anything suspicious in it, just
> say the word!
>
> Regards, zxMarce.
>

Hi,

I have just merged your changes, changing some spaces in the code, and
fixing the warning on 64 bits (SQLINTEGER is an int, so it requires "%d"
in fprintf, not "%ld").

I think it would be better if you commit your changes directly in the
subversion repository.

Regards,

--
Benoît Minisini

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Gambas-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-devel
Reply | Threaded
Open this post in threaded view
|

Re: Change to gb.db.odbc to use ODBC Connection Strings.

zxMarce
On 2016-03-02 17:40, Benoît Minisini wrote:

> Le 26/02/2016 12:46, ML a écrit :
>> Benoît,
>> Hi. I'm attaching a quick and dirty main.c module for ODBC. I made
>> the changes below to the latest revision in SVN.
>> This module includes two new calls. One to get a proper record count
>> for statements (GetRecordCount()), and another for proper ODBC error
>> retrieval (reportODBCError()). I'm planning on adding the error
>> retrieval routine to most debug calls when I finally get to tidy the
>> module, so one can check what exactly went wrong with ODBC.
>> GetRecordCount() basically gets to the last record, grabs its row
>> number and returns it as the row count. It tries not to alter the
>> current rowset position. If for any reason it cannot do it (for
>> example due to having a non-scrollable rowset), it will return the
>> usual -1 for backwards-compatibility with the original
>> SQLRowCount().
>> I tested it several times with two different MSSql servers at work
>> using different FreeTDS protocol versions and even over the internet,
>> and it seems to work. If you smell anything suspicious in it, just
>> say the word!
>> Regards, zxMarce.
> Hi,
> I have just merged your changes, changing some spaces in the code, and
> fixing the warning on 64 bits (SQLINTEGER is an int, so it requires "%d"
> in fprintf, not "%ld").
> I think it would be better if you commit your changes directly in the
> subversion repository.
> Regards,

Benoît,

Wow, better late than never. Just saw your response. Thank you. Still
remains the LIMIT handling and general code tidying.

Thanks a lot also for the SVN direct commit offer, I'll give it a
thought or two. I'll also get some info on SVN and how it works.
Meanwhile, since I'm not a user of SVN, just in case I'll decline: Don't
want to trash the whole of Gambas on a bad commit!

Regards,
zxMarce.


------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://makebettercode.com/inteldaal-eval
_______________________________________________
Gambas-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-devel
Reply | Threaded
Open this post in threaded view
|

Re: Change to gb.db.odbc to use ODBC Connection Strings.

Benoît Minisini
Le 07/03/2016 18:30, ML a écrit :

> On 2016-03-02 17:40, Benoît Minisini wrote:
>> Le 26/02/2016 12:46, ML a écrit :
>>> Benoît,
>>> Hi. I'm attaching a quick and dirty main.c module for ODBC. I made
>>> the changes below to the latest revision in SVN.
>>> This module includes two new calls. One to get a proper record count
>>> for statements (GetRecordCount()), and another for proper ODBC error
>>> retrieval (reportODBCError()). I'm planning on adding the error
>>> retrieval routine to most debug calls when I finally get to tidy the
>>> module, so one can check what exactly went wrong with ODBC.
>>> GetRecordCount() basically gets to the last record, grabs its row
>>> number and returns it as the row count. It tries not to alter the
>>> current rowset position. If for any reason it cannot do it (for
>>> example due to having a non-scrollable rowset), it will return the
>>> usual -1 for backwards-compatibility with the original
>>> SQLRowCount().
>>> I tested it several times with two different MSSql servers at work
>>> using different FreeTDS protocol versions and even over the internet,
>>> and it seems to work. If you smell anything suspicious in it, just
>>> say the word!
>>> Regards, zxMarce.
>> Hi,
>> I have just merged your changes, changing some spaces in the code, and
>> fixing the warning on 64 bits (SQLINTEGER is an int, so it requires "%d"
>> in fprintf, not "%ld").
>> I think it would be better if you commit your changes directly in the
>> subversion repository.
>> Regards,
>
> Benoît,
>
> Wow, better late than never. Just saw your response. Thank you. Still
> remains the LIMIT handling and general code tidying.
>
> Thanks a lot also for the SVN direct commit offer, I'll give it a
> thought or two. I'll also get some info on SVN and how it works.
> Meanwhile, since I'm not a user of SVN, just in case I'll decline: Don't
> want to trash the whole of Gambas on a bad commit!
>
> Regards,
> zxMarce.
>

This is why we use SVN : you can rollback any change, and have a history
of all of them.

Just create an account on sourceforge and give me your user name, and I
will grant you a write access.

Then read the "How to deal with Subversion" page on the wiki.

http://gambaswiki.org/wiki/howto/svn

Regards,

--
Benoît Minisini

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://makebettercode.com/inteldaal-eval
_______________________________________________
Gambas-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/gambas-devel