Pg-PQ

 view release on metacpan or  search on metacpan

PQ.xs  view on Meta::CPAN


char *PQescapeIdentifier(PGconn *conn, const char *str, size_t length(str))
CLEANUP:
    if (RETVAL) PQfreemem(RETVAL);

#endif

# unsigned char *PQescapeByteaConn(PGconn *conn, unsigned char *from, size_t from_length, size_t *to_length);

# int PQsendQuery(PGconn *conn, const char *command);

# int PQsendQueryParams(PGconn *conn, const char *command, int nParams, const Oid *paramTypes, const char * const *paramValues, const int *paramLengths, const int *paramFormats, int resultFormat);

int PQsendQuery(PGconn *conn, const char *command, ...)
CODE:
    if (items <= 2) {
        RETVAL = PQsendQuery(conn, command);
    }
    else {
        int n = items - 2, i;
        char **values;
        Newx(values, n, char *);
        for (i = 0; i < n; i++) {
            SV *sv = ST(i + 2);
            values[i] = (SvOK(sv) ? SvPVutf8_nolen(sv) : NULL);
        }
        RETVAL = PQsendQueryParams(conn, command, n, NULL, (const char **)values, NULL, NULL, 0);
        Safefree(values);
    }
OUTPUT:
    RETVAL


# int PQsendPrepare(PGconn *conn, const char *stmtName, const char *query, int nParams, const Oid *paramTypes);

int PQsendPrepare(PGconn *conn, const char *stmtName, const char *query)
C_ARGS: conn, stmtName, query, 0, NULL

# int PQsendQueryPrepared(PGconn *conn, char *stmtName, int nParams, const char * const *paramValues, const int *paramLengths, const int *paramFormats, int resultFormat);

int PQsendQueryPrepared(PGconn *conn, const char *stmtName, ...)
PREINIT:
    int n = items - 2, i;
    char **values;
CODE:
    Newx(values, n, char *);
    for (i = 0; i < n; i++) values[i] = SvPVutf8_nolen(ST(i + 2));
    RETVAL = PQsendQueryPrepared(conn, stmtName, n, (const char **)values, NULL, NULL, 0);
    Safefree(values);
OUTPUT:
    RETVAL

PGresult *PQgetResult(PGconn *conn);
ALIAS:
    result = 0

int PQconsumeInput(PGconn *conn);

int PQisBusy(PGconn *conn)
ALIAS:
    busy = 0

int PQsetnonblocking(PGconn *conn, int arg)

int PQisnonblocking(PGconn *conn);

int nonBlocking(PGconn *conn, SV *nb = &PL_sv_undef)
CODE:
    if (SvOK(nb))
        PQsetnonblocking(conn, SvIV(nb));
    RETVAL = PQisnonblocking(conn);
OUTPUT:
    RETVAL

int PQflush(PGconn *conn);

# PGresult *PQfn(PGconn *conn, int fnid, int *result_buf, int *result_len, int result_is_int, const PQArgBlock *args, int nargs);


MODULE = Pg::PQ		PACKAGE = Pg::PQ::Result          PREFIX=PQ

ExecStatusType PQresultStatus(PGresult *res)
ALIAS:
    status = 0

char *PQresStatus(ExecStatusType status)

char *statusMessage(PGresult *res)
CODE:
    RETVAL = PQresStatus(PQresultStatus(res));
OUTPUT:
    RETVAL

char *PQresultErrorMessage(PGresult *res)
ALIAS:
    errorMessage = 0
CLEANUP:
    sv_chomp(ST(0));

char *PQresultErrorField(PGresult *res, char field);
ALIAS:
    _errorField = 0
CLEANUP:
    sv_chomp(ST(0));

void PQclear(PGresult *res)
POSTCALL:
    sv_setsv(ST(0), &PL_sv_undef);

int PQntuples(PGresult *res)
ALIAS:
    nTuples = 0
    nRows   = 1

int PQnfields(PGresult *res)
ALIAS:
    nFields  = 0
    nColumns = 1

char *PQfname(PGresult *res, int column_number)
ALIAS:



( run in 0.454 second using v1.01-cache-2.11-cpan-5b529ec07f3 )