TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: Neil Heller
from: Darin McBride
date: 2003-02-02 22:47:46
subject: Declaring a pointer to a

Hello Neil!

Replying to a message of Neil Heller to Darin McBride:

 DM>> SELECT COUNT(*), AVG(income) FROM tbl WHERE ...

 DM>> then you'd get one row, but two columns - column 1 is the 
 DM>> count, and column 2 is the average of the income column in 
 DM>> the tbl table, both using only the subset that matches the 
 DM>> WHERE condition.

 NH> I like it.  However, COUNT(*) is not one of my own variables and there 
 NH> is no documentation in Watcom that tells me exactly what is returned:  

Good point - I would assume it is of SQL type INTEGER, although your
database software should document this.

 NH> long, word or byte.  However, a little experimenting shouldn't be
 NH> very  difficult and should tell me exactly what I need to know. 
 NH> Thanks for  the idea.


 DM>>> SQLINTEGER count;
 DM>>> if (retcode == SQL_SUCCESS || retcode ==
 DM>>> SQL_SUCCESS_WITH_DATA) {
 DM>>>   SQLINTEGER cb;
 DM>>>   SQLGetData(bstmt, &count, 0, &cb);

 NH> Upon re-reading this, I'll have to try it.

Note: I am not an SQL expert by any means, I only dabble with bits and
pieces, and even that is in perl, not C.  And I have zero ODBC
experience... I'll stick with Perl DBI and JDBC for now ;-)

Darin
C_PLUSPLUS moderator
dmcbride{at}tower.to.org

---
* Origin: Tanktalus' Tower BBS (1:250/102)
SEEN-BY: 633/267 270
@PATH: 250/102 99 10/345 379/1 633/267

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.