Please enable JavaScript to view this site.

ASQL Reference

xcall SQL, SQLOP_GET_INFO, cmdhdr, infostring

This operation may be used to request various bits of information from the database server.

Parameters

cmdhdr (ST_SQL_CMDHDR), [in/out]

The fields of interest to this opcode in the cmdhdr structure (defined in SQL.DEF) are listed below.

Field

Dir

Notes

handle

in

handle to connection (returned from SQLOP_INIT_CONN)

dbmsconid

in

DBMS Connector ID

opflags

in

specifies the information requested (see SQLINFO_xxx in table below)

cmdarg1,2

n/a

 

rc

out

return code (0 = ok, see SQLERR_xxx)

rcext

out

extended error code

info1,2

out

info requested may be returned here if it can be represented by an integer or double.

sqlstate

out

ANSI standard SQL state code

reshdl

n/a

 

psthdl

in

Set to value returned from last SQLOP_PST_PREPARE if last operation was on a prepared statement; else 0.

 

opflags Symbol

Value

Notes

SQLINFO_HOST

1

Get host info (into infostring)

SQLINFO_SERVER

2

Get server version info (into both infostring and info1)

SQLINFO_CLIENT

3

Get client version info (into both infostring and info1)

SQLINFO_QUERY

4

(MySQL only) Returns details (into infostring) following these statements:

INSERT INTO … SELECT

INSERT INFO … VALUES(…),(…),…

Format:  Records: 1 Duplicates: 0 Warnings: 0

LOAD DATA INFILE

Format: Records: 1 Deleted: 1 Skipped: 0 Warnings: 0

ALTER TABLE

Format: Records: 50 Duplicates: 0 Warnings 0

UPDATE

Format: Rows matched: 40 Changed: 40 Warnings: 0

SQLINFO_FIELDCOUNT

5

Returns (into info1) # fields in most recent query. Will be 0 for non-select queries (providing a way to determine whether the non-return of rows from last statement was normal.

SQLINFO_ROWCOUNT

6

Returns (into info2) # rows in result set. (not always available - see notes below.)

SQLINFO_CONID

7

Returns connector ID (name, e.g. “LIBASHMYSQL”) in infostring

SQLINFO_CONVER

8

Returns connector version into info1 as an integer coded as MmmEEEp where M=major version, mm=minor version, EEE=edit number, and p=patch number. For example, 1023456 would indicate 1.2.345.6. Also returns the version in the #.#.###.# format into the infostring parameter.

SQLINFO_CONDESCR

9

Returns into infostring a description of the connector (e.g. “MySQL 5.1 (native)”)

SQLINFO_AFFECTEDROWS

10

When called immediately after a query that updates the database (such as update, delete, or insert), returns (into info2) the number of rows affected by the operation.

SQLINFO_AUTOINCID

11

When called immediately after an INSERT or UPDATE on a column using AUTO_INCREMENT field, returns the value of the AUTO_INCREMENT expression.

 

infostring [string, out]

String information relating to the request may be returned here, if applicable.

Notes

Depending on the database, driver and other attributes, the number of rows selected in a query may not be available, such as when the query result set is held on the server and the client has a dynamic or sensitive cursor into the set, meaning that the size of the set can change between the time the query was submitted and all the rows fetched. In such a case, SQLINFO_ROWCOUNT will set info2 to 0 (MySQL connector) or -1 (ODBC connector).