freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
Re: [freetds] Warning: odbc_exec() [function.odbc-exec]: SQL error: [unixODBC][FreeTDS][SQL Server]Invalid cursor state, SQL state 24000 in SQLExecDirect in
- From: Ran September <ran.september AT gmail.com>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] Warning: odbc_exec() [function.odbc-exec]: SQL error: [unixODBC][FreeTDS][SQL Server]Invalid cursor state, SQL state 24000 in SQLExecDirect in
- Date: Wed, 18 Feb 2009 21:20:34 -0800
>I can't tell from your script what the relationship is between gages and
>mpc_web_users. There doesn't seem to be any; the results of the first
>query don't seem to affect $userid, which is what's used as a key in the
>second query.
well actually, i am not the one who created the script. i'm just here to
make freetds work but since freetds can't handle one active statement at a
time; i might as well re-program the scripts. gages and mpc_web_users are
both table in a database.
Thanks for letting me know the function of the 'left outer join' I will work
hard on this one. :-)
On Wed, Feb 18, 2009 at 8:33 PM, James K. Lowden <jklowden AT freetds.org>wrote:
> Ran September wrote:
> > i will try to become a "better programmer" :-D
>
> And so you are doing. :-)
>
> > although i didn't get the "outer join to mpc_web_users" part
>
>
> http://publib.boulder.ibm.com/infocenter/rbhelp/v6r3/index.jsp?topic=/com.ibm.redbrick.doc6.3/ssg/ssg74.htm
> http://en.wikipedia.org/wiki/Join_(SQL)#Outer_joins<http://en.wikipedia.org/wiki/Join_%28SQL%29#Outer_joins>
>
> I can't tell from your script what the relationship is between gages and
> mpc_web_users. There doesn't seem to be any; the results of the first
> query don't seem to affect $userid, which is what's used as a key in the
> second query.
>
> If $userid is invariant within the loop, the second query could be
> factored out. Get the row(s) from mpc_web_users, then proceed with gages.
>
>
> If the two are related -- if the row you want from mpc_web_users varies
> with the data you fetch from gages -- then fetch both parts at once,
> something like:
>
> SELECT g.*, U.nusers
> FROM gages as g
> left outer join (
> select count(*) as nusers, user_name
> from mpc_web_users
> ) as U
> on g.something = U.user_name
> where company = '$custid'
> and gage_sn ='$sn'
>
> That's just one approach. Depending on your data and exactly what you're
> trying to do, several alternatives come to mind. Cf. "cross join".
>
> All to say: SQL is your friend. Learn it. Use it. Exploit it. Not to be
> a better programmer, however nice that might be, but to work less. Create
> more from less code by letting the database do the work for you. If
> you're going to spend your day scripting webservers, I can't offer better
> advice.
>
> > but is it true that installing the mssql.so will solve this?
>
> No. Please re-read the faq. Remember: "one active statement at a time
> per connection" is a property of the *protocol*. The server won't accept
> a second query until it's done answering the first one.
>
> --jkl
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
>
--
R
-
[freetds] Warning: odbc_exec() [function.odbc-exec]: SQL error: [unixODBC][FreeTDS][SQL Server]Invalid cursor state, SQL state 24000 in SQLExecDirect in,
Ran September, 02/18/2009
-
Re: [freetds] Warning: odbc_exec() [function.odbc-exec]: SQL error: [unixODBC][FreeTDS][SQL Server]Invalid cursor state, SQL state 24000 in SQLExecDirect in,
James K. Lowden, 02/18/2009
-
Re: [freetds] Warning: odbc_exec() [function.odbc-exec]: SQL error: [unixODBC][FreeTDS][SQL Server]Invalid cursor state, SQL state 24000 in SQLExecDirect in,
Ran September, 02/18/2009
-
Re: [freetds] Warning: odbc_exec() [function.odbc-exec]: SQL error: [unixODBC][FreeTDS][SQL Server]Invalid cursor state, SQL state 24000 in SQLExecDirect in,
James K. Lowden, 02/18/2009
- Re: [freetds] Warning: odbc_exec() [function.odbc-exec]: SQL error: [unixODBC][FreeTDS][SQL Server]Invalid cursor state, SQL state 24000 in SQLExecDirect in, Ran September, 02/19/2009
- Re: [freetds] Warning: odbc_exec() [function.odbc-exec]: SQL error: [unixODBC][FreeTDS][SQL Server]Invalid cursor state, SQL state 24000 in SQLExecDirect in, Ran September, 02/19/2009
-
Re: [freetds] Warning: odbc_exec() [function.odbc-exec]: SQL error: [unixODBC][FreeTDS][SQL Server]Invalid cursor state, SQL state 24000 in SQLExecDirect in,
James K. Lowden, 02/18/2009
-
Re: [freetds] Warning: odbc_exec() [function.odbc-exec]: SQL error: [unixODBC][FreeTDS][SQL Server]Invalid cursor state, SQL state 24000 in SQLExecDirect in,
Ran September, 02/18/2009
-
[freetds] unixODBC 2.2.14 headers wrong?,
Sebastien FLAESCH, 02/19/2009
-
Re: [freetds] unixODBC 2.2.14 headers wrong?,
Frediano Ziglio, 02/19/2009
-
Re: [freetds] unixODBC 2.2.14 headers wrong?,
Sebastien FLAESCH, 02/19/2009
-
Re: [freetds] unixODBC 2.2.14 headers wrong?,
James K. Lowden, 02/19/2009
- Re: [freetds] unixODBC 2.2.14 headers wrong?, Nick Gorham, 02/19/2009
-
Re: [freetds] unixODBC 2.2.14 headers wrong?,
James K. Lowden, 02/19/2009
-
Re: [freetds] unixODBC 2.2.14 headers wrong?,
Sebastien FLAESCH, 02/19/2009
-
Re: [freetds] unixODBC 2.2.14 headers wrong?,
Frediano Ziglio, 02/19/2009
-
Re: [freetds] Warning: odbc_exec() [function.odbc-exec]: SQL error: [unixODBC][FreeTDS][SQL Server]Invalid cursor state, SQL state 24000 in SQLExecDirect in,
James K. Lowden, 02/18/2009
Archive powered by MHonArc 2.6.24.