Lines Matching defs:sql
82 static int dbd_pgsql_select(apr_pool_t *pool, apr_dbd_t *sql,
88 if ( sql->trans && sql->trans->errnum ) {
89 return sql->trans->errnum;
92 if (TXN_IGNORE_ERRORS(sql->trans)) {
93 PGresult *res = PQexec(sql->conn, "SAVEPOINT APR_DBD_TXN_SP");
98 sql->trans->errnum = ret;
102 return sql->trans->errnum = PGRES_FATAL_ERROR;
105 res = PQexec(sql->conn, query);
117 if (TXN_IGNORE_ERRORS(sql->trans)) {
118 PGresult *res = PQexec(sql->conn,
124 sql->trans->errnum = ret;
128 return sql->trans->errnum = PGRES_FATAL_ERROR;
130 } else if (TXN_NOTICE_ERRORS(sql->trans)){
131 sql->trans->errnum = ret;
135 if (TXN_IGNORE_ERRORS(sql->trans)) {
136 PGresult *res = PQexec(sql->conn,
142 sql->trans->errnum = ret;
146 return sql->trans->errnum = PGRES_FATAL_ERROR;
162 if (TXN_IGNORE_ERRORS(sql->trans)) {
163 PGresult *res = PQexec(sql->conn, "SAVEPOINT APR_DBD_TXN_SP");
168 sql->trans->errnum = ret;
172 return sql->trans->errnum = PGRES_FATAL_ERROR;
175 if (PQsendQuery(sql->conn, query) == 0) {
176 if (TXN_IGNORE_ERRORS(sql->trans)) {
177 PGresult *res = PQexec(sql->conn,
183 sql->trans->errnum = ret;
187 return sql->trans->errnum = PGRES_FATAL_ERROR;
189 } else if (TXN_NOTICE_ERRORS(sql->trans)){
190 sql->trans->errnum = 1;
194 if (TXN_IGNORE_ERRORS(sql->trans)) {
195 PGresult *res = PQexec(sql->conn,
201 sql->trans->errnum = ret;
205 return sql->trans->errnum = PGRES_FATAL_ERROR;
213 (*results)->handle = sql->conn;
388 static const char *dbd_pgsql_error(apr_dbd_t *sql, int n)
390 return PQerrorMessage(sql->conn);
393 static int dbd_pgsql_query(apr_dbd_t *sql, int *nrows, const char *query)
397 if (sql->trans && sql->trans->errnum) {
398 return sql->trans->errnum;
401 if (TXN_IGNORE_ERRORS(sql->trans)) {
402 PGresult *res = PQexec(sql->conn, "SAVEPOINT APR_DBD_TXN_SP");
407 sql->trans->errnum = ret;
411 return sql->trans->errnum = PGRES_FATAL_ERROR;
415 res = PQexec(sql->conn, query);
430 if (TXN_IGNORE_ERRORS(sql->trans)) {
431 PGresult *res = PQexec(sql->conn,
437 sql->trans->errnum = ret;
441 sql->trans->errnum = ret;
444 } else if (TXN_NOTICE_ERRORS(sql->trans)){
445 sql->trans->errnum = ret;
448 if (TXN_IGNORE_ERRORS(sql->trans)) {
449 PGresult *res = PQexec(sql->conn,
455 sql->trans->errnum = ret;
459 sql->trans->errnum = ret;
469 apr_dbd_t *sql)
473 PQescapeStringConn(sql->conn, ret, arg, len, NULL);
477 static int dbd_pgsql_prepare(apr_pool_t *pool, apr_dbd_t *sql,
591 res = PQexec(sql->conn, sqlcmd);
608 static int dbd_pgsql_pquery_internal(apr_pool_t *pool, apr_dbd_t *sql,
616 if (TXN_IGNORE_ERRORS(sql->trans)) {
617 PGresult *res = PQexec(sql->conn, "SAVEPOINT APR_DBD_TXN_SP");
622 sql->trans->errnum = ret;
626 return sql->trans->errnum = PGRES_FATAL_ERROR;
631 res = PQexecPrepared(sql->conn, statement->name, statement->nargs,
635 res = PQexecParams(sql->conn, statement->name, statement->nargs, 0,
651 if (TXN_IGNORE_ERRORS(sql->trans)) {
652 PGresult *res = PQexec(sql->conn,
658 sql->trans->errnum = ret;
662 sql->trans->errnum = ret;
665 } else if (TXN_NOTICE_ERRORS(sql->trans)){
666 sql->trans->errnum = ret;
669 if (TXN_IGNORE_ERRORS(sql->trans)) {
670 PGresult *res = PQexec(sql->conn,
676 sql->trans->errnum = ret;
680 sql->trans->errnum = ret;
720 static int dbd_pgsql_pquery(apr_pool_t *pool, apr_dbd_t *sql,
727 if (sql->trans && sql->trans->errnum) {
728 return sql->trans->errnum;
737 return dbd_pgsql_pquery_internal(pool, sql, nrows, statement,
741 static int dbd_pgsql_pvquery(apr_pool_t *pool, apr_dbd_t *sql,
748 if (sql->trans && sql->trans->errnum) {
749 return sql->trans->errnum;
758 return dbd_pgsql_pquery(pool, sql, nrows, statement, values);
761 static int dbd_pgsql_pselect_internal(apr_pool_t *pool, apr_dbd_t *sql,
772 if (TXN_IGNORE_ERRORS(sql->trans)) {
773 PGresult *res = PQexec(sql->conn, "SAVEPOINT APR_DBD_TXN_SP");
778 sql->trans->errnum = ret;
782 sql->trans->errnum = ret;
787 res = PQexecPrepared(sql->conn, statement->name, statement->nargs,
791 res = PQexecParams(sql->conn, statement->name, statement->nargs, 0,
807 if (TXN_IGNORE_ERRORS(sql->trans)) {
808 PGresult *res = PQexec(sql->conn,
814 sql->trans->errnum = ret;
818 sql->trans->errnum = ret;
821 } else if (TXN_NOTICE_ERRORS(sql->trans)){
822 sql->trans->errnum = ret;
826 if (TXN_IGNORE_ERRORS(sql->trans)) {
827 PGresult *res = PQexec(sql->conn,
833 sql->trans->errnum = ret;
837 sql->trans->errnum = ret;
854 if (TXN_IGNORE_ERRORS(sql->trans)) {
855 PGresult *res = PQexec(sql->conn, "SAVEPOINT APR_DBD_TXN_SP");
860 sql->trans->errnum = ret;
864 sql->trans->errnum = ret;
869 rv = PQsendQueryPrepared(sql->conn, statement->name,
873 rv = PQsendQueryParams(sql->conn, statement->name,
877 if (TXN_IGNORE_ERRORS(sql->trans)) {
878 PGresult *res = PQexec(sql->conn,
884 sql->trans->errnum = ret;
888 sql->trans->errnum = ret;
891 } else if (TXN_NOTICE_ERRORS(sql->trans)){
892 sql->trans->errnum = 1;
896 if (TXN_IGNORE_ERRORS(sql->trans)) {
897 PGresult *res = PQexec(sql->conn,
903 sql->trans->errnum = ret;
907 sql->trans->errnum = ret;
916 (*results)->handle = sql->conn;
923 static int dbd_pgsql_pselect(apr_pool_t *pool, apr_dbd_t *sql,
931 if (sql->trans && sql->trans->errnum) {
932 return sql->trans->errnum;
941 return dbd_pgsql_pselect_internal(pool, sql, results, statement,
945 static int dbd_pgsql_pvselect(apr_pool_t *pool, apr_dbd_t *sql,
953 if (sql->trans && sql->trans->errnum) {
954 return sql->trans->errnum;
963 return dbd_pgsql_pselect(pool, sql, results, statement, seek, values);
1043 static int dbd_pgsql_pbquery(apr_pool_t * pool, apr_dbd_t * sql,
1050 if (sql->trans && sql->trans->errnum) {
1051 return sql->trans->errnum;
1060 return dbd_pgsql_pquery_internal(pool, sql, nrows, statement,
1064 static int dbd_pgsql_pvbquery(apr_pool_t * pool, apr_dbd_t * sql,
1071 if (sql->trans && sql->trans->errnum) {
1072 return sql->trans->errnum;
1081 return dbd_pgsql_pbquery(pool, sql, nrows, statement, values);
1084 static int dbd_pgsql_pbselect(apr_pool_t * pool, apr_dbd_t * sql,
1092 if (sql->trans && sql->trans->errnum) {
1093 return sql->trans->errnum;
1102 return dbd_pgsql_pselect_internal(pool, sql, results, statement,
1106 static int dbd_pgsql_pvbselect(apr_pool_t * pool, apr_dbd_t * sql,
1114 if (sql->trans && sql->trans->errnum) {
1115 return sql->trans->errnum;
1124 return dbd_pgsql_pbselect(pool, sql, results, statement, seek, values);
1212 apr_dbd_t *sql;
1231 sql = apr_pcalloc (pool, sizeof (*sql));
1233 sql->conn = conn;
1235 return sql;