mirror of
https://github.com/danog/ext-pq.git
synced 2024-11-30 04:19:49 +01:00
update from docs
This commit is contained in:
parent
9ba862160c
commit
753359f19c
@ -162,7 +162,7 @@ PHP_MINIT_FUNCTION(pq_misc)
|
||||
{
|
||||
zend_class_entry **json, ce = {0};
|
||||
|
||||
INIT_NS_CLASS_ENTRY(ce, "pq", "ConverterInterface", php_pqconv_methods);
|
||||
INIT_NS_CLASS_ENTRY(ce, "pq", "Converter", php_pqconv_methods);
|
||||
php_pqconv_class_entry = zend_register_internal_interface(&ce TSRMLS_CC);
|
||||
|
||||
memset(&ce, 0, sizeof(ce));
|
||||
|
@ -20,18 +20,6 @@
|
||||
|
||||
#include <libpq-fe.h>
|
||||
|
||||
/*
|
||||
#include <Zend/zend_interfaces.h>
|
||||
#include <Zend/zend_exceptions.h>
|
||||
#include <ext/spl/spl_array.h>
|
||||
#include <ext/spl/spl_exceptions.h>
|
||||
#include <ext/raphf/php_raphf.h>
|
||||
|
||||
#include <libpq-events.h>
|
||||
#include <libpq/libpq-fs.h>
|
||||
#include <fnmatch.h>
|
||||
*/
|
||||
|
||||
#include "php_pq.h"
|
||||
#include "php_pq_misc.h"
|
||||
#include "php_pqcancel.h"
|
||||
@ -114,13 +102,14 @@ static PHP_MINFO_FUNCTION(pq)
|
||||
php_info_print_table_end();
|
||||
}
|
||||
|
||||
const zend_function_entry pq_functions[] = {
|
||||
static const zend_function_entry pq_functions[] = {
|
||||
{0}
|
||||
};
|
||||
|
||||
static zend_module_dep pq_module_deps[] = {
|
||||
ZEND_MOD_REQUIRED("raphf")
|
||||
ZEND_MOD_REQUIRED("spl")
|
||||
ZEND_MOD_OPTIONAL("json")
|
||||
ZEND_MOD_END
|
||||
};
|
||||
|
||||
|
@ -1851,7 +1851,7 @@ static int apply_set_converter(void *p TSRMLS_DC, int argc, va_list argv, zend_h
|
||||
}
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(ai_pqconn_set_converter, 0, 0, 1)
|
||||
ZEND_ARG_OBJ_INFO(0, converter, pq\\ConverterInterface, 0)
|
||||
ZEND_ARG_OBJ_INFO(0, converter, pq\\Converter, 0)
|
||||
ZEND_END_ARG_INFO();
|
||||
static PHP_METHOD(pqconn, setConverter) {
|
||||
STATUS rv;
|
||||
@ -1882,7 +1882,7 @@ static PHP_METHOD(pqconn, setConverter) {
|
||||
}
|
||||
|
||||
ZEND_BEGIN_ARG_INFO_EX(ai_pqconn_unset_converter, 0, 0, 1)
|
||||
ZEND_ARG_OBJ_INFO(0, converter, pq\\ConverterInterface, 0)
|
||||
ZEND_ARG_OBJ_INFO(0, converter, pq\\Converter, 0)
|
||||
ZEND_END_ARG_INFO();
|
||||
static PHP_METHOD(pqconn, unsetConverter) {
|
||||
STATUS rv;
|
||||
|
@ -108,8 +108,8 @@ static void php_pqcur_object_free(void *o TSRMLS_DC)
|
||||
fprintf(stderr, "FREE cur(#%d) %p (conn: %p)\n", obj->zv.handle, obj, obj->intern->conn);
|
||||
#endif
|
||||
if (obj->intern) {
|
||||
//cur_close(obj TSRMLS_CC);
|
||||
//php_pq_object_delref(obj->intern->conn TSRMLS_CC);
|
||||
cur_close(obj TSRMLS_CC);
|
||||
php_pq_object_delref(obj->intern->conn TSRMLS_CC);
|
||||
efree(obj->intern->decl);
|
||||
efree(obj->intern->name);
|
||||
efree(obj->intern);
|
||||
|
@ -655,8 +655,14 @@ ZEND_BEGIN_ARG_INFO_EX(ai_pqres_bind, 0, 0, 2)
|
||||
ZEND_END_ARG_INFO();
|
||||
static PHP_METHOD(pqres, bind) {
|
||||
zval *zcol, *zref;
|
||||
zend_error_handling zeh;
|
||||
STATUS rv;
|
||||
|
||||
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/z", &zcol, &zref)) {
|
||||
zend_replace_error_handling(EH_THROW, exce(EX_INVALID_ARGUMENT), &zeh TSRMLS_CC);
|
||||
rv = zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z/z", &zcol, &zref);
|
||||
zend_restore_error_handling(&zeh TSRMLS_CC);
|
||||
|
||||
if (SUCCESS == rv) {
|
||||
php_pqres_object_t *obj = zend_object_store_get_object(getThis() TSRMLS_CC);
|
||||
|
||||
if (!obj->intern) {
|
||||
@ -811,9 +817,7 @@ static PHP_METHOD(pqres, fetchCol) {
|
||||
|
||||
zend_replace_error_handling(EH_THROW, exce(EX_RUNTIME), &zeh TSRMLS_CC);
|
||||
php_pqres_iteration(getThis(), obj, obj->intern->iter ? obj->intern->iter->fetch_type : 0, &row TSRMLS_CC);
|
||||
if (!row) {
|
||||
RETVAL_FALSE;
|
||||
} else {
|
||||
if (row) {
|
||||
php_pqres_col_t col;
|
||||
|
||||
if (SUCCESS != column_nn(obj, zcol, &col TSRMLS_CC)) {
|
||||
@ -856,7 +860,6 @@ static PHP_METHOD(pqres, fetchAllCols) {
|
||||
php_pqres_col_t col;
|
||||
|
||||
zend_replace_error_handling(EH_THROW, exce(EX_RUNTIME), &zeh TSRMLS_CC);
|
||||
|
||||
if (SUCCESS == column_nn(obj, zcol, &col TSRMLS_CC)) {
|
||||
int r, rows = PQntuples(obj->intern->res);
|
||||
|
||||
@ -865,7 +868,6 @@ static PHP_METHOD(pqres, fetchAllCols) {
|
||||
add_next_index_zval(return_value, php_pqres_get_col(obj->intern, r, col.num TSRMLS_CC));
|
||||
}
|
||||
}
|
||||
|
||||
zend_restore_error_handling(&zeh TSRMLS_CC);
|
||||
}
|
||||
}
|
||||
@ -1193,6 +1195,7 @@ PHP_MINIT_FUNCTION(pqres)
|
||||
zend_declare_class_constant_long(php_pqres_class_entry, ZEND_STRL("CONV_SCALAR"), PHP_PQRES_CONV_SCALAR TSRMLS_CC);
|
||||
zend_declare_class_constant_long(php_pqres_class_entry, ZEND_STRL("CONV_ARRAY"), PHP_PQRES_CONV_ARRAY TSRMLS_CC);
|
||||
zend_declare_class_constant_long(php_pqres_class_entry, ZEND_STRL("CONV_DATETIME"), PHP_PQRES_CONV_DATETIME TSRMLS_CC);
|
||||
zend_declare_class_constant_long(php_pqres_class_entry, ZEND_STRL("CONV_JSON"), PHP_PQRES_CONV_JSON TSRMLS_CC);
|
||||
zend_declare_class_constant_long(php_pqres_class_entry, ZEND_STRL("CONV_ALL"), PHP_PQRES_CONV_ALL TSRMLS_CC);
|
||||
|
||||
return SUCCESS;
|
||||
|
@ -12,7 +12,7 @@ echo "Test\n";
|
||||
|
||||
include "_setup.inc";
|
||||
|
||||
abstract class Converter implements pq\ConverterInterface
|
||||
abstract class Converter implements pq\Converter
|
||||
{
|
||||
protected $types;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user