DBPowerSuite 7.9 Application Programming Interface
ODBC

 

Class Description

ODBC Statement

Class Name

OStatement

Parent Class

ULogObject

Header Name

OStatement.h

Library

libpsODBC

Language

C++

Date Written

November 1, 1999

Last Updated

February 2, 2004

Last Updated By

Brian N. Ceccarelli

Notes

     This header file processes the ODBC Statement Handle.    You
must have an OConnection object before instantiating an OStatement
object.

STORED PROCEDURES

     There are no special methods to execute a stored procedure.
They are not necessary.   You can execute a stored procedure like
you execute an adhoc SQL command.   You just use the ODBC escape
clause for executing stored procedures:

          { [?=] CALL procedure_name [([?, ?, ...]) ] }

and bind variables like always.  The OParameter class properly
handles your parameters which are input parameters.

Stored Procedures & Oracle

     For all other databases besides Oracle, you can process
result sets coming from stored procedures like any other SQL select
statement.   Oracle can not produce result sets from a stored
procedure.   For Oracle, Merant ODBC has devised a way to
simulate a result set by an under-the-covers passing of a generic
Oracle reference cursor in/out parameter to the proc.  To use this
mechanism, you have to write your stored procedures with a
reference cursor parameter inside an Oracle package.  The reference
cursor must be the first parameter.   In the ODBC escape sequence,
you do NOT specify the reference cursor.   Skip it.  And when you
connect to the Oracle data source, you must pass PRR=1 as the
"other connection attributes".  All this hooplah is a necessary
work-around for a huge Oracle architectural blunder.

See Also

OConnectionSet OConnection OEnvironment

 

Public Methods of Class OStatement

#

Inline

Pure Virtual

Virtual

Method

Description

1

No

No

No

OStatement(OConnection& o_conn)

Constructor

2

No

No

No

ps_int32 osCancel()

Cancel a Currently Executing Statement

3

No

No

No

ps_int32 osClearBindings(ps_int8 keep_pending_results_in_tact_sw = 0)

Clear ODBC Parameter and Column Bindings

4

No

No

No

ps_int32 osCommitTransaction()

Commit a Transaction

5

No

No

No

ps_int32 osError(ps_int32 odbc_return_code)

Write Errors on the ODBC Statement and Translate the ODBC Return Code to a DBPowerSuite Return Code

6

No

No

No

ps_int32 osErrorLoop(ps_int32 message_code)

Write All ODBC Messages Pending on an ODBC Statement

7

No

No

No

ps_int32 osExecute(ps_int32* number_of_rows = NULL)

Execute an Adhoc SQL Statement

8

No

No

No

ps_int32 osExecute(OParameter column[], ps_int32 number_of_columns, ps_int32* number_of_rows = NULL)

Execute an Adhoc SQL Statement

9

No

No

No

ps_int32 osExecute(OParameter parameter[], ps_int32 number_of_parameters, OParameter column[], ps_int32 number_of_columns, ps_int32* number_of_rows = NULL)

Execute an Adhoc SQL Statement

10

No

No

No

ps_int32 osExecutePreparedSQL(ps_int32* number_of_rows = NULL)

Execute a Prepared SQL Statement

11

No

No

No

ps_int32 osExecutePreparedSQL(OParameter column[], ps_int32 number_of_columns, ps_int32* number_of_rows = NULL)

Execute a Prepared SQL Statement

12

No

No

No

ps_int32 osExecutePreparedSQL(OParameter parameter[], ps_int32 number_of_parameters, OParameter column[], ps_int32 number_of_columns, ps_int32* number_of_rows = NULL)

Execute a Prepared SQL Statement

13

No

No

No

ps_int32 osExecuteSQL(const ps_char* sql, ps_int32* number_of_rows = NULL)

Execute a SQL Statement

14

No

No

No

ps_int32 osExecuteSQL(const ps_char* sql, OParameter column[], ps_int32 number_of_columns, ps_int32* number_of_rows = NULL)

