#include <postgresql/libpq-fe.h>#include "../../basext.h"#include <stdio.h>#include <string.h>#include <stdlib.h>Go to the source code of this file.
Data Structures | |
| struct | _Wrapper |
| struct | _ModuleGlobal |
Defines | |
| #define | PTS_MODULE "pgsqlinterf.c" |
| #define | DEBUGMSG(x) |
| #define | assert(x) |
| #define | NDEBUG 1 |
| #define | InvalidOid 0 |
| #define | PGSQL_ERROR_CON_EXPECTED 0x00081001 |
| #define | PGSQL_ERROR_RES_EXPECTED 0x00081002 |
| #define | PGSQL_ERROR_HAN_EXPECTED 0x00081003 |
| #define | PGSQL_ERROR_CONNGET_KEY 0x00081004 |
| #define | PGSQL_ERROR_LVAL_EXPECTED 0x00081005 |
| #define | PGSQL_ERROR_EST_EXPECTED 0x00081006 |
| #define | copystr(dst, src) |
| #define | copystrz(dst, src) |
| #define | copystry(dst, src) |
| #define | copylong(dst, src) |
| #define | streq(var, strz) (STRLEN(var)==strlen(strz) && 0==memcmp(STRINGVALUE(var),strz,STRLEN(var))) |
| #define | strbegins(var, strz) (STRLEN(var)>=strlen(strz) && 0==memcmp(STRINGVALUE(var),strz,strlen(strz))) |
Typedefs | |
| typedef enum _TY | TY |
| typedef _Wrapper | Wrapper |
| typedef _Wrapper * | pWrapper |
| typedef _ModuleGlobal | ModuleGlobal |
| typedef _ModuleGlobal * | pModuleGlobal |
Enumerations | |
| enum | _TY { CON = 1, RES = 2 } |
Functions | |
| static void | stderrNoticeProcessor (void *arg, const char *message) |
| static void | silentNoticeProcessor (void *arg, const char *message) |
| besSUB_ERRMSG (void) | |
| besEND | besVERSION_NEGOTIATE (void) |
| static besEND Wrapper * | alloc_Wrapper (pSupportTable pSt, ModuleGlobal *mg) |
| static void | delete_Wrapper (pSupportTable pSt, ModuleGlobal *mg, Wrapper *w) |
| besFUNCTION (PGopen) | |
| else | if (TYPE(Argument)==VTYPE_STRING) |
| LONGVALUE (besRETURNVALUE) | |
| besEND | besFUNCTION (PGclose) |
| besFUNCTION (PGconnget) | |
| besALLOC_RETURN_STRING (strlen(s)) | |
| memcpy (STRINGVALUE(besRETURNVALUE), s, STRLEN(besRETURNVALUE)) | |
| besEND | besFUNCTION (PGok) |
| for (p=cio;p!=cioend-3;p++) | |
| PQconninfoFree (cio) | |
| besEND | besFUNCTION (PGnotified) |
| if (!(no=PQnotifies(w->u.con))) | |
| besLEFTVALUE (Argument2, Lval) | |
| while (len< NAMEDATALEN &&no->relname![len]='\0') | |
| if (!(query=besALLOC(sumlen))) | |
| DEBUGMSG (fprintf(stderr,"qry=(%s)\n", query);) | |
| if (est==PGRES_COMMAND_OK||est==PGRES_TUPLES_OK) | |
| besALLOC_RETURN_STRING (strlen(s)+2+strlen(dst)) | |
| memcpy (STRINGVALUE(besRETURNVALUE), s, strlen(s)) | |
| memcpy (STRINGVALUE(besRETURNVALUE)+strlen(s),": ", 2) | |
| memcpy (STRINGVALUE(besRETURNVALUE)+strlen(s)+2, dst, strlen(dst)) | |
| if (res) | |
| besDEREFERENCE (Argument) | |
| besDEREFERENCE (Argument2) | |
| if (besARGNR, 2) | |
| besCONVERT2STRING (Argument2) | |
| if (strbegins(Argument2,"PGRES_EMPTY_QUERY")) | |
| besEND | besFUNCTION (PGoid) |
| if (besARGNR, 1) | |
| if (InvalidOid==(oid=PQftype(w->u.res, idx))) | |
| besEND | besFUNCTION (PGcolmod) |
| besEND | besFUNCTION (PGcolsize) |
| besEND | besFUNCTION (PGgetvalue) |
| besCONVERT2LONG (Argument2) | |
| if (!(v=PQgetvalue(w->u.res, LONGVALUE(Argument2), idx))||PQgetisnull(w->u.res, LONGVALUE(Argument2), idx)>0) | |
| besEND | besFUNCTION (PGgetlength) |
| if (0 >(len=PQgetlength(w->u.res, LONGVALUE(Argument2), idx))) | |
| besEND | besFUNCTION (PGgetisnull) |
| if (0 >(len=PQgetisnull(w->u.res, LONGVALUE(Argument2), idx))) | |
| besEND | besFUNCTION (PGbinaryTuples) |
| besALLOC_RETURN_STRING (tmp) | |
| besEND | besFUNCTION (PGcmdTuples) |
Variables | |
| return | NULL |
| return | |
| besALLOC_RETURN_LONG | |
| besRETURNVALUE = NULL | |
| len = 0 | |
| * | dst = '\0' |
| est = !res ? PGRES_FATAL_ERROR : PQresultStatus(res) | |
| s = PQresStatus(est) | |
| dst = res ? PQresultErrorMessage(res) : "PQexec() returned NULL" | |
| Wrapper * | w |
| PGconn * | con = NULL |
| PGresult * | res |
| VARIABLE | Argument = besARGUMENT(1) |
| VARIABLE | Argument2 = besARGUMENT(2) |
| void | pEo |
| w | ty = RES |
| w u | res = res |
| besALLOC_RETURN_LONG | |
| VARIABLE | Argument = besARGUMENT(1) |
| void | pEo |
| void | ppModuleInternal |
| Wrapper * | w |
| int | idx = -1 |
| char * | s = NULL |
| VARIABLE | Argument = besARGUMENT(1) |
| VARIABLE | Argument2 = besARGUMENT(2) |
| void | pEo |
| else | idx = LONGVALUE(Argument2) |
| else | idx = LONGVALUE(Argument2) |
| else | idx = LONGVALUE(Argument2) |
| else | idx = LONGVALUE(Argument3) |
| else | idx = LONGVALUE(Argument3) |
| else | idx = LONGVALUE(Argument3) |
| tmp = strlen(s) | |
| tmp = strlen(s) | |
| besRETURNVALUE = besCONVERT2LONG(besRETURNVALUE) | |
|
|
Definition at line 39 of file interface.c. Referenced by allocset(), besVERSION_NEGOTIATE(), bothcases(), delete_Wrapper(), doemit(), dofwd(), doinsert(), dupl(), findmust(), firstch(), mccase(), mcinvert(), mcsub(), nonnewline(), othercase(), p_bracket(), p_ere_exp(), p_simp_re(), regerror(), regexec(), and repeat(). |
|
|
Value: Definition at line 90 of file interface.c. |
|
|
Value: (\ ((dst)=besNEWSTRING(STRLEN(src))) && \ (memcpy(STRINGVALUE(dst),STRINGVALUE(src),STRLEN(src)), 1) \ ) Definition at line 77 of file interface.c. |
|
|
Value: (src ? (tmplen=strlen(src), \ ((dst)=besNEWSTRING(tmplen)) && \ (memcpy(STRINGVALUE(dst),src,tmplen), 1) \ ) : ((dst)=NULL, 1) ) Definition at line 86 of file interface.c. |
|
|
Value: (tmplen=strlen(src), \ ((dst)=besNEWSTRING(tmplen)) && \ (memcpy(STRINGVALUE(dst),src,tmplen), 1) \ ) Definition at line 81 of file interface.c. |
|
|
Definition at line 38 of file interface.c. Referenced by alloc_Wrapper(), besFUNCTION(), besVERSION_NEGOTIATE(), and delete_Wrapper(). |
|
|
Definition at line 44 of file interface.c. |
|
|
Definition at line 40 of file interface.c. |
|
|
Definition at line 70 of file interface.c. Referenced by besFUNCTION(). |
|
|
Definition at line 73 of file interface.c. Referenced by besFUNCTION(). |
|
|
Definition at line 75 of file interface.c. |
|
|
Definition at line 72 of file interface.c. |
|
|
Definition at line 74 of file interface.c. |
|
|
Definition at line 71 of file interface.c. |
|
|
Definition at line 24 of file interface.c. Referenced by alloc_Wrapper(), besVERSION_NEGOTIATE(), and delete_Wrapper(). |
|
|
Definition at line 96 of file interface.c. |
|
|
Definition at line 94 of file interface.c. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 47 of file interface.c. |
|
||||||||||||
|
May return NULL Definition at line 205 of file interface.c. References besLockMutex(), besUnlockMutex(), DEBUGMSG, _ModuleGlobal::first, _ModuleGlobal::ha, _Wrapper::next, NULL, _Wrapper::prev, PTS_MODULE, and w. Referenced by if(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Referenced by basext_GetArgsF(), besFUNCTION(), CHECK_OPTION(), and if(). |
|
|
|
|
|
|
|
|
Definition at line 981 of file interface.c. |
|
|
Definition at line 945 of file interface.c. |
|
|
Definition at line 913 of file interface.c. References besCONVERT2STRING(), besCONVERT2ZCHAR(), and besFREE(). |
|
|
Definition at line 881 of file interface.c. References besCONVERT2STRING(), besCONVERT2ZCHAR(), and besFREE(). |
|
|
Definition at line 845 of file interface.c. References besCONVERT2STRING(), besCONVERT2ZCHAR(), and besFREE(). |
|
|
Definition at line 814 of file interface.c. References besCONVERT2STRING(), besCONVERT2ZCHAR(), besFREE(), DEBUGMSG, if(), and w. |
|
|
Definition at line 785 of file interface.c. References besCONVERT2STRING(), besCONVERT2ZCHAR(), besFREE(), and w. |
|
|
Definition at line 635 of file interface.c. |
|
|
Definition at line 409 of file interface.c. References besRETURNVALUE, and NULL. |
|
|
Definition at line 340 of file interface.c. References COMMAND_ERROR_MEMORY_LOW, and PQconninfoFree(). |
|
|
Definition at line 305 of file interface.c. References besALLOC_RETURN_LONG, besRETURNVALUE, LONGVALUE(), PGSQL_ERROR_CONNGET_KEY, STRINGVALUE(), STRLEN(), and w. |
|
|
Definition at line 281 of file interface.c. |
|
|
Definition at line 240 of file interface.c. References besMODULEPOINTER, CON, PGSQL_ERROR_CON_EXPECTED, and w. |
|
||||||||||||
|
|
|
|
Definition at line 110 of file interface.c. |
|
|
Definition at line 126 of file interface.c. |
|
|
Definition at line 537 of file interface.c. |
|
||||||||||||||||
|
Also calls PGfinish() or PGclear() Definition at line 221 of file interface.c. References assert, besFREE(), besLockMutex(), besUnlockMutex(), CON, DEBUGMSG, _ModuleGlobal::first, _ModuleGlobal::ha, NULL, PTS_MODULE, RES, and w. |
|
|
Definition at line 385 of file interface.c. |
|
||||||||||||
|
Definition at line 937 of file interface.c. |
|
||||||||||||
|
Definition at line 905 of file interface.c. |
|
||||||||||||
|
Definition at line 870 of file interface.c. |
|
|
Definition at line 777 of file interface.c. |
|
||||||||||||
|
Definition at line 661 of file interface.c. |
|
|
Definition at line 616 of file interface.c. |
|
||||||||||||
|
Definition at line 605 of file interface.c. References besMODULEPOINTER, CON, and w. |
|
|
Definition at line 559 of file interface.c. |
|
|
Definition at line 544 of file interface.c. References alloc_Wrapper(), besALLOC_RETURN_LONG, besMODULEPOINTER, besRETURNVALUE, LONGVALUE(), pSt, RES, and w. |
|
|
Definition at line 514 of file interface.c. |
|
|
Definition at line 433 of file interface.c. References besALLOC_RETURN_LONG, besRETURNVALUE, LONGVALUE(), and NULL. |
|
|
Definition at line 252 of file interface.c. |
|
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
||||||||||||||||
|
|
|
|
Referenced by besFUNCTION(). |
|
||||||||||||
|
Definition at line 104 of file interface.c. |
|
||||||||||||
|
Definition at line 99 of file interface.c. |
|
|
Definition at line 440 of file interface.c. |
|
|
Definition at line 761 of file interface.c. |
|
|
Definition at line 657 of file interface.c. |
|
|
Definition at line 600 of file interface.c. |
|
|
Definition at line 762 of file interface.c. |
|
|
Definition at line 601 of file interface.c. |
|
|
Definition at line 632 of file interface.c. |
|
|
Definition at line 276 of file interface.c. |
|
|
Definition at line 999 of file interface.c. |
|
|
Definition at line 406 of file interface.c. |
|
|
Definition at line 598 of file interface.c. |
|
|
Definition at line 554 of file interface.c. |
|
|
Definition at line 536 of file interface.c. |
|
|
Definition at line 543 of file interface.c. |
|
|
Definition at line 935 of file interface.c. |
|
|
Definition at line 903 of file interface.c. |
|
|
Definition at line 867 of file interface.c. |
|
|
Definition at line 836 of file interface.c. |
|
|
Definition at line 805 of file interface.c. |
|
|
Definition at line 776 of file interface.c. |
|
|
Definition at line 759 of file interface.c. |
|
|
Definition at line 440 of file interface.c. |
|
|
Definition at line 121 of file interface.c. |
|
|
Definition at line 763 of file interface.c. |
|
|
Definition at line 658 of file interface.c. |
|
|
Definition at line 602 of file interface.c. Referenced by comm_GetCommand(), if(), and while(). |
|
|
Definition at line 659 of file interface.c. |
|
|
Definition at line 631 of file interface.c. |
|
|
Definition at line 599 of file interface.c. |
|
|
Definition at line 201 of file interface.c. |
|
|
Definition at line 760 of file interface.c. |
|
|
Definition at line 553 of file interface.c. |
|
|
Definition at line 996 of file interface.c. |
|
|
Definition at line 976 of file interface.c. |
|
|
Definition at line 631 of file interface.c. |
|
|
Definition at line 757 of file interface.c. |
|
|
Definition at line 596 of file interface.c. |
1.4.6-NO