DBD-Mimer
view release on metacpan or search on metacpan
SV *sth;
char *catalog;
char *schema;
char *table;
char *table_type;
{
D_imp_dbh(dbh);
D_imp_sth(sth);
RETCODE rc;
/* SV **svp; */
/* char cname[128]; */ /* cursorname */
dTHR;
imp_sth->henv = imp_dbh->henv; /* needed for dbd_error */
imp_sth->hdbc = imp_dbh->hdbc;
imp_sth->done_desc = 0;
if (!DBIc_ACTIVE(imp_dbh)) {
dbd_error(sth, SQL_ERROR, "Can not allocate statement when disconnected from the database");
return 0;
dbd_st_prepare(sth, imp_sth, statement, attribs)
SV *sth;
imp_sth_t *imp_sth;
char *statement;
SV *attribs;
{
dTHR;
D_imp_dbh_from_sth;
RETCODE rc;
/* SV **svp;
char cname[128]; */ /* cursorname */
imp_sth->done_desc = 0;
imp_sth->henv = imp_dbh->henv; /* needed for dbd_error */
imp_sth->hdbc = imp_dbh->hdbc;
imp_sth->odbc_ignore_named_placeholders = imp_dbh->odbc_ignore_named_placeholders;
imp_sth->odbc_default_bind_type = imp_dbh->odbc_default_bind_type;
imp_sth->odbc_force_rebind = imp_dbh->odbc_force_rebind;
if (!DBIc_ACTIVE(imp_dbh)) {
dbd_error(sth, 0, "Can not allocate statement when disconnected from the database");
int
dbd_st_finish(sth, imp_sth)
SV *sth;
imp_sth_t *imp_sth;
{
dTHR;
D_imp_dbh_from_sth;
RETCODE rc;
int ret = 0;
/* Cancel further fetches from this cursor. */
/* We don't close the cursor till DESTROY (dbd_st_destroy). */
/* The application may re execute(...) it. */
/* XXX semantics of finish (eg oracle vs odbc) need lots more thought */
/* re-read latest DBI specs and ODBC manuals */
if (DBIc_ACTIVE(imp_sth) && imp_dbh->hdbc != SQL_NULL_HDBC) {
rc = SQLFreeStmt(imp_sth->hstmt, SQL_CLOSE);/* TBD: 3.0 update */
if (!SQL_ok(rc)) {
dbd_error(sth, rc, "finish/SQLFreeStmt(SQL_CLOSE)");
return 0;
SV *sth;
imp_sth_t *imp_sth;
SV *keysv;
{
dTHR;
STRLEN kl;
char *key = SvPV(keysv,kl);
int i;
SV *retsv = NULL;
T_st_params *par;
char cursor_name[256];
SWORD cursor_name_len;
RETCODE rc;
for (par = S_st_fetch_params; par->len > 0; par++)
if (par->len == kl && strEQ(key, par->str))
break;
if (par->len <= 0)
return Nullsv;
if (par->need_describe && !imp_sth->done_desc && !dbd_describe(sth, imp_sth))
av_store(av, i, newSViv(imp_sth->fbh[i].ColSqlType));
break;
case 8: /* sol_length */
av = newAV();
retsv = newRV(sv_2mortal((SV*)av));
while(--i >= 0)
av_store(av, i, newSViv(imp_sth->fbh[i].ColLength));
break;
case 9: /* CursorName */
rc = SQLGetCursorName(imp_sth->hstmt,
cursor_name, sizeof(cursor_name), &cursor_name_len);
if (!SQL_ok(rc)) {
dbd_error(sth, rc, "st_FETCH/SQLGetCursorName");
return Nullsv;
}
retsv = newSVpv(cursor_name, cursor_name_len);
break;
case 10: /* odbc_more_results */
retsv = newSViv(imp_sth->moreResults);
break;
case 11:
{
/* not sure if there's a memory leak here. */
HV *paramvalues = newHV();
if (imp_sth->all_params_hv) {
HV *hv = imp_sth->all_params_hv;
odbc_get_type_info(dbh, sth, ftype)
SV *dbh;
SV *sth;
int ftype;
{
dTHR;
D_imp_dbh(dbh);
D_imp_sth(sth);
RETCODE rc;
#if 0
/* TBD: cursorname? */
char cname[128]; /* cursorname */
#endif
imp_sth->henv = imp_dbh->henv; /* needed for dbd_error */
imp_sth->hdbc = imp_dbh->hdbc;
imp_sth->done_desc = 0;
if (!DBIc_ACTIVE(imp_dbh)) {
dbd_error(sth, SQL_ERROR, "Can not allocate statement when disconnected from the database");
return 0;
/*
* SQL_ATTR_SCROLL_CONCURRENCY
*/
#define SQL_CA2_READ_ONLY_CONCURRENCY 0x00000001L
#define SQL_CA2_LOCK_CONCURRENCY 0x00000002L
#define SQL_CA2_OPT_ROWVER_CONCURRENCY 0x00000004L
#define SQL_CA2_OPT_VALUES_CONCURRENCY 0x00000008L
/*
* sensitivity of the cursor to its own inserts, deletes, and updates
*/
#define SQL_CA2_SENSITIVITY_ADDITIONS 0x00000010L
#define SQL_CA2_SENSITIVITY_DELETIONS 0x00000020L
#define SQL_CA2_SENSITIVITY_UPDATES 0x00000040L
/*
* SQL_ATTR_MAX_ROWS
*/
#define SQL_CA2_MAX_ROWS_SELECT 0x00000080L
#define SQL_CA2_MAX_ROWS_INSERT 0x00000100L
( run in 0.576 second using v1.01-cache-2.11-cpan-4d50c553e7e )