Oracle Objects for OLE C++ Class Library
Release 9.0.1

Part Number A90172-01

Home

Book List

Contents

Master Index

Feedback

OParamArray Method

Applies To

OParamArray

Description

OParamArray
constructor

Usage

OParamArray
(void)

OParamArray(const OParamArray &otherparam)

Arguments

otherparam
Another OParamArray object to copy.
Remarks

These methods construct a new OParamArray instance.

The default constructor constructs an unopened OParamArray object. It cannot fail.

The copy constructor copies another OParamArray object. If the original OParamArray object is open-- is a handle on an implementation parameter object -- the new OParamArray object becomes a handle to that same parameter object. The copy constructor copies the reference to the parameter object but does not copy any strings that the source OParamArray may own. The copy constructor can fail; check whether the new OParamArray is open after the constructor call. Use the copy constructor to copy only another array of equal size.

There is no Open method for the OParamArray class. To get an open OParamArray, call the GetParameter method of the OParameterCollection class. The way that a parameter is actually created is by the OParameterCollection::Add method.

Example

OSession ses;

ODatabase odb;

long dbopt = 0; //the default is either no option, or the default set

char Msg[255];

char *pCharBuff = NULL;

int empno;

if (ses.Open() != OSUCCESS)

{

AfxMessageBox("session failed to open");

return;

}

odb.Open(ses, "ExampleDb", "scott", "tiger");

if(odb.IsOpen() != TRUE)

{

AfxMessageBox("database failed to open");

return;

}

else

AfxMessageBox("database open succeeded");

OParameterCollection params = odb.GetParameters();

params.Add("ArraySize", 3, OPARAMETER_INVAR, OTYPE_NUMBER);

OParamArray empnoarray = params.AddTable("EMPNOS", OPARAMETER_INVAR,

OTYPE_NUMBER, 3);

OParamArray empnamesarray = params.AddTable("ENAMES", OPARAMETER_OUTVAR,

OTYPE_VARCHAR2, 3, 10);

// Initialize EMPNOS array elements

empnoarray.SetValue(7698,0);

empnoarray.SetValue(7782,1);

empnoarray.SetValue(7654,2);

if(odb.ExecuteSQL("Begin Employee.GetEmpNamesInArray(:ArraySize, :EMPNOS,

:ENAMES); End;" ) != OSUCCESS){

MessageBox("ExecuteSQL failed");

MessageBox(odb.GetServerErrorText());}

else

MessageBox("ExecuteSQL passed");

for (int count=0;count<3;count++){

empnamesarray.GetValue((const char **)&pCharBuff,count);

empnoarray.GetValue(&empno,count);

sprintf(Msg, "Emp name for emp#: %d is %s ", empno, pCharBuff);

MessageBox(Msg);

}


 
Oracle
Copyright © 1996-2001, Oracle Corporation.

All Rights Reserved.

Home

Book List

Contents