Skip to Content.
Sympa Menu

freetds - [freetds] SQLRowCount problem with freeTDS+unixODBC+PHP with MSSQL

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Roger "Pe�a" Escobio <orkcu AT yahoo.com>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] SQLRowCount problem with freeTDS+unixODBC+PHP with MSSQL
  • Date: Fri, 16 Dec 2005 12:43:44 -0800 (PST)


I am having problems with the combination:
freeTDS+unixODBC+php-odbc in my Linux server

I had been looking for an explanation or at least a
reply, but no one did :-(
I sent an e-mail to one of the developers of php-odbc
module, also to the unixODBC support mailling list, no
reply yet :-(
now I am e-mailling this list after found it in the
freeTDS site and after look into it's archives , maybe
someone here can help me, I hope so :-)

the following forwarded messages is a complete
explanation of my problem
but this is a quick sumary:
I can't retrive the correct RowCount after a 'select'
query, nor do I can call another query, but if I run
across all the result (either with odbc_fetch_row() of
odbc_result_all() ) I can get the _right_ RowCount and
execute another SQL query

another problem is that the "row pointer", the one
that allow to retrive a particular row from the
result, do not work at all :-(

I am using:
freetds-0.63-1.2.el4.rf
unixODBC-2.2.11-6_CentOS4
php-4.3.9-3.9

in a CentOS-4.2+update

roger

--- Roger Pe�a Escobio <orkcu AT yahoo.com> wrote:

> Date: Tue, 13 Dec 2005 05:01:24 -0800 (PST)
> From: Roger "Pe�a" Escobio <orkcu AT yahoo.com>
> Subject: Re: [unixODBC-support] update: [no]
> differences between
> php_odbc_nun_rows and isql command output
> To: Support for the unixODBC project
> <unixodbc-support AT easysoft.com>
>
> Hi, I am going to top post my messages because it is
> un update .
>
> Now, after looking deeper in the problem, I found
> that
> php odbc module can return the right SQLRowCount
> value, but you must get/retrive all the information
> from the odbc handle, for example, if you make a
> 'select' query you must to get all the rows with
> odbc_fetch_row() or odbc_result_all() for example
> like
> this:
> while (odbc_fetch_row($result)) {};
>
> after that, you can call the function
> odbc_num_rows()
> and get the right number of row retrived, if you do
> not run odbc_fetch_row() for all the rows, you will
> get -1 always from odbc_num_rows()
>
> there is another problem, that I think is close
> relaited with the problem of SQLRowCount, with the
> php
> odbc module you can not do two odbc_exec() in the
> same
> script without free the first result or, and this is
> what I fond yesterday and what make me think that
> this
> problem is related with the first one, run for all
> the first result, just like when you want to find
> the
> NumRows.
>
> for me, a complete newbe, this is a problem with the
> correct set of the handle, but you might get another
> explanation, maybe this is the right aproach and
> right behaivor, I don't know, what do you think?
> shoud I report this to freeTDS team or this is a
> unixODBC topic ?
>
> thanks
> roger
> PD: appologies for my bad english :-(
>
> --- Roger Pe�a Escobio <orkcu AT yahoo.com> wrote:
>
> > Hi
> > please appologies for asking php stuff in this
> list,
> > but I coundn't find any other place where to ask
> > about
> > odbc specific problems with php
> >
> > I am having problems with the odbc_nun_rows() php
> > function to get the number of rows I get from a
> > query,
> > it always return -1 (from the php site it looks
> that
> > it is a very common problem) but when I run the
> same
> > query with isql command I get the right
> results.....
> >
> > my next stept was to find any difference in the
> way
> > each client ask for the num_rows, but both use the
> > same SQL function: SQLRowCount() prety much in the
> > same way :-(
> > I get stuck
> > so anybody here know the reason of this behaivor
> or
> > just may help me to continue the research to find
> > and
> > fix this bug ?
> >
> > both clients: php and isql, use the same
> enviroment:
> > unixODBC and freeTDS packages, MSSQL-2k server
> > [roger@sauron ~]$ rpm -q unixODBC
> > unixODBC-2.2.9-1
> > [roger@sauron ~]$ rpm -q freetds
> > freetds-0.63-1.2.el4.rf
> > [roger@sauron ~]$
> >
> > and CentOS-4.2+updates linux distribution
> > addicional information: I compiled the most recent
> > php4 (4.4.1) with no diffence with the one supply
> by
> > the distribution
> >
> > thanks in advance for any tip
> >
> > roger
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam? Yahoo! Mail has the best spam
> > protection around
> > http://mail.yahoo.com
> > _______________________________________________
> > unixODBC-support mailing list
> > unixODBC-support AT easysoft.com
> >
>
http://mail.easysoft.com/mailman/listinfo/unixodbc-support
> >
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam
> protection around
> http://mail.yahoo.com
> _______________________________________________
> unixODBC-support mailing list
> unixODBC-support AT easysoft.com
>
http://mail.easysoft.com/mailman/listinfo/unixodbc-support
>



__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com



  • [freetds] SQLRowCount problem with freeTDS+unixODBC+PHP with MSSQL, Peña, 12/16/2005

Archive powered by MHonArc 2.6.24.

Top of Page