Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Interfaces Odbc > get number of r...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 12 Topic 2335 of 2384
Post > Topic >>

get number of rows selected

by paul.malm@[EMAIL PROTECTED] ("Malm Paul") Apr 3, 2008 at 03:20 PM

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.
=20
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">&nbsp;</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">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <FONT =
SIZE=3D2 FACE=3D"Courier New">selStr=3D&quot;select * from layer where =
visible =3D 1&quot;);</FONT></SPAN>

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

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

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

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

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

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

<BR><SPAN LANG=3D"en-us">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <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--
 




 12 Posts in Topic:
get number of rows selected
paul.malm@[EMAIL PROTECTE  2008-04-03 15:20:04 
Connection of postgres
l7nguyen@[EMAIL PROTECTED  2008-04-03 21:04:05 
Re: Connection of postgres
andyk@[EMAIL PROTECTED]   2008-04-07 04:35:57 
Re: Connection of postgres
l7nguyen@[EMAIL PROTECTED  2008-04-07 08:38:19 
Re: Connection of postgres
andyk@[EMAIL PROTECTED]   2008-04-07 05:26:00 
Re: Connection of postgres
l7nguyen@[EMAIL PROTECTED  2008-04-07 09:40:03 
Re: Connection of postgres
rod@[EMAIL PROTECTED] (&  2008-04-07 16:05:09 
Re: Connection of postgres
l7nguyen@[EMAIL PROTECTED  2008-04-08 01:02:30 
Re: get number of rows selected
gnuman1@[EMAIL PROTECTED]  2008-04-03 11:30:07 
Re: get number of rows selected
andyk@[EMAIL PROTECTED]   2008-04-07 04:30:16 
Re: Connection of postgres
gnuman1@[EMAIL PROTECTED]  2008-04-09 13:40:28 
Re: Connection of postgres
l7nguyen@[EMAIL PROTECTED  2008-04-10 01:57:41 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan13V112 Thu Jul 24 6:57:41 CDT 2008.