get number of rows selected

This is a multi-part message in MIME format.

------_=_NextPart_001_01C8958D.6E07F2AE
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable


Hi,
I dont know much about databases, and I have a question

I've just installed PostgreSLQ.
Now I would like to get the number of rows selected via a ODBC SQL
statement in C++. I would like to know the amount before I do Fetch.

This is a little example of what I do in c++:

selStr=3D"select * from layer where visible =3D 1");
rc =3D SQLAllocHandle(SQL_HANDLE_STMT, ConHandle, &StmtHandle);
if(rc =3D=3D SQL_SUCCESS)
{
SQLSetStmtOption(StmtHandle, SQL_CONCURRENCY,
SQL_CONCUR_READ_ONLY);
SQLSetStmtOption(StmtHandle, SQL_CURSOR_TYPE,
SQL_CURSOR_KEYSET_DRIVEN);
SQLSetStmtOption(StmtHandle, SQL_ROWSET_SIZE, m_rows);
rc =3D SQLExecDirect(StmtHandle, (SQLCHAR *)selStr,
SQL_NTS);
....
....
....
How do I know how many rows that was found??


Kind regards,

Paul Malm


------_=_NextPart_001_01C8958D.6E07F2AE
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
6.5.7652.24">
<TITLE>get number of rows selected</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<BR>

<P><FONT SIZE=3D2 FACE=3D"Arial">Hi,</FONT>

<BR><FONT SIZE=3D2 FACE=3D"Arial">I dont know much about databases, and =
I have a question</FONT>
</P>

<P><FONT SIZE=3D2 FACE=3D"Arial">I've just installed PostgreSLQ.</FONT>

<BR><SPAN LANG=3D"sv"><FONT SIZE=3D2 FACE=3D"Arial">Now I would like to =
get the number of rows selected via a ODBC SQL statement in C++. I would =
like to know the amount before I do Fetch.</FONT></SPAN></P>

<P><SPAN LANG=3D"sv"><FONT SIZE=3D2 FACE=3D"Arial"> </FONT></SPAN>

<BR><SPAN LANG=3D"sv"><FONT SIZE=3D2 FACE=3D"Arial">This is a little =
example of what I do in c++:</FONT></SPAN>
</P>

<P><SPAN LANG=3D"en-us">        <FONT =
SIZE=3D2 FACE=3D"Courier New">selStr=3D"select * from layer where =
visible =3D 1");</FONT></SPAN>

<BR><SPAN LANG=3D"en-us">        =
<FONT SIZE=3D2 FACE=3D"Courier New">rc =3D =
SQLAllocHandle(SQL_HANDLE_STMT, ConHandle, =
&StmtHandle);</FONT></SPAN>

<BR><SPAN LANG=3D"en-us">        =
<FONT SIZE=3D2 FACE=3D"Courier New">if(rc =3D=3D =
SQL_SUCCESS)</FONT></SPAN>

<BR><SPAN LANG=3D"en-us">        =
<FONT SIZE=3D2 FACE=3D"Courier New">{</FONT></SPAN>

<BR><SPAN LANG=3D"en-us">        =
        <FONT SIZE=3D2 =
FACE=3D"Courier New">SQLSetStmtOption(StmtHandle, SQL_CONCURRENCY, =
SQL_CONCUR_READ_ONLY);</FONT></SPAN>

<BR><SPAN LANG=3D"en-us">        =
        <FONT SIZE=3D2 =
FACE=3D"Courier New">SQLSetStmtOption(StmtHandle, SQL_CURSOR_TYPE, =
SQL_CURSOR_KEYSET_DRIVEN);</FONT></SPAN>

<BR><SPAN LANG=3D"en-us">        =
        <FONT SIZE=3D2 =
FACE=3D"Courier New">SQLSetStmtOption(StmtHandle, SQL_ROWSET_SIZE, =
m_rows);</FONT></SPAN>

<BR><SPAN LANG=3D"en-us">        =
        <FONT SIZE=3D2 =
FACE=3D"Courier New">rc =3D SQLExecDirect(StmtHandle, (SQLCHAR *)selStr, =
SQL_NTS);</FONT></SPAN>

<BR><SPAN LANG=3D"sv"><FONT SIZE=3D2 FACE=3D"Arial">...</FONT></SPAN>

<BR><SPAN LANG=3D"sv"><FONT SIZE=3D2 FACE=3D"Arial">...</FONT></SPAN>

<BR><SPAN LANG=3D"sv"><FONT SIZE=3D2 FACE=3D"Arial">...</FONT></SPAN>

<BR><SPAN LANG=3D"sv"><FONT SIZE=3D2 FACE=3D"Arial">How do I know how =
many rows that was found??</FONT></SPAN>
</P>
<BR>

<P><SPAN LANG=3D"sv"><FONT SIZE=3D2 FACE=3D"Arial">Kind =
regards,</FONT></SPAN>
</P>

<P><SPAN LANG=3D"sv"><B><FONT SIZE=3D2 FACE=3D"Arial">Paul =
Malm</FONT></B></SPAN>
</P>

</BODY>
</HTML>
------_=_NextPart_001_01C8958D.6E07F2AE--
Malm Paul [ Do, 03 April 2008 15:20 ] [ ID #1934711 ]

Connection of postgres

Hey,

I have a problem with connection of postgres.
I am using postgres 8.03.01.

I have a telecom program which have 248 channels and each channel hold a co=
nnection to postgres database, mean i have 248 opening connections.

When a channel is run, it means it begin to excute some queries to postgres=
, i got the error : SQL Error State: 08S01

Native Error Code: 1A

ODBC Error: Could not send
Query(connection dead);

Could not send Query(connection dead)


Could you help me on this ?


Thanks you very much
Lam






This email may contain material that is confidential, privileged, and/or at=
torney work product for the sole use of the intended recipient. Any review=
, reliance, or distribution by others or forwarding without express permiss=
ion is strictly prohibited. If you are not the intended recipient, please =
contact the sender and delete all copies.

--
Sent via pgsql-odbc mailing list (pgsql-odbc [at] postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc
l7nguyen [ Do, 03 April 2008 16:04 ] [ ID #1934712 ]

Re: get number of rows selected

Generally you would do that with a count function instead of relying
on something else.

"select * from layer where visible = 1"

so I guess "SELECT COUNT(*) FROM layer WHERE visible=1" would give you
the answer.

- Adam

--
Sent via pgsql-odbc mailing list (pgsql-odbc [at] postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc
Adam M [ Do, 03 April 2008 18:30 ] [ ID #1934713 ]

Re: Connection of postgres

Hello,

Does it happen after some idle period?

Nguyen, Lam Thuy wrote:
> Hey,
>
> I have a problem with connection of postgres.
> I am using postgres 8.03.01.
>
> I have a telecom program which have 248 channels and each channel hold a connection to postgres database, mean i have 248 opening connections.
>
> When a channel is run, it means it begin to excute some queries to postgres, i got the error : SQL Error State: 08S01
>
> Native Error Code: 1A
>
> ODBC Error: Could not send
> Query(connection dead);
>
> Could not send Query(connection dead)
>
>
> Could you help me on this ?
>
>
> Thanks you very much
> Lam
>
>
>
>
>
>
> This email may contain material that is confidential, privileged, and/or attorney work product for the sole use of the intended recipient. Any review, reliance, or distribution by others or forwarding without express permission is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
>
>


--
Andrei Kovalevski
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, ODBCng - http://www.commandprompt.com/


--
Sent via pgsql-odbc mailing list (pgsql-odbc [at] postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc
Andrei Kovalevski [ Mo, 07 April 2008 03:35 ] [ ID #1937095 ]

Re: Connection of postgres

yes, it is right.

________________________________

From: Andrei Kovalevski [mailto:andyk [at] commandprompt.com]
Sent: Sun 4/6/2008 9:35 PM
To: Nguyen, Lam Thuy
Cc: Malm Paul; pgsql-odbc [at] postgresql.org
Subject: Re: [ODBC] Connection of postgres



Hello,

Does it happen after some idle period?

Nguyen, Lam Thuy wrote:
> Hey,
>
> I have a problem with connection of postgres.
> I am using postgres 8.03.01.
>
> I have a telecom program which have 248 channels and each channel hold a =
connection to postgres database, mean i have 248 opening connections.
>
> When a channel is run, it means it begin to excute some queries to postgr=
es, i got the error : SQL Error State: 08S01
>
> Native Error Code: 1A
>
> ODBC Error: Could not send
> Query(connection dead);
>
> Could not send Query(connection dead)
>
>
> Could you help me on this ?
>
>
> Thanks you very much
> Lam
>
>
>
>
>
>
> This email may contain material that is confidential, privileged, and/or =
attorney work product for the sole use of the intended recipient. Any revi=
ew, reliance, or distribution by others or forwarding without express permi=
ssion is strictly prohibited. If you are not the intended recipient, pleas=
e contact the sender and delete all copies.
>
>


--
Andrei Kovalevski
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, ODBCng - http://www.commandprompt.com/




This email may contain material that is confidential, privileged, and/or at=
torney work product for the sole use of the intended recipient. Any review=
, reliance, or distribution by others or forwarding without express permiss=
ion is strictly prohibited. If you are not the intended recipient, please =
contact the sender and delete all copies.

--
Sent via pgsql-odbc mailing list (pgsql-odbc [at] postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc
l7nguyen [ Mo, 07 April 2008 03:38 ] [ ID #1937096 ]

Re: get number of rows selected

This is a multi-part message in MIME format.
--------------090906070702000905030802
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Hello,

Take a look at SQLRowCount(
http://msdn2.microsoft.com/en-us/library//ms711835.aspx ). You may note:

*/For other statements and functions, the driver may define the value
returned in *RowCountPtr. For example, some data sources may be able to
return the number of rows returned by a SELECT statement or a catalog
function before fetching the rows./*

You may rely on this when using psqlODBC or ODBCng with buffering mode
ON (default).

Adam M wrote:
> Generally you would do that with a count function instead of relying
> on something else.
>
> "select * from layer where visible = 1"
>
> so I guess "SELECT COUNT(*) FROM layer WHERE visible=1" would give you
> the answer.
>
> - Adam
>
--
Andrei Kovalevski
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, ODBCng - http://www.commandprompt.com/


--------------090906070702000905030802
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Hello,<br>
<br>
Take a look at SQLRowCount(
<a class="moz-txt-link-freetext" href="http://msdn2.microsoft.com/en-us/library//ms711835.aspx">http://msdn2.microsoft.com/en-us/library//ms711835.aspx</a> ). You may note:<br>
<br>
<tt><b><i>For other statements and functions, the driver may define the
value returned in *RowCountPtr. For example, some data sources may be
able to return the number of rows returned by a SELECT statement or a
catalog function before fetching the rows.</i></b></tt><br>
<br>
You may rely on this when using  psqlODBC or  ODBCng with buffering
mode ON (default).<br>
<br>
Adam M wrote:
<blockquote
cite="mid:84b37b360804030930o1b771e47ib9082bf3cecb54f6 [at] mail. gmail.com"
type="cite">
<pre wrap="">Generally you would do that with a count function instead of relying
on something else.

"select * from layer where visible = 1"

so I guess "SELECT COUNT(*) FROM layer WHERE visible=1" would give you
the answer.

- Adam
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
Andrei Kovalevski
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, ODBCng - <a class="moz-txt-link-freetext" href="http://www.commandprompt.com/">http://www.commandprompt.com/</a>
</pre>
</body>
</html>

--------------090906070702000905030802--
Andrei Kovalevski [ Mo, 07 April 2008 03:30 ] [ ID #1937097 ]

Re: Connection of postgres

This is a multi-part message in MIME format.
--------------090803040903060905060306
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

I'm figuring similar behaviour with Linux PostgreSQL server and Win32
client, connection over Internet (not LAN). Not sure what is the source
of this problem but it could be something network relative.

Nguyen, Lam Thuy wrote:
> yes, it is right.
>
> ________________________________
>
> From: Andrei Kovalevski [mailto:andyk [at] commandprompt.com]
> Sent: Sun 4/6/2008 9:35 PM
> To: Nguyen, Lam Thuy
> Cc: Malm Paul; pgsql-odbc [at] postgresql.org
> Subject: Re: [ODBC] Connection of postgres
>
>
>
> Hello,
>
> Does it happen after some idle period?
>
> Nguyen, Lam Thuy wrote:
>
>> Hey,
>>
>> I have a problem with connection of postgres.
>> I am using postgres 8.03.01.
>>
>> I have a telecom program which have 248 channels and each channel hold a connection to postgres database, mean i have 248 opening connections.
>>
>> When a channel is run, it means it begin to excute some queries to postgres, i got the error : SQL Error State: 08S01
>>
>> Native Error Code: 1A
>>
>> ODBC Error: Could not send
>> Query(connection dead);
>>
>> Could not send Query(connection dead)
>>
>>
>> Could you help me on this ?
>>
>>
>> Thanks you very much
>> Lam
>>
>>
>>
>>
>>
>>
>> This email may contain material that is confidential, privileged, and/or attorney work product for the sole use of the intended recipient. Any review, reliance, or distribution by others or forwarding without express permission is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
>>
>>
>>
>
>
> --
> Andrei Kovalevski
> PostgreSQL Replication, Consulting, Custom Development, 24x7 support
> Managed Services, Shared and Dedicated Hosting
> Co-Authors: plPHP, ODBCng - http://www.commandprompt.com/
>
>
>
>
> This email may contain material that is confidential, privileged, and/or attorney work product for the sole use of the intended recipient. Any review, reliance, or distribution by others or forwarding without express permission is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.
>
>


--
Andrei Kovalevski
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, ODBCng - http://www.commandprompt.com/


--------------090803040903060905060306
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
I'm figuring similar behaviour with Linux PostgreSQL server  and Win32
client, connection over Internet (not LAN). Not sure what is the source
of this problem but it could be something network relative.<br>
<br>
Nguyen, Lam Thuy wrote:
<blockquote
cite="mid:C3D5057033EDF145B90A99CD9025BFEA01C601FB [at] hont05.fc g.com"
type="cite">
<pre wrap="">yes, it is right.

________________________________

From: Andrei Kovalevski [<a class="moz-txt-link-freetext" href="mailto:andyk [at] commandprompt.com">mailto:andyk [at] commandprompt.com</a>]
Sent: Sun 4/6/2008 9:35 PM
To: Nguyen, Lam Thuy
Cc: Malm Paul; <a class="moz-txt-link-abbreviated" href="mailto:pgsql-odbc [at] postgresql.org">pgsql-odbc [at] postgresql.org</a>
Subject: Re: [ODBC] Connection of postgres



Hello,

Does it happen after some idle period?

Nguyen, Lam Thuy wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hey,

I have a problem with connection of postgres.
I am using postgres 8.03.01.

I have a telecom program which have 248 channels and each channel hold a connection to postgres database, mean i have 248 opening connections.

When a channel is run, it means it begin to excute some queries to postgres, i got the error : SQL Error State: 08S01

Native Error Code: 1A

ODBC Error: Could not send
Query(connection dead);

Could not send Query(connection dead)


Could you help me on this ?


Thanks you very much
Lam






This email may contain material that is confidential, privileged, and/or attorney work product for the sole use of the intended recipient. Any review, reliance, or distribution by others or forwarding without express permission is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.


</pre>
</blockquote>
<pre wrap=""><!---->

--
Andrei Kovalevski
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, ODBCng - <a class="moz-txt-link-freetext" href="http://www.commandprompt.com/">http://www.commandprompt.com/</a>




This email may contain material that is confidential, privileged, and/or attorney work product for the sole use of the intended recipient. Any review, reliance, or distribution by others or forwarding without express permission is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

</pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Andrei Kovalevski
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, ODBCng - <a class="moz-txt-link-freetext" href="http://www.commandprompt.com/">http://www.commandprompt.com/</a>
</pre>
</body>
</html>

--------------090803040903060905060306--
Andrei Kovalevski [ Mo, 07 April 2008 04:26 ] [ ID #1937098 ]

Re: Connection of postgres

Kovalevski ,

I am sure there was no prolem with network. I guess maybe postgres database=
can not handle if there are many connections work concurrenly.

Lam

________________________________

From: Andrei Kovalevski [mailto:andyk [at] commandprompt.com]
Sent: Sun 4/6/2008 10:26 PM
To: Nguyen, Lam Thuy
Cc: Malm Paul; pgsql-odbc [at] postgresql.org
Subject: Re: [ODBC] Connection of postgres


I'm figuring similar behaviour with Linux PostgreSQL server and Win32 clie=
nt, connection over Internet (not LAN). Not sure what is the source of this=
problem but it could be something network relative.

Nguyen, Lam Thuy wrote:

yes, it is right.
=09
________________________________
=09
From: Andrei Kovalevski [mailto:andyk [at] commandprompt.com]
Sent: Sun 4/6/2008 9:35 PM
To: Nguyen, Lam Thuy
Cc: Malm Paul; pgsql-odbc [at] postgresql.org
Subject: Re: [ODBC] Connection of postgres
=09
=09
=09
Hello,
=09
Does it happen after some idle period?
=09
Nguyen, Lam Thuy wrote:
=09

Hey,
=09=09
I have a problem with connection of postgres.
I am using postgres 8.03.01.
=09=09
I have a telecom program which have 248 channels and each channel hold a =
connection to postgres database, mean i have 248 opening connections.
=09=09
When a channel is run, it means it begin to excute some queries to postgr=
es, i got the error : SQL Error State: 08S01
=09=09
Native Error Code: 1A
=09=09
ODBC Error: Could not send
Query(connection dead);
=09=09
Could not send Query(connection dead)
=09=09
=09=09
Could you help me on this ?
=09=09
=09=09
Thanks you very much
Lam
=09=09
=09=09
=09=09
=09=09
=09=09
=09=09
This email may contain material that is confidential, privileged, and/or =
attorney work product for the sole use of the intended recipient. Any revi=
ew, reliance, or distribution by others or forwarding without express permi=
ssion is strictly prohibited. If you are not the intended recipient, pleas=
e contact the sender and delete all copies.
=09=09
=09=09
=09=09

--
Andrei Kovalevski
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, ODBCng - http://www.commandprompt.com/
=09
=09
=09
=09
This email may contain material that is confidential, privileged, and/or a=
ttorney work product for the sole use of the intended recipient. Any revie=
w, reliance, or distribution by others or forwarding without express permis=
sion is strictly prohibited. If you are not the intended recipient, please=
contact the sender and delete all copies.
=09
=09



--
Andrei Kovalevski
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, ODBCng - http://www.commandprompt.com/

This email may contain material that is confidential, privileged, and/or at=
torney work product for the sole use of the intended recipient. Any review=
, reliance, or distribution by others or forwarding without express permiss=
ion is strictly prohibited. If you are not the intended recipient, please =
contact the sender and delete all copies.

--
Sent via pgsql-odbc mailing list (pgsql-odbc [at] postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc
l7nguyen [ Mo, 07 April 2008 04:40 ] [ ID #1937100 ]

Re: Connection of postgres

On 07/04/2008 03:40, Nguyen, Lam Thuy wrote:

> I am sure there was no prolem with network. I guess maybe postgres
> database can not handle if there are many connections work
> concurrenly.

That's not so - if you've configured it correctly, if your hardware can
handle it, PostgreSQL scales *very* well. What have you got
max_connections set to in postgresql.conf?

Ray.


------------------------------------------------------------ ------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod [at] iol.ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------ ------

--
Sent via pgsql-odbc mailing list (pgsql-odbc [at] postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc
Rod [ Mo, 07 April 2008 17:05 ] [ ID #1937101 ]

Re: Connection of postgres

I set it up to 300.
Do you have any solution for me?

Lam

________________________________

From: Raymond O'Donnell [mailto:rod [at] iol.ie]
Sent: Mon 4/7/2008 11:05 AM
To: Nguyen, Lam Thuy
Cc: Andrei Kovalevski; Malm Paul; pgsql-odbc [at] postgresql.org
Subject: Re: [ODBC] Connection of postgres



On 07/04/2008 03:40, Nguyen, Lam Thuy wrote:

> I am sure there was no prolem with network. I guess maybe postgres
> database can not handle if there are many connections work
> concurrenly.

That's not so - if you've configured it correctly, if your hardware can
handle it, PostgreSQL scales *very* well. What have you got
max_connections set to in postgresql.conf?

Ray.


------------------------------------------------------------ ------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod [at] iol.ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------ ------



This email may contain material that is confidential, privileged, and/or at=
torney work product for the sole use of the intended recipient. Any review=
, reliance, or distribution by others or forwarding without express permiss=
ion is strictly prohibited. If you are not the intended recipient, please =
contact the sender and delete all copies.

--
Sent via pgsql-odbc mailing list (pgsql-odbc [at] postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc
l7nguyen [ Mo, 07 April 2008 20:02 ] [ ID #1937102 ]

Re: Connection of postgres

I've had a similar "problem". The connection times out and get closed
after a few hours. The solution was to do a query to keep the database
alive, for example "SELECT 1" and that's all. That is done every few
minutes.

The real test is to open 250 connections, and issue queries on each
without idle time. Does connection drop occur on active connections?

--
Sent via pgsql-odbc mailing list (pgsql-odbc [at] postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc
Adam M [ Mi, 09 April 2008 20:40 ] [ ID #1938768 ]

Re: Connection of postgres

i open connection, and leave it for few hour, and then excute query, and ge=
t error.

________________________________

From: pgsql-odbc-owner [at] postgresql.org on behalf of Adam M
Sent: Wed 4/9/2008 2:40 PM
Cc: pgsql-odbc [at] postgresql.org
Subject: Re: [ODBC] Connection of postgres



I've had a similar "problem". The connection times out and get closed
after a few hours. The solution was to do a query to keep the database
alive, for example "SELECT 1" and that's all. That is done every few
minutes.

The real test is to open 250 connections, and issue queries on each
without idle time. Does connection drop occur on active connections?

--
Sent via pgsql-odbc mailing list (pgsql-odbc [at] postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc



This email may contain material that is confidential, privileged, and/or at=
torney work product for the sole use of the intended recipient. Any review=
, reliance, or distribution by others or forwarding without express permiss=
ion is strictly prohibited. If you are not the intended recipient, please =
contact the sender and delete all copies.

--
Sent via pgsql-odbc mailing list (pgsql-odbc [at] postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc
l7nguyen [ Mi, 09 April 2008 20:57 ] [ ID #1938769 ]

Re: get number of rows selected

paul malm wrote:
>
>
> Hi,
> I dont know much about databases, and I have a question
>
> I've just installed PostgreSLQ.
> Now I would like to get the number of rows selected via a ODBC SQL
> statement in C++. I would like to know the amount before I do Fetch.
>
> This is a little example of what I do in c++:
>
> selStr="select * from layer where visible = 1");
> rc = SQLAllocHandle(SQL_HANDLE_STMT, ConHandle, &StmtHandle);
> if(rc == SQL_SUCCESS)
> {
> SQLSetStmtOption(StmtHandle, SQL_CONCURRENCY,
> SQL_CONCUR_READ_ONLY);
> SQLSetStmtOption(StmtHandle, SQL_CURSOR_TYPE,
> SQL_CURSOR_KEYSET_DRIVEN);
> SQLSetStmtOption(StmtHandle, SQL_ROWSET_SIZE, m_rows);
> rc = SQLExecDirect(StmtHandle, (SQLCHAR *)selStr,
> SQL_NTS);
> ...
> ...
> ...
> How do I know how many rows that was found??
>
>
> Kind regards,
>
> Paul Malm
>
>
>

Use SQLRowCount ODBC function

--
View this message in context: http://old.nabble.com/get-number-of-rows-selected-tp16475169 p27851040.html
Sent from the PostgreSQL - odbc mailing list archive at Nabble.com.


--
Sent via pgsql-odbc mailing list (pgsql-odbc [at] postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-odbc
VitaliyG [ Mi, 10 März 2010 16:10 ] [ ID #2035093 ]
Datenbanken » gmane.comp.db.postgresql.odbc » get number of rows selected

Vorheriges Thema: PGAPI_DriverConnect fails if password contains semicolon
Nächstes Thema: Specifying pg_config path