Oracle Objects for OLE C++ Class Library
Release 9.2

Part Number A95896-01
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents

Master Index

Feedback

GetCount Method

Applies To

OConnectionCollection

ODatabaseCollection

OFieldCollection

OParameterCollection

OSessionCollection

Description

This method returns the number of items in the collection.

Usage

long GetCount(void) const

Remarks

The various Collection classes inherit the GetCount method from their parent OOracleCollection. The GetCount method returns the number of items in the collection. The collection is dynamic; the number of items in the collection reflects the current conditions, not the conditions when the Collection object was created.

A closed collection will return 0 items.

Return Value

The number of items in the collection.

Example

This example looks at the number of connections in the current session.

// construct and open an OSession on the default session

OSession defsess(0);

// get the connection collection

OConnectionCollection connc = defsess.GetConnections();

// how many connections are there now?

int nconn = connc.GetCount();

// now add a connection by creating a new database object

ODatabase odb("ExampleDB", "scott/tiger", 0);

// how many connections are there now?

int nconn2 = connc.GetCount();

// nconn2 will equal nconn + 1 because of the new connection

/*

Actually, nconn2 == nconn + 1 only if a previous connection was

not shared. Connection sharing would have occurred if there was

a previous connection, within the same session, that used the

same connection information (database name, user name, password).

*/


 
Oracle
Copyright © 1998, 2002 Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents

Master Index

Feedback