summaryrefslogtreecommitdiff
path: root/ext/pgsql/pgsql.c
diff options
context:
space:
mode:
authorfoobar <sniper@php.net>2003-03-10 23:13:03 +0000
committerfoobar <sniper@php.net>2003-03-10 23:13:03 +0000
commit9f34a5beca75fba08d7e9d5a7753024f88363006 (patch)
tree339fd1eb88184c5a23c988ea61da26313a2599ae /ext/pgsql/pgsql.c
parent05ce4935472d792d4fab838581e578db4f0e2342 (diff)
downloadphp-git-9f34a5beca75fba08d7e9d5a7753024f88363006.tar.gz
MFH
Diffstat (limited to 'ext/pgsql/pgsql.c')
-rw-r--r--ext/pgsql/pgsql.c43
1 files changed, 16 insertions, 27 deletions
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index 07c148ff62..fd85be62f9 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -997,7 +997,7 @@ static void php_pgsql_get_result_info(INTERNAL_FUNCTION_PARAMETERS, int entry_ty
#if HAVE_PQCMDTUPLES
Z_LVAL_P(return_value) = atoi(PQcmdTuples(pgsql_result));
#else
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not supportted under this build.");
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not supported under this build.");
Z_LVAL_P(return_value) = 0;
#endif
break;
@@ -1727,7 +1727,7 @@ PHP_FUNCTION(pg_lo_unlink)
zval *pgsql_link = NULL;
long oid_long;
char *oid_string, *end_ptr;
- size_t oid_strlen;
+ int oid_strlen;
PGconn *pgsql;
Oid oid;
int id = -1;
@@ -1794,7 +1794,7 @@ PHP_FUNCTION(pg_lo_open)
zval *pgsql_link = NULL;
long oid_long;
char *oid_string, *end_ptr, *mode_string;
- size_t oid_strlen, mode_strlen;
+ int oid_strlen, mode_strlen;
PGconn *pgsql;
Oid oid;
int id = -1, pgsql_mode=0, pgsql_lofd;
@@ -2099,7 +2099,7 @@ PHP_FUNCTION(pg_lo_export)
{
zval *pgsql_link = NULL;
char *file_out, *oid_string, *end_ptr;
- size_t oid_strlen;
+ int oid_strlen;
int id = -1, name_len;
long oid_long;
Oid oid;
@@ -2442,9 +2442,7 @@ PHP_FUNCTION(pg_copy_to)
case PGRES_COPY_OUT:
if (pgsql_result) {
PQclear(pgsql_result);
- if (array_init(return_value) == FAILURE) {
- RETURN_FALSE;
- }
+ array_init(return_value);
while (!copydone)
{
if ((ret = PQgetline(pgsql, copybuf, COPYBUFSIZ))) {
@@ -2601,8 +2599,8 @@ PHP_FUNCTION(pg_copy_from)
PHP_FUNCTION(pg_escape_string)
{
char *from = NULL, *to = NULL;
- size_t to_len;
- long from_len;
+ int to_len;
+ int from_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
&from, &from_len) == FAILURE) {
return;
@@ -2620,7 +2618,7 @@ PHP_FUNCTION(pg_escape_bytea)
{
char *from = NULL, *to = NULL;
size_t to_len;
- long from_len;
+ int from_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
&from, &from_len) == FAILURE) {
return;
@@ -2668,8 +2666,6 @@ static unsigned char * php_pgsql_unescape_bytea(unsigned char *strtext, size_t *
buflen = strlen(strtext); /* will shrink, also we discover if
* strtext */
buffer = (unsigned char *) emalloc(buflen); /* isn't NULL terminated */
- if (buffer == NULL)
- return NULL;
for (bp = buffer, sp = strtext; *sp != '\0'; bp++, sp++)
{
switch (state)
@@ -2744,7 +2740,7 @@ PHP_FUNCTION(pg_unescape_bytea)
{
char *from = NULL, *to = NULL;
size_t to_len;
- long from_len;
+ int from_len;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
&from, &from_len) == FAILURE) {
return;
@@ -2957,7 +2953,7 @@ PHP_FUNCTION(pg_send_query)
/* }}} */
-/* {{{ proto resource pg_get_result([resource connection])
+/* {{{ proto resource pg_get_result(resource connection)
Get asynchronous query result */
PHP_FUNCTION(pg_get_result)
{
@@ -3081,7 +3077,7 @@ PHPAPI int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, zval *me
PGresult *pg_result;
char *tmp_name;
smart_str querystr = {0};
- size_t new_len;
+ int new_len;
int i, num_rows;
zval *elem;
@@ -3269,11 +3265,7 @@ static int php_pgsql_convert_match(const char *str, const char *regex , int icas
return FAILURE;
}
subs = (regmatch_t *)ecalloc(sizeof(regmatch_t), re.re_nsub+1);
- if (!subs) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot allocate memory.");
- regfree(&re);
- return FAILURE;
- }
+
regerr = regexec(&re, str, re.re_nsub+1, subs, 0);
if (regerr == REG_NOMATCH) {
#ifdef PHP_DEBUG
@@ -3353,11 +3345,7 @@ PHPAPI int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval
return FAILURE;
}
MAKE_STD_ZVAL(meta);
- if (array_init(meta) == FAILURE) {
- zval_dtor(meta);
- FREE_ZVAL(meta);
- return FAILURE;
- }
+ array_init(meta);
if (php_pgsql_meta_data(pg_link, table_name, meta TSRMLS_CC) == FAILURE) {
zval_dtor(meta);
FREE_ZVAL(meta);
@@ -3981,7 +3969,8 @@ PHPAPI int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var_array,
char buf[256];
char *fld;
smart_str querystr = {0};
- int key_type, fld_len, ret = FAILURE;
+ int key_type, ret = FAILURE;
+ uint fld_len;
ulong num_idx;
HashPosition pos;
@@ -4111,7 +4100,7 @@ PHP_FUNCTION(pg_insert)
static inline int build_assignment_string(smart_str *querystr, HashTable *ht, const char *pad, int pad_len TSRMLS_DC)
{
HashPosition pos;
- size_t fld_len;
+ uint fld_len;
int key_type;
ulong num_idx;
char *fld;