Lines Matching defs:sql
88 static const char *dbd_oracle_error(apr_dbd_t *sql, int n);
89 static int dbd_oracle_prepare(apr_pool_t *pool, apr_dbd_t *sql,
94 static int dbd_oracle_pselect(apr_pool_t *pool, apr_dbd_t *sql,
98 static int dbd_oracle_pquery(apr_pool_t *pool, apr_dbd_t *sql,
101 static int dbd_oracle_start_transaction(apr_pool_t *pool, apr_dbd_t *sql,
254 apr_dbd_t *sql = res->handle;
265 sql->status = OCILobRead(sql->svc, sql->err, val->buf.lobval,
270 sql->status = OCILobRead2(sql->svc, sql->err, val->buf.lobval,
275 if (sql->status != OCI_SUCCESS) {
667 static apr_size_t dbd_oracle_long_size_set(apr_dbd_t *sql,
670 apr_size_t old_size = sql->long_size;
671 sql->long_size = long_size;
690 apr_dbd_t *sql = res->handle;
711 sql->status = OCIStmtFetch2(res->statement->stmt, res->handle->err, 1,
715 sql->status = OCIStmtFetch2(res->statement->stmt, res->handle->err, 1,
718 switch (sql->status) {
726 OCIErrorGet(sql->err, 1, NULL, &errorcode,
727 sql->buf, sizeof(sql->buf), OCI_HTYPE_ERROR);
728 printf("Execute error %d: %s\n", sql->status, sql->buf);
737 static const char *dbd_oracle_error(apr_dbd_t *sql, int n)
744 switch (sql->status) {
761 switch (OCIErrorGet(sql->err, 1, NULL, &errorcode,
762 (text*) sql->buf, sizeof(sql->buf), OCI_HTYPE_ERROR)) {
764 return sql->buf;
797 static int dbd_oracle_select(apr_pool_t *pool, apr_dbd_t *sql,
804 ret = dbd_oracle_prepare(pool, sql, query, NULL, 0, 0, NULL, &statement);
809 ret = dbd_oracle_pselect(pool, sql, results, statement, seek, NULL);
817 static int dbd_oracle_query(apr_dbd_t *sql, int *nrows, const char *query)
823 if (sql->trans && sql->trans->status == TRANS_ERROR) {
831 apr_pool_create(&pool, sql->pool);
833 ret = dbd_oracle_prepare(pool, sql, query, NULL, 0, 0, NULL, &statement);
835 ret = dbd_oracle_pquery(pool, sql, nrows, statement, NULL);
837 sql->status = OCIAttrGet(statement->stmt, OCI_HTYPE_STMT,
839 sql->err);
849 apr_dbd_t *sql)
854 static int dbd_oracle_prepare(apr_pool_t *pool, apr_dbd_t *sql,
867 stmt->handle = sql;
880 sql->status = OCIHandleAlloc(dbd_oracle_env, (dvoid**) &stmt->stmt,
882 if (sql->status != OCI_SUCCESS) {
886 sql->status = OCIStmtPrepare(stmt->stmt, sql->err, (text*) query,
888 if (sql->status != OCI_SUCCESS) {
897 sql->status = OCIAttrGet(stmt->stmt, OCI_HTYPE_STMT, &stmt->type, 0,
898 OCI_ATTR_STMT_TYPE, sql->err);
899 if (sql->status != OCI_SUCCESS) {
905 sql->status = OCIAttrSet(stmt->stmt, OCI_HTYPE_STMT, &prefetch_size,
907 sql->err);
908 if (sql->status != OCI_SUCCESS) {
914 ret = outputParams(sql, stmt);
922 apr_dbd_t *sql = statement->handle;
928 sql->status = OCIBindByPos(stmt, &statement->args[i].bind,
929 sql->err, i + 1,
945 sql->status = OCIBindByPos(stmt, &statement->args[i].bind,
946 sql->err, i + 1,
962 sql->status = OCIBindByPos(stmt, &statement->args[i].bind,
963 sql->err, i + 1,
972 sql->status = OCIBindByPos(stmt, &statement->args[i].bind,
973 sql->err, i + 1,
985 if (sql->status != OCI_SUCCESS) {
993 static int outputParams(apr_dbd_t *sql, apr_dbd_prepared_t *stmt)
1004 sql->status = OCIStmtExecute(sql->svc, stmt->stmt, sql->err, 0, 0,
1006 switch (sql->status) {
1012 OCIErrorGet(sql->err, 1, NULL, &errorcode,
1013 sql->buf, sizeof(sql->buf), OCI_HTYPE_ERROR);
1014 printf("Describing prepared statement: %s\n", sql->buf);
1019 while (sql->status == OCI_SUCCESS) {
1020 sql->status = OCIParamGet(stmt->stmt, OCI_HTYPE_STMT,
1021 sql->err, (dvoid**)&parms, stmt->nout+1);
1022 switch (sql->status) {
1024 sql->status = OCIAttrGet(parms, OCI_DTYPE_PARAM,
1026 0, OCI_ATTR_DATA_TYPE, sql->err);
1027 sql->status = OCIAttrGet(parms, OCI_DTYPE_PARAM,
1029 0, OCI_ATTR_DATA_SIZE, sql->err);
1030 sql->status = OCIAttrGet(parms, OCI_DTYPE_PARAM,
1033 OCI_ATTR_NAME, sql->err);
1037 switch (sql->status) {
1088 sql->status = OCIDefineByPos(stmt->stmt, &stmt->out[i].defn,
1089 sql->err, i+1,
1096 stmt->out[i].sz = sql->long_size * 4 + 4; /* ugh, UCS-4 handling */
1098 sql->status = OCIDefineByPos(stmt->stmt, &stmt->out[i].defn,
1099 sql->err, i+1,
1106 stmt->out[i].sz = sql->long_size * 2 + 4; /* room for int prefix */
1108 sql->status = OCIDefineByPos(stmt->stmt, &stmt->out[i].defn,
1109 sql->err, i+1,
1118 sql->status = OCIDescriptorAlloc(dbd_oracle_env,
1124 sql->status = OCIDefineByPos(stmt->stmt, &stmt->out[i].defn,
1125 sql->err, i+1,
1132 switch (sql->status) {
1142 static int dbd_oracle_pquery(apr_pool_t *pool, apr_dbd_t *sql,
1148 apr_dbd_transaction_t* trans = sql->trans;
1178 sql->status = OCIStmtExecute(sql->svc, statement->stmt, sql->err, 1, 0,
1180 switch (sql->status) {
1185 OCIErrorGet(sql->err, 1, NULL, &errorcode,
1186 sql->buf, sizeof(sql->buf), OCI_HTYPE_ERROR);
1187 printf("Execute error %d: %s\n", sql->status, sql->buf);
1197 sql->status = OCIAttrGet(statement->stmt, OCI_HTYPE_STMT, nrows, 0,
1198 OCI_ATTR_ROW_COUNT, sql->err);
1202 static int dbd_oracle_pvquery(apr_pool_t *pool, apr_dbd_t *sql,
1209 if (sql->trans && sql->trans->status == TRANS_ERROR) {
1219 return dbd_oracle_pquery(pool, sql, nrows, statement, values);
1222 static int dbd_oracle_pselect(apr_pool_t *pool, apr_dbd_t *sql,
1230 apr_dbd_transaction_t* trans = sql->trans;
1255 sql->status = OCIStmtExecute(sql->svc, statement->stmt, sql->err, 0, 0,
1257 switch (sql->status) {
1262 OCIErrorGet(sql->err, 1, NULL, &errorcode,
1263 sql->buf, sizeof(sql->buf), OCI_HTYPE_ERROR);
1264 printf("Executing prepared statement: %s\n", sql->buf);
1277 (*results)->handle = sql;
1286 static int dbd_oracle_pvselect(apr_pool_t *pool, apr_dbd_t *sql,
1294 if (sql->trans && sql->trans->status == TRANS_ERROR) {
1304 return dbd_oracle_pselect(pool, sql, results, statement, seek, values);
1311 apr_dbd_t *sql = statement->handle;
1323 sql->status = OCIBindByPos(stmt, &statement->args[i].bind,
1324 sql->err, i + 1,
1334 sql->status = OCIBindByPos(stmt, &statement->args[i].bind,
1335 sql->err, i + 1,
1345 sql->status = OCIBindByPos(stmt, &statement->args[i].bind,
1346 sql->err, i + 1,
1356 sql->status = OCIBindByPos(stmt, &statement->args[i].bind,
1357 sql->err, i + 1,
1367 sql->status = OCIBindByPos(stmt, &statement->args[i].bind,
1368 sql->err, i + 1,
1378 sql->status = OCIBindByPos(stmt, &statement->args[i].bind,
1379 sql->err, i + 1,
1390 sql->status = OCIBindByPos(stmt, &statement->args[i].bind,
1391 sql->err, i + 1,
1403 sql->status = OCIBindByPos(stmt, &statement->args[i].bind,
1404 sql->err, i + 1,
1416 sql->status = OCIBindByPos(stmt, &statement->args[i].bind,
1417 sql->err, i + 1,
1429 sql->status = OCIBindByPos(stmt, &statement->args[i].bind,
1430 sql->err, i + 1,
1440 sql->status = OCIBindByPos(stmt, &statement->args[i].bind,
1441 sql->err, i + 1,
1451 sql->status = OCIBindByPos(stmt, &statement->args[i].bind,
1452 sql->err, i + 1,
1467 sql->status = OCIBindByPos(stmt, &statement->args[i].bind,
1468 sql->err, i + 1,
1484 sql->status = OCIBindByPos(stmt, &statement->args[i].bind,
1485 sql->err, i + 1,
1501 sql->status = OCIBindByPos(stmt, &statement->args[i].bind,
1502 sql->err, i + 1,
1512 sql->status = OCIBindByPos(stmt, &statement->args[i].bind,
1513 sql->err, i + 1,
1521 if (sql->status != OCI_SUCCESS) {
1529 static int dbd_oracle_pbquery(apr_pool_t * pool, apr_dbd_t * sql,
1535 apr_dbd_transaction_t* trans = sql->trans;
1565 sql->status = OCIStmtExecute(sql->svc, statement->stmt, sql->err, 1, 0,
1567 switch (sql->status) {
1572 OCIErrorGet(sql->err, 1, NULL, &errorcode,
1573 sql->buf, sizeof(sql->buf), OCI_HTYPE_ERROR);
1574 printf("Execute error %d: %s\n", sql->status, sql->buf);
1584 sql->status = OCIAttrGet(statement->stmt, OCI_HTYPE_STMT, nrows, 0,
1585 OCI_ATTR_ROW_COUNT, sql->err);
1589 static int dbd_oracle_pvbquery(apr_pool_t * pool, apr_dbd_t * sql,
1596 if (sql->trans && sql->trans->status == TRANS_ERROR) {
1606 return dbd_oracle_pbquery(pool, sql, nrows, statement, values);
1609 static int dbd_oracle_pbselect(apr_pool_t * pool, apr_dbd_t * sql,
1617 apr_dbd_transaction_t* trans = sql->trans;
1642 sql->status = OCIStmtExecute(sql->svc, statement->stmt, sql->err, 0, 0,
1644 switch (sql->status) {
1649 OCIErrorGet(sql->err, 1, NULL, &errorcode,
1650 sql->buf, sizeof(sql->buf), OCI_HTYPE_ERROR);
1651 printf("Executing prepared statement: %s\n", sql->buf);
1664 (*results)->handle = sql;
1673 static int dbd_oracle_pvbselect(apr_pool_t * pool, apr_dbd_t * sql,
1681 if (sql->trans && sql->trans->status == TRANS_ERROR) {
1691 return dbd_oracle_pbselect(pool, sql, results, statement, seek, values);
1694 static int dbd_oracle_start_transaction(apr_pool_t *pool, apr_dbd_t *sql,
1706 OCIAttrSet(sql->svc, OCI_HTYPE_SVCCTX, (*trans)->trans, 0,
1707 OCI_ATTR_TRANS, sql->err);
1711 sql->status = OCITransStart(sql->svc, sql->err, TRANS_TIMEOUT,
1713 switch (sql->status) {
1716 OCIErrorGet(sql->err, 1, NULL, &errorcode, sql->buf,
1717 sizeof(sql->buf), OCI_HTYPE_ERROR);
1718 printf("Transaction: %s\n", sql->buf);
1723 (*trans)->handle = sql;
1725 sql->trans = *trans;
1821 apr_dbd_t *sql = row->res->handle;
1831 sql->status = OCILobGetLength(sql->svc, sql->err, val->buf.lobval,
1833 switch (sql->status) {
1842 OCIErrorGet(sql->err, 1, NULL, &errorcode,
1843 sql->buf, sizeof(sql->buf), OCI_HTYPE_ERROR);
1844 printf("Finding LOB length: %s\n", sql->buf);
1858 sql->status = OCILobCharSetForm(dbd_oracle_env, sql->err,
1860 if (sql->status == OCI_SUCCESS) {
1861 sql->status = OCILobCharSetId(dbd_oracle_env, sql->err,
1864 switch (sql->status) {
1873 OCIErrorGet(sql->err, 1, NULL, &errorcode,
1874 sql->buf, sizeof(sql->buf), OCI_HTYPE_ERROR);
1875 printf("Reading LOB character set: %s\n", sql->buf);
1897 sql->status = OCILobRead(sql->svc, sql->err, val->buf.lobval,
1900 switch (sql->status) {
1906 OCIErrorGet(sql->err, 1, NULL, &errorcode,
1907 sql->buf, sizeof(sql->buf), OCI_HTYPE_ERROR);
1908 printf("Reading LOB: %s\n", sql->buf);
2049 apr_dbd_t *sql = row->res->handle;
2055 sql->status = OCILobGetLength(sql->svc, sql->err,
2057 switch(sql->status) {
2132 static apr_status_t dbd_oracle_check_conn(apr_pool_t *pool, apr_dbd_t *sql)
2137 if(dbd_oracle_pselect(pool, sql, &res, sql->check_conn_stmt,