Execute a SQL Statement

15

No

No

No

ps_int32 osExecuteSQL(const ps_char* sql, OParameter parameter[], ps_int32 number_of_parameters, OParameter column[], ps_int32 number_of_columns, ps_int32* number_of_rows = NULL)

Execute a SQL Statement

16

No

No

No

ps_int32 osFinalize()

Finalize an OStatement

17

No

No

No

ps_int8 osGetCancelSw() const

Get the Cancel Switch

18

Yes

No

No

OConnection & osGetConnection() const

 

19

Yes

No

No

HDBC osGetConnectionHandle() const

 

20

No

No

No

ps_int8 osGetDeadlockVictimSw() const

Get the Deadlock Victim Switch

21

Yes

No

No

ps_int32 osGetDeadlockWaitTimeBetweenRetries() const

 

22

Yes

No

No

ps_int8 osGetDiscardResultsSw() const

 

23

Yes

No

No

OEnvironment & osGetEnvironment() const

 

24

Yes

No

No

HENV osGetEnvironmentHandle() const

 

25

Yes

No

No

ps_int32 osGetMaximumRowsPerSet() const

 

26

Yes

No

No

Messages * osGetMessages() const

 

27

Yes

No

No

ps_int32 osGetNumberOfDeadlockRetries() const

 

28

Yes

No

No

ps_int32 osGetNumberOfODBCErrors() const

 

29

Yes

No

No

ps_int32 osGetNumberOfParameterSets() const

 

30

No

No

No

ps_int32 osGetSQLState(ps_char* sql_state) const

Get the SQLState for the OStatement

31

No

No

No

ps_int8 osGetSQLStateSw(const ps_char* sql_state) const

Get SQL State Switch

32

Yes

No

No

HSTMT osGetStatementHandle() const

 

33

Yes

No

No

ps_int32 osGetStatementType() const

 

34

Yes

No

No

ps_int32 osGetStructureSizeForParameterRowWiseBinding() const

 

35

Yes

No

No

ps_int32 osGetStructureSizeForRowWiseBinding() const

 

36

Yes

No

No

ps_int8 osGetUseTimeoutsSw() const

 

37

No

No

No

ps_int32 osInitialize()

Allocate a ODBC Statement

38

No

No

No

ps_int32 osInitialize(HSTMT hstmt)

Allocate a ODBC Statement

39

Yes

No

No

ps_int8 osIsStatementAllocatedSw() const

 

40

No

No

No

ps_int32 osPrepareSQL(const ps_char* sql)

Prepare a Statement

41

No

No

No

ps_int32 osRollbackTransaction()

Rollback a Transaction

42

No

No

No

ps_int32 osSetAlwaysClearBindingsSw(ps_int8 sw = 1)

Turn Off/On Always Clear Bindings

43

No

No

No

ps_int32 osSetColumnDescriptionsCallback(OColumnDescriptionsCallback fptr, ODBC_COLUMN* column_descriptions, ps_int32 max_number_of_column_descriptions)

Set the Column Descriptions Callback Method

44

No

No

No

ps_int32 osSetColumns(ps_int32 number_of_columns = 0, OParameter column[] = NULL)

Assign Each Result Row Set Column to an OParameter

45

No

No

No

ps_int32 osSetDeadlockCallback(ODeadlockCallback fptr)

Set the Method Which is Executed Every Time a Deadlock Condition is Received From the ODBC Data Source

46

No

No

No

ps_int32 osSetDeadlockWaitTimeBetweenRetries(ps_int32 number_of_microseconds = ODBC_OSTMT_DEADLOCK_WAIT_TIME)

Set Wait Time Before Resending a SQL Command After Deadlocked

47

No

No

No

ps_int32 osSetDiscardResultsSw(ps_int8 sw = 1)

Turn On/Off Discarding of Results

48

No

No

No

