CVS update: php3/functions

From: Date: Tue, 15 Dec 1998 22:46:29 +0000
Subject: CVS update: php3/functions
Groups: php.dev 
Request: Send a blank email to php-dev+get-2812@lists.php.net to get a copy of this message
Date: Tuesday December 15, 1998 @ 17:46 Author: rasmus Update of /repository/php3/functions In directory asf:/home/rasmus/php3/functions Modified Files: pgsql.c Log Message: Prototype comments Index: php3/functions/pgsql.c diff -c php3/functions/pgsql.c:1.72 php3/functions/pgsql.c:1.73 *** php3/functions/pgsql.c:1.72 Thu Sep 24 13:09:25 1998 --- php3/functions/pgsql.c Tue Dec 15 17:46:26 1998 *************** *** 28,34 **** +----------------------------------------------------------------------+ */ ! /* $Id: pgsql.c,v 1.72 1998/09/24 17:09:25 jah Exp $ */ #include <stdlib.h> --- 28,34 ---- +----------------------------------------------------------------------+ */ ! /* $Id: pgsql.c,v 1.73 1998/12/15 22:46:26 rasmus Exp $ */ #include <stdlib.h> *************** *** 368,385 **** return php3_pgsql_module.default_link; } ! void php3_pgsql_connect(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0); } void php3_pgsql_pconnect(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,1); } ! void php3_pgsql_close(INTERNAL_FUNCTION_PARAMETERS) { pval *pgsql_link; --- 368,391 ---- return php3_pgsql_module.default_link; } ! /* {{{ proto int pg_connect([string connection_string] | [string host, string port, [string options, [string tty,]] string database) ! Open a PostgreSQL connection */ void php3_pgsql_connect(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,0); } + /* }}} */ + /* {{{ proto int pg_connect([string connection_string] | [string host, string port, [string options, [string tty,]] string database) + Open a persistent PostgreSQL connection */ void php3_pgsql_pconnect(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_do_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU,1); } ! /* }}} */ + /* {{{ proto bool pg_close([int connection]) + Close a PostgreSQL connection */ void php3_pgsql_close(INTERNAL_FUNCTION_PARAMETERS) { pval *pgsql_link; *************** *** 411,418 **** php3_list_delete(pgsql_link->value.lval); RETURN_TRUE; } ! #define PHP3_PG_DBNAME 1 #define PHP3_PG_ERROR_MESSAGE 2 #define PHP3_PG_OPTIONS 3 --- 417,425 ---- php3_list_delete(pgsql_link->value.lval); RETURN_TRUE; } ! /* }}} */ + #define PHP3_PG_DBNAME 1 #define PHP3_PG_ERROR_MESSAGE 2 #define PHP3_PG_OPTIONS 3 *************** *** 474,511 **** return_value->value.str.val = (char *) estrdup(return_value->value.str.val); return_value->type = IS_STRING; } - void php3_pgsql_dbname(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP3_PG_DBNAME); } void php3_pgsql_error_message(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP3_PG_ERROR_MESSAGE); } void php3_pgsql_options(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP3_PG_OPTIONS); } void php3_pgsql_port(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP3_PG_PORT); } void php3_pgsql_tty(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP3_PG_TTY); } void php3_pgsql_host(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP3_PG_HOST); } void php3_pgsql_exec(INTERNAL_FUNCTION_PARAMETERS) { pval *query,*pgsql_link; --- 481,537 ---- return_value->value.str.val = (char *) estrdup(return_value->value.str.val); return_value->type = IS_STRING; } + /* {{{ proto string pg_dbname([int connection]) + Get the database name */ void php3_pgsql_dbname(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP3_PG_DBNAME); } + /* }}} */ + /* {{{ proto string pg_errormessage([int connection]) + Get the error message string */ void php3_pgsql_error_message(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP3_PG_ERROR_MESSAGE); } + /* }}} */ + /* {{{ proto string pg_options([int connection]) + Get the options associated with the connection */ void php3_pgsql_options(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP3_PG_OPTIONS); } + /* }}} */ + /* {{{ proto int pg_port([int connection]) + Return the port number associated with the connection */ void php3_pgsql_port(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP3_PG_PORT); } + /* }}} */ + /* {{{ proto string pg_tty([int connection]) + Return the tty name associated with the connection */ void php3_pgsql_tty(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP3_PG_TTY); } + /* }}} */ + /* {{{ proto string pg_host([int connection]) + Returns the host name associated with the connection */ void php3_pgsql_host(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_get_link_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP3_PG_HOST); } + /* }}} */ + /* {{{ proto int pg_exec([int connection,] string query) + Execute a query */ void php3_pgsql_exec(INTERNAL_FUNCTION_PARAMETERS) { pval *query,*pgsql_link; *************** *** 572,579 **** break; } } - #define PHP3_PG_NUM_ROWS 1 #define PHP3_PG_NUM_FIELDS 2 #define PHP3_PG_CMD_TUPLES 3 --- 598,605 ---- break; } } + /* }}} */ #define PHP3_PG_NUM_ROWS 1 #define PHP3_PG_NUM_FIELDS 2 #define PHP3_PG_CMD_TUPLES 3 *************** *** 619,641 **** } return_value->type = IS_LONG; } - void php3_pgsql_num_rows(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_get_result_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP3_PG_NUM_ROWS); } void php3_pgsql_num_fields(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_get_result_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP3_PG_NUM_FIELDS); } void php3_pgsql_cmdtuples(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_get_result_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP3_PG_CMD_TUPLES); } char *get_field_name(PGconn *pgsql, Oid oid, HashTable *list) { PGresult *result; --- 645,676 ---- } return_value->type = IS_LONG; } + /* {{{ proto int pg_numrows(int result) + Return the number of rows in the result */ void php3_pgsql_num_rows(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_get_result_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP3_PG_NUM_ROWS); } + /* }}} */ + /* {{{ proto int pg_numfields(int result) + Return the number of fields in the result */ void php3_pgsql_num_fields(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_get_result_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP3_PG_NUM_FIELDS); } + /* }}} */ + /* {{{ proto int pg_cmdtuples(int result) + Returns the number of affected tuples */ void php3_pgsql_cmdtuples(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_get_result_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP3_PG_CMD_TUPLES); } + /* }}} */ + char *get_field_name(PGconn *pgsql, Oid oid, HashTable *list) { PGresult *result; *************** *** 733,756 **** RETURN_FALSE; } } - void php3_pgsql_field_name(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_get_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP3_PG_FIELD_NAME); } void php3_pgsql_field_size(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_get_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP3_PG_FIELD_SIZE); } void php3_pgsql_field_type(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_get_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP3_PG_FIELD_TYPE); } ! void php3_pgsql_field_number(INTERNAL_FUNCTION_PARAMETERS) { pval *result,*field; --- 768,800 ---- RETURN_FALSE; } } + /* {{{ proto string pg_fieldname(int result, int field_number) + Returns the name of the field */ void php3_pgsql_field_name(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_get_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP3_PG_FIELD_NAME); } + /* }}} */ + /* {{{ proto pg_fieldsize(int result, int field_number) + Returns the internal size of the field */ void php3_pgsql_field_size(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_get_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP3_PG_FIELD_SIZE); } + /* }}} */ + /* {{{ proto string pg_fieldtype(int result, int field_number) + Returns the type name for the given field */ void php3_pgsql_field_type(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_get_field_info(INTERNAL_FUNCTION_PARAM_PASSTHRU,PHP3_PG_FIELD_TYPE); } + /* }}} */ ! /* {{{ proto int pg_fieldnum(int result, string field_name) ! Returns the field number of the named field */ void php3_pgsql_field_number(INTERNAL_FUNCTION_PARAMETERS) { pval *result,*field; *************** *** 775,782 **** return_value->value.lval = PQfnumber(pgsql_result,field->value.str.val); return_value->type = IS_LONG; } ! void php3_pgsql_result(INTERNAL_FUNCTION_PARAMETERS) { pval *result, *row, *field=NULL; --- 819,828 ---- return_value->value.lval = PQfnumber(pgsql_result,field->value.str.val); return_value->type = IS_LONG; } ! /* }}} */ + /* {{{ proto mixed pg_result(int result, int row_number, mixed field_name) + Returns values from a result identifier */ void php3_pgsql_result(INTERNAL_FUNCTION_PARAMETERS) { pval *result, *row, *field=NULL; *************** *** 822,830 **** return_value->value.str.val = safe_estrndup(return_value->value.str.val,return_value->value.str.len); return_value->type = IS_STRING; } ! ! void php3_pgsql_fetch_row(INTERNAL_FUNCTION_PARAMETERS) { pval *result, *row; --- 868,877 ---- return_value->value.str.val = safe_estrndup(return_value->value.str.val,return_value->value.str.len); return_value->type = IS_STRING; } ! /* }}} */ ! /* {{{ proto array pg_fetchrow(int result, int row) ! Get a row as an enumerated array */ void php3_pgsql_fetch_row(INTERNAL_FUNCTION_PARAMETERS) { pval *result, *row; *************** *** 873,879 **** } } } ! void php3_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS) { --- 920,926 ---- } } } ! /* }}} */ void php3_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS) { *************** *** 926,938 **** } } ! void php3_pgsql_fetch_array(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU); } ! void php3_pgsql_fetch_object(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU); --- 973,989 ---- } } ! /* ?? This is a rather odd function - why not just point pg_fetcharray() directly at fetch_hash ? -RL */ ! /* {{{ proto array pg_fetch_array(int result, int row) ! Fetch a row as an array */ void php3_pgsql_fetch_array(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU); } ! /* }}} */ + /* {{{ proto object pg_fetch_object(int result, int row) + Fetch a row as an object */ void php3_pgsql_fetch_object(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU); *************** *** 940,947 **** return_value->type = IS_OBJECT; } } - #define PHP3_PG_DATA_LENGTH 1 #define PHP3_PG_DATA_ISNULL 2 --- 991,998 ---- return_value->type = IS_OBJECT; } } + /* }}} */ #define PHP3_PG_DATA_LENGTH 1 #define PHP3_PG_DATA_ISNULL 2 *************** *** 995,1010 **** --- 1046,1069 ---- return_value->type = IS_LONG; } + /* {{{ proto int pg_fieldprtlen(int result, int row, mixed field_name_or_number) + Returns the printed length */ void php3_pgsql_data_length(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_data_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP3_PG_DATA_LENGTH); } + /* }}} */ + /* {{{ proto int pg_fieldisnull(int result, int row, mixed field_name_or_number) + Test if a field is NULL */ void php3_pgsql_data_isnull(INTERNAL_FUNCTION_PARAMETERS) { php3_pgsql_data_info(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP3_PG_DATA_ISNULL); } + /* }}} */ + /* {{{ proto int pg_freeresult(int result) + Free result memory */ void php3_pgsql_free_result(INTERNAL_FUNCTION_PARAMETERS) { pval *result; *************** *** 1028,1035 **** php3_list_delete(result->value.lval); RETURN_TRUE; } ! void php3_pgsql_last_oid(INTERNAL_FUNCTION_PARAMETERS) { pval *result; --- 1087,1096 ---- php3_list_delete(result->value.lval); RETURN_TRUE; } ! /* }}} */ + /* {{{ proto int pg_getlastoid(int result) + Returns the last object identifier */ void php3_pgsql_last_oid(INTERNAL_FUNCTION_PARAMETERS) { pval *result; *************** *** 1058,1064 **** --- 1119,1128 ---- return_value->value.str.val = empty_string; } } + /* }}} */ + /* {{{ proto int pg_locreate(int connection) + Create a large object */ void php3_pgsql_lo_create(INTERNAL_FUNCTION_PARAMETERS) { pval *pgsql_link; *************** *** 1104,1110 **** --- 1168,1177 ---- return_value->value.lval = pgsql_oid; return_value->type = IS_LONG; } + /* }}} */ + /* {{{ proto void pg_lounlink([int connection, ] int large_obj_id) + Delete a large object */ void php3_pgsql_lo_unlink(INTERNAL_FUNCTION_PARAMETERS) { pval *pgsql_link, *oid; *************** *** 1147,1153 **** --- 1214,1223 ---- } RETURN_TRUE; } + /* }}} */ + /* {{{ proto int pg_loopen([int connection,] int objoid, string mode) + Open a large object and return fd */ void php3_pgsql_lo_open(INTERNAL_FUNCTION_PARAMETERS) { pval *pgsql_link, *oid, *mode; *************** *** 1248,1254 **** --- 1318,1327 ---- return_value->type = IS_LONG; } } + /* }}} */ + /* {{{ proto void pg_loclose(int fd) + Close a large object */ void php3_pgsql_lo_close(INTERNAL_FUNCTION_PARAMETERS) { pval *pgsql_lofp; *************** *** 1283,1289 **** --- 1356,1365 ---- php3_list_delete(id); return; } + /* }}} */ + /* {{{ proto string pg_loread(int fd, int len) + Read a large object */ void php3_pgsql_lo_read(INTERNAL_FUNCTION_PARAMETERS) { pval *pgsql_id, *len; *************** *** 1322,1328 **** --- 1398,1407 ---- return_value->value.str.val[nbytes] = 0; return_value->type = IS_STRING; } + /* }}} */ + /* {{{ proto int pg_lowrite(int fd, string buf) + Write a large object */ void php3_pgsql_lo_write(INTERNAL_FUNCTION_PARAMETERS) { pval *pgsql_id, *str; *************** *** 1358,1364 **** --- 1437,1446 ---- return_value->value.lval = nbytes; return_value->type = IS_LONG; } + /* }}} */ + /* {{{ proto void pg_loreadall(int fd) + Read a large object and send straight to browser */ void php3_pgsql_lo_readall(INTERNAL_FUNCTION_PARAMETERS) { pval *pgsql_id; *************** *** 1401,1406 **** --- 1483,1489 ---- RETURN_FALSE; } } + /* }}} */ #endif -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#2812) next »