Improving DBD::Sybase support, suggestion

Michael Peppler mpeppler at peppler.org
Thu Dec 16 14:26:23 EST 1999


Adrian Blakey writes:
 > In some offline email with Michael Peppler I was told that ct_capability()
 > currently always returns false. The result from this is used by DBD::Sybase
 > to determine whether things like parameterized queries are supported (?
 > placeholders).
 > 
 > Is improving ct_capability on the near-term todo list? ( :-) )

Specifically there are a few calls that would need to be supported:

	CS_BOOL val;
	CS_RETCODE ret = ct_capability(imp_dbh->connection, CS_GET, CS_CAP_REQUEST,
			    CS_REQ_DYN, (CS_VOID*)&val);

is used to test for the "dynamic sql" capability.

	ret = ct_dynamic(imp_sth->cmd, CS_PREPARE, imp_sth->dyn_id,
			 CS_NULLTERM, statement, CS_NULLTERM);

is needed to "prepare" a "dynamic" statement (one that includes
?-style placeholders)

	ret = ct_dynamic(imp_sth->cmd, CS_DESCRIBE_INPUT, imp_sth->dyn_id,
			 CS_NULLTERM, NULL, CS_UNUSED);

Is used to get information on the parameters that are represented by
the ? placeholders (this is btw much superior to most other data
engines - most don't provide this capability (or at least that's what
I understand from the DBI mailing list...)

	if(ct_dynamic(imp_sth->cmd, CS_EXECUTE, imp_sth->dyn_id, CS_NULLTERM,
			 NULL, CS_UNUSED) != CS_SUCCEED)

Execute the dynamic statement.

    ret = ct_dynamic(imp_sth->cmd, CS_DEALLOC, imp_sth->dyn_id,
		     CS_NULLTERM, NULL, CS_UNUSED);

Dealloc (drop) the dynamic statement.

Michael
-- 
Michael Peppler         -||-  Data Migrations Inc.
mpeppler at peppler.org    -||-  http://www.mbay.net/~mpeppler
Int. Sybase User Group  -||-  http://www.isug.com
Sybase on Linux mailing list: ase-linux-list at isug.com



More information about the FreeTDS mailing list