ps_int32 osSetMaximumRowsPerSet(ps_int32 max_rows_in_a_set = 1, ps_uint16* row_status_array = NULL)

Set the Maximums Rows Per Set

49

No

No

No

ps_int32 osSetNumberOfDeadlockRetries(ps_int32 number_of_retries = ODBC_OSTMT_DEADLOCK_RETRIES)

Set the Number of Times This Class Resends a SQL Command Upon Receiving a Deadlock Victim Error

50

No

No

No

ps_int32 osSetNumberOfParameterSets(ps_int32 max_rows_in_a_set = 1)

Set the Number of Parameter Sets

51

No

No

No

ps_int32 osSetParameters(ps_int32 number_of_parameters = 0, OParameter parameter[] = NULL)

Set the Parameters for a SQL Query

52

No

No

No

ps_int32 osSetQueryTimeout(ps_int32 timeout_seconds = ODBC_OSTMT_QUERY_TIMEOUT)

Set the Timeout for a SQL Statement to Execute

53

No

No

No

ps_int32 osSetRowCallback(ORowCallback fptr, ps_void* row_results_list_struct = NULL, ps_void* single_row_result_struct = NULL)

Set the Method Which is Executed Every Time a Row is Received From the ODBC Data Source

54

No

No

No

ps_int32 osSetRowsAffectedCallback(ORowsAffectedCallback fptr, ps_void* user_data = NULL)

Set the Method Called Every Time the ODBC Data Source Finishes Sending a Result Set

55

No

No

No

ps_int32 osSetSQLState(const ps_char* sql_state = NULL)

Set the SQLState for the OStatement

56

No

No

No

ps_int32 osSetSQLStatement(const ps_char* sql)

Set the SQL Query

57

No

No

No

ps_int32 osSetStructureSizeForParameterRowWiseBinding(ps_int32 structure_size_in_bytes = 0)

Set Structure Size for Parameter Row-Wise Binding

58

No

No

No

ps_int32 osSetStructureSizeForRowWiseBinding(ps_int32 structure_size_in_bytes = 0)

Set Structure Size for Row-Wise Binding

59

No

No

Yes

~OStatement()

Destructor

 

Protected Methods of Class OStatement

#

Inline

Pure Virtual

Virtual

Method

Description

1

No

No

No

ps_int32 osBindColumns()

Bind Program Variables to Query Result Columns

2

No

No

No

ps_int32 osBindParameters()

Bind Program Variables to Parameters

3

No

No

Yes

ps_int32 osColumnHeadings()

Get the Number of Columns And Call the User's Column Headings Callback

4

No

No

Yes

ps_int32 osDeadlockCallback()

Call the User's Deadlock Callback

5

No

No

No

ps_int32 osFetchResults(ps_int32* number_of_rows)

Fetch Data from the ODBC Data Source

6

No

No

No

ps_int32 osFreeMarkerValuesText(ps_char** marker[]) const

Free Parameter Marker Values Text Memory

7

No

No

No

ps_int32 osGetColumnDescriptions(ps_int32& number_of_results_columns_retrieved)

Get Descriptions of Row Result Columns from the Data Source

8

No

No

No

ps_int32 osGetMarkerValuesText(ps_char** marker[]) const

Get Parameter Marker Values Text

9

No

No

No

ps_int32 osResetBindingCharacteristics(ps_int8 deadlock_test_sw = 1)

Reset Binding Characteristics

10

No

No

Yes

ps_int32 osRowCallback()

Call the User's Row Callback

11

No

No

Yes

ps_int32 osRowsAffectedCallback()

The ODBC Rows Affected Callback

12

No

No

No

ps_int32 osSaveSQLStatement(const ps_char* sql)

Save the SQL Statement Internally

 

Private Methods of Class OStatement

#

Inline

Pure Virtual

Virtual

Method

Description

 

Go to DBPowerSuite 7.9 Application Programming Interface.


Updated: Thu Jun 18 21:13:23 2009