Neoview ODBC Drivers Manual (R2.5)

Neoview Platform Specific Extensions and Attributes
Handling Larger Row Counts
SQL_ATTR_ROWCOUNT64_PTR
For 32-bit applications, when the number of rows affected by an UPDATE, INSERT, or DELETE
operation exceeds 2,147,483,647 rows, SQLRowCount will return an error with a diagnostic
message that an overflow occurred. In this case, an application can use the
SQL_ATTR_ROWCOUNT64_PTR attribute in a SQLGetStmtAttr call to retrieve the actual rows
affected into a 64-bit integer.
For 64-bit applications, you do not need to use the SQL_ATTR_ROWCOUNT64_PTR attribute.
SQLRowCount for the 64-bit driver can return values greater than 2,147,483,647.
Specifying a Job ID or Session Name
SQL_ATTR_SESSIONNAME
Neoview ODBC provides the ability to specify a Session Name that persists for the duration of
a connection. One common use for this feature is to implement a “job ID”; you decide what
collection of work constitutes a job and assign the same session name to each connection associated
with the job.
To use this feature, include the Neoview-specific header file called hpsqlext.h in your
application, and specify the connection attribute SQL_ATTR_SESSIONNAME before the
connection is established. Once the connection is established, you may not change the attribute
value.
Use the ODBC API SQLSetConnectAttr to set a connection attribute. Use the ODBC API
SQLGetConnectAttr to retrieve the current value.
The value of SQL_ATTR_SESSIONNAME has the following constraints:
It is a string value with a maximum length of 24 bytes.
The value can include alphanumeric characters and the underscore (_) character .
The value is case sensitive, so “123abc” is different from “123ABC”.
An empty string is permissible. In fact, the empty string is the default value. This value
implies that the connection is not associated with any specific job.
Job ID is independent of other connection properties, such as the user ID or client name. You
can use the same value for multiple connections, including multiple concurrent connections.
NOTE: If you reuse the same job ID over time, all work done under that ID is assumed to be
related to the same job. Such reuse over a long period of time can result in undefined statistical
aggregation, because some aged work statistics might have been archived and removed from
the active statistics repository.
Example
In the following example, an application allocates environment and connection handles. It then
connects to the RUSH data source with the user ID Neo and password Neo, sets the job_id
connection attribute SQL_ATTR_SESSIONAME, and processes data. When it has finished
processing data, it disconnects from the data source and frees the handles.
#include hpsqlext.h
SQLHENV henv;
SQLHDBC hdbc;
SQLHSTMT hstmt;
SQLRETURN retcode;
/*Allocate environment handle */
retcode = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv);
Neoview Platform Specific Extensions and Attributes 25