More php3_ cleanup

This commit is contained in:
Zeev Suraski 1999-12-17 22:34:04 +00:00
parent 878ed4934c
commit 396bccfb1d
12 changed files with 148 additions and 190 deletions

View file

@ -62,7 +62,7 @@ zend_module_entry ibase_module_entry =
/* {{{ thread safety stuff */ /* {{{ thread safety stuff */
#if defined(THREAD_SAFE) #if defined(THREAD_SAFE)
typedef ibase_global_struct{ typedef ibase_global_struct{
ibase_module php3_ibase_module; ibase_module php_ibase_module;
} ibase_global_struct; } ibase_global_struct;
#define IBASE_GLOBAL(a) ibase_globals->a #define IBASE_GLOBAL(a) ibase_globals->a
@ -74,41 +74,41 @@ typedef ibase_global_struct{
#else #else
#define IBASE_GLOBAL(a) a #define IBASE_GLOBAL(a) a
#define IBASE_TLS_VARS #define IBASE_TLS_VARS
ibase_module php3_ibase_module; ibase_module php_ibase_module;
#endif #endif
/* }}} */ /* }}} */
/* {{{ _php3_ibase_close_link() */ /* {{{ php_ibase_close_link() */
static void _php3_ibase_close_link(isc_db_handle db) static void php_ibase_close_link(isc_db_handle db)
{ {
ISC_STATUS status[20]; ISC_STATUS status[20];
IBASE_TLS_VARS; IBASE_TLS_VARS;
isc_detach_database(status, &db); isc_detach_database(status, &db);
IBASE_GLOBAL(php3_ibase_module).num_links--; IBASE_GLOBAL(php_ibase_module).num_links--;
} }
/* }}} */ /* }}} */
/* {{{ _php3_ibase_close_plink() */ /* {{{ php_ibase_close_plink() */
static void _php3_ibase_close_plink(isc_db_handle db) static void php_ibase_close_plink(isc_db_handle db)
{ {
ISC_STATUS status[20]; ISC_STATUS status[20];
IBASE_TLS_VARS; IBASE_TLS_VARS;
isc_detach_database(status, &db); isc_detach_database(status, &db);
php3_ibase_module.num_persistent--; php_ibase_module.num_persistent--;
php3_ibase_module.num_links--; php_ibase_module.num_links--;
} }
/* }}} */ /* }}} */
/* {{{ _php3_ibase_free_result() */ /* {{{ php_ibase_free_result() */
static void _php3_ibase_free_result(ibase_result_handle *result) static void php_ibase_free_result(ibase_result_handle *result)
{ {
int i; int i;
ISC_STATUS status[20]; ISC_STATUS status[20];
IBASE_TLS_VARS; IBASE_TLS_VARS;
if (!IBASE_GLOBAL(php3_ibase_module).manualtransactions && result->commitok) { if (!IBASE_GLOBAL(php_ibase_module).manualtransactions && result->commitok) {
isc_commit_transaction(status, &result->trans); isc_commit_transaction(status, &result->trans);
} }
if (result->sqlda != NULL) { if (result->sqlda != NULL) {
@ -123,8 +123,8 @@ static void _php3_ibase_free_result(ibase_result_handle *result)
} }
/* }}} */ /* }}} */
/* {{{ _php3_ibase_free_query() */ /* {{{ php_ibase_free_query() */
static void _php3_ibase_free_query(ibase_query_handle *query) static void php_ibase_free_query(ibase_query_handle *query)
{ {
int i; int i;
ISC_STATUS status[20]; ISC_STATUS status[20];
@ -148,37 +148,37 @@ PHP_MINIT_FUNCTION(ibase)
{ {
IBASE_TLS_VARS; IBASE_TLS_VARS;
if (cfg_get_long("ibase.allow_persistent", &IBASE_GLOBAL(php3_ibase_module).allow_persistent) == FAILURE) { if (cfg_get_long("ibase.allow_persistent", &IBASE_GLOBAL(php_ibase_module).allow_persistent) == FAILURE) {
IBASE_GLOBAL(php3_ibase_module).allow_persistent = 1; IBASE_GLOBAL(php_ibase_module).allow_persistent = 1;
} }
if (cfg_get_long("ibase.max_persistent", &IBASE_GLOBAL(php3_ibase_module).max_persistent) == FAILURE) { if (cfg_get_long("ibase.max_persistent", &IBASE_GLOBAL(php_ibase_module).max_persistent) == FAILURE) {
IBASE_GLOBAL(php3_ibase_module).max_persistent = -1; IBASE_GLOBAL(php_ibase_module).max_persistent = -1;
} }
if (cfg_get_long("ibase.max_links", &IBASE_GLOBAL(php3_ibase_module).max_links) == FAILURE) { if (cfg_get_long("ibase.max_links", &IBASE_GLOBAL(php_ibase_module).max_links) == FAILURE) {
IBASE_GLOBAL(php3_ibase_module).max_links = -1; IBASE_GLOBAL(php_ibase_module).max_links = -1;
} }
/* /*
if (cfg_get_long("ibase.manualtransactions", &IBASE_GLOBAL(php3_ibase_module).manualtransactions) == FAILURE) { if (cfg_get_long("ibase.manualtransactions", &IBASE_GLOBAL(php_ibase_module).manualtransactions) == FAILURE) {
IBASE_GLOBAL(php3_ibase_module).manualtransactions = 0; IBASE_GLOBAL(php_ibase_module).manualtransactions = 0;
} }
*/ */
IBASE_GLOBAL(php3_ibase_module).manualtransactions = 0; IBASE_GLOBAL(php_ibase_module).manualtransactions = 0;
if (cfg_get_string("ibase.default_user", &IBASE_GLOBAL(php3_ibase_module).default_user) == FAILURE if (cfg_get_string("ibase.default_user", &IBASE_GLOBAL(php_ibase_module).default_user) == FAILURE
|| IBASE_GLOBAL(php3_ibase_module).default_user[0] == 0) { || IBASE_GLOBAL(php_ibase_module).default_user[0] == 0) {
IBASE_GLOBAL(php3_ibase_module).default_user = ""; IBASE_GLOBAL(php_ibase_module).default_user = "";
} }
if (cfg_get_string("ibase.default_password", &IBASE_GLOBAL(php3_ibase_module).default_password) == FAILURE if (cfg_get_string("ibase.default_password", &IBASE_GLOBAL(php_ibase_module).default_password) == FAILURE
|| IBASE_GLOBAL(php3_ibase_module).default_password[0] == 0) { || IBASE_GLOBAL(php_ibase_module).default_password[0] == 0) {
IBASE_GLOBAL(php3_ibase_module).default_password = ""; IBASE_GLOBAL(php_ibase_module).default_password = "";
} }
if (cfg_get_string("ibase.timeformat", &IBASE_GLOBAL(php3_ibase_module).timeformat) == FAILURE) { if (cfg_get_string("ibase.timeformat", &IBASE_GLOBAL(php_ibase_module).timeformat) == FAILURE) {
IBASE_GLOBAL(php3_ibase_module).timeformat = "%Y-%m-%d %H:%M:%S"; IBASE_GLOBAL(php_ibase_module).timeformat = "%Y-%m-%d %H:%M:%S";
} }
IBASE_GLOBAL(php3_ibase_module).num_persistent=0; IBASE_GLOBAL(php_ibase_module).num_persistent=0;
IBASE_GLOBAL(php3_ibase_module).le_result = register_list_destructors(_php3_ibase_free_result, NULL); IBASE_GLOBAL(php_ibase_module).le_result = register_list_destructors(php_ibase_free_result, NULL);
IBASE_GLOBAL(php3_ibase_module).le_query = register_list_destructors(_php3_ibase_free_query, NULL); IBASE_GLOBAL(php_ibase_module).le_query = register_list_destructors(php_ibase_free_query, NULL);
IBASE_GLOBAL(php3_ibase_module).le_link = register_list_destructors(_php3_ibase_close_link, NULL); IBASE_GLOBAL(php_ibase_module).le_link = register_list_destructors(php_ibase_close_link, NULL);
IBASE_GLOBAL(php3_ibase_module).le_plink = register_list_destructors(NULL, _php3_ibase_close_plink); IBASE_GLOBAL(php_ibase_module).le_plink = register_list_destructors(NULL, php_ibase_close_plink);
return SUCCESS; return SUCCESS;
} }
@ -186,18 +186,18 @@ PHP_RINIT_FUNCTION(ibase)
{ {
IBASE_TLS_VARS; IBASE_TLS_VARS;
IBASE_GLOBAL(php3_ibase_module).default_link=-1; IBASE_GLOBAL(php_ibase_module).default_link=-1;
IBASE_GLOBAL(php3_ibase_module).num_links = php3_ibase_module.num_persistent; IBASE_GLOBAL(php_ibase_module).num_links = php_ibase_module.num_persistent;
return SUCCESS; return SUCCESS;
} }
/* TODO IF NEEDED /* TODO IF NEEDED
int php3_mfinish_ibase(void) int php_mfinish_ibase(void)
{ {
} }
int php3_rfinish_ibase(void) int php_rfinish_ibase(void)
{ {
} }
*/ */
@ -248,8 +248,8 @@ static int _php_ibase_attach_db(char *server, char *uname, int uname_len, char *
} }
/* }}} */ /* }}} */
/* {{{ _php3_ibase_connect() */ /* {{{ php_ibase_connect() */
static void _php3_ibase_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent) static void php_ibase_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
{ {
pval *server, *uname, *passwd; pval *server, *uname, *passwd;
@ -260,8 +260,8 @@ static void _php3_ibase_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
int hashed_details_length; int hashed_details_length;
IBASE_TLS_VARS; IBASE_TLS_VARS;
ib_uname = IBASE_GLOBAL(php3_ibase_module).default_user; ib_uname = IBASE_GLOBAL(php_ibase_module).default_user;
ib_passwd = IBASE_GLOBAL(php3_ibase_module).default_password; ib_passwd = IBASE_GLOBAL(php_ibase_module).default_password;
ib_uname_len = ib_uname ? strlen(ib_uname) : 0; ib_uname_len = ib_uname ? strlen(ib_uname) : 0;
ib_passwd_len = ib_passwd ? strlen(ib_passwd) : 0; ib_passwd_len = ib_passwd ? strlen(ib_passwd) : 0;
@ -325,13 +325,13 @@ static void _php3_ibase_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
if (zend_hash_find(plist, hashed_details, hashed_details_length+1, (void **) &le)==FAILURE) { if (zend_hash_find(plist, hashed_details, hashed_details_length+1, (void **) &le)==FAILURE) {
list_entry new_le; list_entry new_le;
if (IBASE_GLOBAL(php3_ibase_module).max_links!=-1 && IBASE_GLOBAL(php3_ibase_module).num_links>=IBASE_GLOBAL(php3_ibase_module).max_links) { if (IBASE_GLOBAL(php_ibase_module).max_links!=-1 && IBASE_GLOBAL(php_ibase_module).num_links>=IBASE_GLOBAL(php_ibase_module).max_links) {
php_error(E_WARNING,"InterBase: Too many open links (%d)", IBASE_GLOBAL(php3_ibase_module).num_links); php_error(E_WARNING,"InterBase: Too many open links (%d)", IBASE_GLOBAL(php_ibase_module).num_links);
efree(hashed_details); efree(hashed_details);
RETURN_FALSE; RETURN_FALSE;
} }
if (IBASE_GLOBAL(php3_ibase_module).max_persistent!=-1 && IBASE_GLOBAL(php3_ibase_module).num_persistent>=IBASE_GLOBAL(php3_ibase_module).max_persistent) { if (IBASE_GLOBAL(php_ibase_module).max_persistent!=-1 && IBASE_GLOBAL(php_ibase_module).num_persistent>=IBASE_GLOBAL(php_ibase_module).max_persistent) {
php_error(E_WARNING,"InterBase: Too many open persistent links (%d)", IBASE_GLOBAL(php3_ibase_module).num_persistent); php_error(E_WARNING,"InterBase: Too many open persistent links (%d)", IBASE_GLOBAL(php_ibase_module).num_persistent);
efree(hashed_details); efree(hashed_details);
RETURN_FALSE; RETURN_FALSE;
} }
@ -344,23 +344,23 @@ static void _php3_ibase_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
} }
/* hash it up */ /* hash it up */
new_le.type = php3_ibase_module.le_plink; new_le.type = php_ibase_module.le_plink;
new_le.ptr = db_handle; new_le.ptr = db_handle;
if (zend_hash_update(plist, hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) { if (zend_hash_update(plist, hashed_details, hashed_details_length+1, (void *) &new_le, sizeof(list_entry), NULL)==FAILURE) {
efree(hashed_details); efree(hashed_details);
RETURN_FALSE; RETURN_FALSE;
} }
IBASE_GLOBAL(php3_ibase_module).num_links++; IBASE_GLOBAL(php_ibase_module).num_links++;
IBASE_GLOBAL(php3_ibase_module).num_persistent++; IBASE_GLOBAL(php_ibase_module).num_persistent++;
} else { } else {
if (le->type != IBASE_GLOBAL(php3_ibase_module).le_plink) { if (le->type != IBASE_GLOBAL(php_ibase_module).le_plink) {
RETURN_FALSE; RETURN_FALSE;
} }
/* TODO: ensure that the link did not die */ /* TODO: ensure that the link did not die */
db_handle = (isc_db_handle) le->ptr; db_handle = (isc_db_handle) le->ptr;
} }
return_value->value.lval = zend_list_insert(db_handle, IBASE_GLOBAL(php3_ibase_module).le_plink); return_value->value.lval = zend_list_insert(db_handle, IBASE_GLOBAL(php_ibase_module).le_plink);
return_value->type = IS_LONG; return_value->type = IS_LONG;
} else { } else {
list_entry *index_ptr, new_index_ptr; list_entry *index_ptr, new_index_ptr;
@ -379,8 +379,8 @@ static void _php3_ibase_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
} }
link = (int) index_ptr->ptr; link = (int) index_ptr->ptr;
ptr = zend_list_find(link,&type); /* check if the link is still there */ ptr = zend_list_find(link,&type); /* check if the link is still there */
if (ptr && (type==IBASE_GLOBAL(php3_ibase_module).le_link || type==IBASE_GLOBAL(php3_ibase_module).le_plink)) { if (ptr && (type==IBASE_GLOBAL(php_ibase_module).le_link || type==IBASE_GLOBAL(php_ibase_module).le_plink)) {
return_value->value.lval = IBASE_GLOBAL(php3_ibase_module).default_link = link; return_value->value.lval = IBASE_GLOBAL(php_ibase_module).default_link = link;
return_value->type = IS_LONG; return_value->type = IS_LONG;
efree(hashed_details); efree(hashed_details);
return; return;
@ -388,8 +388,8 @@ static void _php3_ibase_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
zend_hash_del(list,hashed_details,hashed_details_length+1); zend_hash_del(list,hashed_details,hashed_details_length+1);
} }
} }
if (IBASE_GLOBAL(php3_ibase_module).max_links!=-1 && IBASE_GLOBAL(php3_ibase_module).num_links>=IBASE_GLOBAL(php3_ibase_module).max_links) { if (IBASE_GLOBAL(php_ibase_module).max_links!=-1 && IBASE_GLOBAL(php_ibase_module).num_links>=IBASE_GLOBAL(php_ibase_module).max_links) {
php_error(E_WARNING,"InterBase: Too many open links (%d)", IBASE_GLOBAL(php3_ibase_module).num_links); php_error(E_WARNING,"InterBase: Too many open links (%d)", IBASE_GLOBAL(php_ibase_module).num_links);
efree(hashed_details); efree(hashed_details);
RETURN_FALSE; RETURN_FALSE;
} }
@ -401,7 +401,7 @@ static void _php3_ibase_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
} }
/* add it to the list */ /* add it to the list */
return_value->value.lval = zend_list_insert(db_handle, IBASE_GLOBAL(php3_ibase_module).le_link); return_value->value.lval = zend_list_insert(db_handle, IBASE_GLOBAL(php_ibase_module).le_link);
return_value->type = IS_LONG; return_value->type = IS_LONG;
/* add it to the hash */ /* add it to the hash */
@ -411,10 +411,10 @@ static void _php3_ibase_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
efree(hashed_details); efree(hashed_details);
RETURN_FALSE; RETURN_FALSE;
} }
IBASE_GLOBAL(php3_ibase_module).num_links++; IBASE_GLOBAL(php_ibase_module).num_links++;
} }
efree(hashed_details); efree(hashed_details);
IBASE_GLOBAL(php3_ibase_module).default_link=return_value->value.lval; IBASE_GLOBAL(php_ibase_module).default_link=return_value->value.lval;
} }
/* }}} */ /* }}} */
@ -422,7 +422,7 @@ static void _php3_ibase_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
Open a connection to an InterBase database */ Open a connection to an InterBase database */
PHP_FUNCTION(ibase_connect) PHP_FUNCTION(ibase_connect)
{ {
_php3_ibase_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0); php_ibase_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
} }
/* }}} */ /* }}} */
@ -430,7 +430,7 @@ PHP_FUNCTION(ibase_connect)
Open a persistent connection to an InterBase database */ Open a persistent connection to an InterBase database */
PHP_FUNCTION(ibase_pconnect) PHP_FUNCTION(ibase_pconnect)
{ {
_php3_ibase_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); php_ibase_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
} }
/* }}} */ /* }}} */
@ -445,7 +445,7 @@ PHP_FUNCTION(ibase_close)
switch (ARG_COUNT(ht)) { switch (ARG_COUNT(ht)) {
case 0: case 0:
id = IBASE_GLOBAL(php3_ibase_module).default_link; id = IBASE_GLOBAL(php_ibase_module).default_link;
break; break;
case 1: case 1:
if (getParameters(ht, 1, &ibase_link) == FAILURE) { if (getParameters(ht, 1, &ibase_link) == FAILURE) {
@ -460,7 +460,7 @@ PHP_FUNCTION(ibase_close)
} }
db_handle = (isc_db_handle) zend_list_find(id, &type); db_handle = (isc_db_handle) zend_list_find(id, &type);
if (type!=IBASE_GLOBAL(php3_ibase_module).le_link && type!=IBASE_GLOBAL(php3_ibase_module).le_plink) { if (type!=IBASE_GLOBAL(php_ibase_module).le_link && type!=IBASE_GLOBAL(php_ibase_module).le_plink) {
php_error(E_WARNING, "%d is not an InterBase link index",id); php_error(E_WARNING, "%d is not an InterBase link index",id);
RETURN_FALSE; RETURN_FALSE;
} }
@ -470,8 +470,8 @@ PHP_FUNCTION(ibase_close)
} }
/* }}} */ /* }}} */
/* {{{ _php3_ibase_prepare() */ /* {{{ php_ibase_prepare() */
static XSQLDA *_php3_ibase_prepare(isc_db_handle db, isc_tr_handle tr, isc_stmt_handle *query_handle, char *query) static XSQLDA *php_ibase_prepare(isc_db_handle db, isc_tr_handle tr, isc_stmt_handle *query_handle, char *query)
{ {
ISC_STATUS status[20]; ISC_STATUS status[20];
XSQLDA *isqlda; XSQLDA *isqlda;
@ -517,8 +517,8 @@ static XSQLDA *_php3_ibase_prepare(isc_db_handle db, isc_tr_handle tr, isc_stmt_
} }
/* }}} */ /* }}} */
/* {{{ _php3_ibase_execute() */ /* {{{ php_ibase_execute() */
static XSQLDA *_php3_ibase_execute(isc_tr_handle tr_handle, isc_stmt_handle query_handle, XSQLDA *isqlda, ISC_STATUS *status) static XSQLDA *php_ibase_execute(isc_tr_handle tr_handle, isc_stmt_handle query_handle, XSQLDA *isqlda, ISC_STATUS *status)
{ {
int i, coltype; int i, coltype;
static char query_info[] = { isc_info_sql_stmt_type }; static char query_info[] = { isc_info_sql_stmt_type };
@ -614,7 +614,7 @@ static XSQLDA *_php3_ibase_execute(isc_tr_handle tr_handle, isc_stmt_handle quer
php_error(E_WARNING, "InterBase: couldn't execute query"); php_error(E_WARNING, "InterBase: couldn't execute query");
} }
/* /*
if (!php3_ibase_module.manualtransactions) { if (!php_ibase_module.manualtransactions) {
if(0) { if(0) {
isc_commit_transaction(status, tr_handle); isc_commit_transaction(status, tr_handle);
} else { } else {
@ -647,7 +647,7 @@ PHP_FUNCTION(ibase_query)
if (getParameters(ht, 1, &query) == FAILURE) { if (getParameters(ht, 1, &query) == FAILURE) {
RETURN_FALSE; RETURN_FALSE;
} }
id = IBASE_GLOBAL(php3_ibase_module).default_link; id = IBASE_GLOBAL(php_ibase_module).default_link;
break; break;
case 2: case 2:
if (getParameters(ht, 2, &ibase_link, &query) == FAILURE) { if (getParameters(ht, 2, &ibase_link, &query) == FAILURE) {
@ -662,21 +662,21 @@ PHP_FUNCTION(ibase_query)
} }
db_handle = (isc_db_handle) zend_list_find(id, &type); db_handle = (isc_db_handle) zend_list_find(id, &type);
if (type!=IBASE_GLOBAL(php3_ibase_module).le_link && type!=IBASE_GLOBAL(php3_ibase_module).le_plink) { if (type!=IBASE_GLOBAL(php_ibase_module).le_link && type!=IBASE_GLOBAL(php_ibase_module).le_plink) {
php_error(E_WARNING, "%d is not an InterBase link index", id); php_error(E_WARNING, "%d is not an InterBase link index", id);
RETURN_FALSE; RETURN_FALSE;
} }
convert_to_string(query); convert_to_string(query);
if (!IBASE_GLOBAL(php3_ibase_module).manualtransactions) { if (!IBASE_GLOBAL(php_ibase_module).manualtransactions) {
if (isc_start_transaction(status, &tr_handle, 1, &db_handle, 0, NULL)) { if (isc_start_transaction(status, &tr_handle, 1, &db_handle, 0, NULL)) {
php_error(E_WARNING, "InterBase: couldn't start transaction"); php_error(E_WARNING, "InterBase: couldn't start transaction");
RETURN_FALSE; RETURN_FALSE;
} }
} }
isqlda = _php3_ibase_prepare(db_handle, tr_handle, &query_handle, query->value.str.val); isqlda = php_ibase_prepare(db_handle, tr_handle, &query_handle, query->value.str.val);
if (isqlda != NULL) { if (isqlda != NULL) {
isc_rollback_transaction(status, &tr_handle); isc_rollback_transaction(status, &tr_handle);
isc_dsql_free_statement(status, &query_handle, DSQL_drop); isc_dsql_free_statement(status, &query_handle, DSQL_drop);
@ -684,24 +684,24 @@ PHP_FUNCTION(ibase_query)
RETURN_FALSE; RETURN_FALSE;
} }
osqlda = _php3_ibase_execute(tr_handle, query_handle, isqlda, status); osqlda = php_ibase_execute(tr_handle, query_handle, isqlda, status);
if (osqlda != NULL) { if (osqlda != NULL) {
ibase_result = (ibase_result_handle *) emalloc(sizeof(ibase_result_handle)); ibase_result = (ibase_result_handle *) emalloc(sizeof(ibase_result_handle));
ibase_result->result = query_handle; ibase_result->result = query_handle;
ibase_result->sqlda = osqlda; ibase_result->sqlda = osqlda;
ibase_result->trans = tr_handle; ibase_result->trans = tr_handle;
ibase_result->commitok = 1; ibase_result->commitok = 1;
return_value->value.lval = zend_list_insert(ibase_result, php3_ibase_module.le_result); return_value->value.lval = zend_list_insert(ibase_result, php_ibase_module.le_result);
return_value->type = IS_LONG; return_value->type = IS_LONG;
} else { } else {
if (status[0] == 1 && status[1]) { if (status[0] == 1 && status[1]) {
if (!IBASE_GLOBAL(php3_ibase_module).manualtransactions) { if (!IBASE_GLOBAL(php_ibase_module).manualtransactions) {
isc_rollback_transaction(status, &tr_handle); isc_rollback_transaction(status, &tr_handle);
isc_dsql_free_statement(status, &query_handle, DSQL_drop); isc_dsql_free_statement(status, &query_handle, DSQL_drop);
RETURN_FALSE; RETURN_FALSE;
} }
} else { } else {
if (!IBASE_GLOBAL(php3_ibase_module).manualtransactions) { if (!IBASE_GLOBAL(php_ibase_module).manualtransactions) {
isc_commit_transaction(status, &tr_handle); isc_commit_transaction(status, &tr_handle);
isc_dsql_free_statement(status, &query_handle, DSQL_drop); isc_dsql_free_statement(status, &query_handle, DSQL_drop);
RETURN_FALSE; RETURN_FALSE;
@ -739,7 +739,7 @@ PHP_FUNCTION(ibase_fetch_row)
convert_to_long(result); convert_to_long(result);
ibase_result = (ibase_result_handle *) zend_list_find(result->value.lval, &type); ibase_result = (ibase_result_handle *) zend_list_find(result->value.lval, &type);
if (type!=IBASE_GLOBAL(php3_ibase_module).le_result) { if (type!=IBASE_GLOBAL(php_ibase_module).le_result) {
php_error(E_WARNING,"%d is not an InterBase result index", result->value.lval); php_error(E_WARNING,"%d is not an InterBase result index", result->value.lval);
RETURN_FALSE; RETURN_FALSE;
} }
@ -841,7 +841,7 @@ PHP_FUNCTION(ibase_fetch_row)
isc_decode_date((ISC_QUAD *) var[i].sqldata, t); isc_decode_date((ISC_QUAD *) var[i].sqldata, t);
/* /*
#if HAVE_STRFTIME #if HAVE_STRFTIME
collen = (int) strftime(string_data, 255, IBASE_GLOBAL(php3_ibase_module).timeformat, t); collen = (int) strftime(string_data, 255, IBASE_GLOBAL(php_ibase_module).timeformat, t);
#else #else
*/ */
collen = sprintf(string_data, "%4d-%02d-%02d %02d:%02d:%02d", t->tm_year+1900, t->tm_mon+1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); collen = sprintf(string_data, "%4d-%02d-%02d %02d:%02d:%02d", t->tm_year+1900, t->tm_mon+1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
@ -892,7 +892,7 @@ PHP_FUNCTION(ibase_free_result)
ibase_result = (ibase_result_handle *) zend_list_find(result->value.lval,&type); ibase_result = (ibase_result_handle *) zend_list_find(result->value.lval,&type);
if (type!=IBASE_GLOBAL(php3_ibase_module).le_result) { if (type!=IBASE_GLOBAL(php_ibase_module).le_result) {
php_error(E_WARNING,"%d is not an InterBase result index",result->value.lval); php_error(E_WARNING,"%d is not an InterBase result index",result->value.lval);
RETURN_FALSE; RETURN_FALSE;
} }
@ -920,7 +920,7 @@ PHP_FUNCTION(ibase_prepare)
if (getParameters(ht, 1, &query) == FAILURE) { if (getParameters(ht, 1, &query) == FAILURE) {
RETURN_FALSE; RETURN_FALSE;
} }
id = IBASE_GLOBAL(php3_ibase_module).default_link; id = IBASE_GLOBAL(php_ibase_module).default_link;
break; break;
case 2: case 2:
if (getParameters(ht, 2, &ibase_link, &query) == FAILURE) { if (getParameters(ht, 2, &ibase_link, &query) == FAILURE) {
@ -935,27 +935,27 @@ PHP_FUNCTION(ibase_prepare)
} }
db_handle = (isc_db_handle) zend_list_find(id, &type); db_handle = (isc_db_handle) zend_list_find(id, &type);
if (type!=IBASE_GLOBAL(php3_ibase_module).le_link && type!=IBASE_GLOBAL(php3_ibase_module).le_plink) { if (type!=IBASE_GLOBAL(php_ibase_module).le_link && type!=IBASE_GLOBAL(php_ibase_module).le_plink) {
php_error(E_WARNING, "%d is not an InterBase link index", id); php_error(E_WARNING, "%d is not an InterBase link index", id);
RETURN_FALSE; RETURN_FALSE;
} }
convert_to_string(query); convert_to_string(query);
if (!IBASE_GLOBAL(php3_ibase_module).manualtransactions) { if (!IBASE_GLOBAL(php_ibase_module).manualtransactions) {
if (isc_start_transaction(status, &tr_handle, 1, &db_handle, 0, NULL)) { if (isc_start_transaction(status, &tr_handle, 1, &db_handle, 0, NULL)) {
php_error(E_WARNING, "InterBase: couldn't start transaction"); php_error(E_WARNING, "InterBase: couldn't start transaction");
RETURN_FALSE; RETURN_FALSE;
} }
} }
isqlda = _php3_ibase_prepare(db_handle, tr_handle, &query_handle, query->value.str.val); isqlda = php_ibase_prepare(db_handle, tr_handle, &query_handle, query->value.str.val);
ibase_query = (ibase_query_handle *) emalloc(sizeof(ibase_query_handle)); ibase_query = (ibase_query_handle *) emalloc(sizeof(ibase_query_handle));
ibase_query->query = query_handle; ibase_query->query = query_handle;
ibase_query->sqlda = isqlda; ibase_query->sqlda = isqlda;
ibase_query->trans = tr_handle; ibase_query->trans = tr_handle;
ibase_query->alloced = 0; ibase_query->alloced = 0;
return_value->value.lval = zend_list_insert(ibase_query, php3_ibase_module.le_query); return_value->value.lval = zend_list_insert(ibase_query, php_ibase_module.le_query);
return_value->type = IS_LONG; return_value->type = IS_LONG;
} }
/* }}} */ /* }}} */
@ -980,7 +980,7 @@ PHP_FUNCTION(ibase_bind)
ibase_query = (ibase_query_handle *) zend_list_find(query->value.lval,&type); ibase_query = (ibase_query_handle *) zend_list_find(query->value.lval,&type);
if (type!=IBASE_GLOBAL(php3_ibase_module).le_query) { if (type!=IBASE_GLOBAL(php_ibase_module).le_query) {
php_error(E_WARNING,"%d is not an InterBase query index",query->value.lval); php_error(E_WARNING,"%d is not an InterBase query index",query->value.lval);
RETURN_FALSE; RETURN_FALSE;
} }
@ -1043,16 +1043,16 @@ PHP_FUNCTION(ibase_execute)
ibase_query = (ibase_query_handle *) zend_list_find(query->value.lval,&type); ibase_query = (ibase_query_handle *) zend_list_find(query->value.lval,&type);
if (type!=IBASE_GLOBAL(php3_ibase_module).le_query) { if (type!=IBASE_GLOBAL(php_ibase_module).le_query) {
php_error(E_WARNING,"%d is not an InterBase query index", query->value.lval); php_error(E_WARNING,"%d is not an InterBase query index", query->value.lval);
RETURN_FALSE; RETURN_FALSE;
} }
osqlda = _php3_ibase_execute(ibase_query->trans, ibase_query->query, ibase_query->sqlda, status); osqlda = php_ibase_execute(ibase_query->trans, ibase_query->query, ibase_query->sqlda, status);
ibase_result = (ibase_result_handle *) emalloc(sizeof(ibase_result_handle)); ibase_result = (ibase_result_handle *) emalloc(sizeof(ibase_result_handle));
ibase_result->result = ibase_query->query; ibase_result->result = ibase_query->query;
ibase_result->sqlda = osqlda; ibase_result->sqlda = osqlda;
return_value->value.lval = zend_list_insert(ibase_result, IBASE_GLOBAL(php3_ibase_module).le_result); return_value->value.lval = zend_list_insert(ibase_result, IBASE_GLOBAL(php_ibase_module).le_result);
return_value->type = IS_LONG; return_value->type = IS_LONG;
} }
/* }}} */ /* }}} */
@ -1077,7 +1077,7 @@ PHP_FUNCTION(ibase_free_query)
ibase_query = (ibase_query_handle *) zend_list_find(query->value.lval, &type); ibase_query = (ibase_query_handle *) zend_list_find(query->value.lval, &type);
if (type!=IBASE_GLOBAL(php3_ibase_module).le_query) { if (type!=IBASE_GLOBAL(php_ibase_module).le_query) {
php_error(E_WARNING,"%d is not an InterBase query index", query->value.lval); php_error(E_WARNING,"%d is not an InterBase query index", query->value.lval);
RETURN_FALSE; RETURN_FALSE;
} }

View file

@ -42,7 +42,7 @@
#include <ibase.h> #include <ibase.h>
extern zend_module_entry ibase_module_entry; extern zend_module_entry ibase_module_entry;
#define php3_ibase_module_ptr &ibase_module_entry #define php_ibase_module_ptr &ibase_module_entry
extern PHP_MINIT_FUNCTION(ibase); extern PHP_MINIT_FUNCTION(ibase);
extern PHP_RINIT_FUNCTION(ibase); extern PHP_RINIT_FUNCTION(ibase);
@ -72,34 +72,34 @@ typedef struct {
char *timeformat; char *timeformat;
} ibase_module; } ibase_module;
typedef struct _php3_ibase_result { typedef struct _php_ibase_result {
isc_stmt_handle result; isc_stmt_handle result;
isc_tr_handle trans; isc_tr_handle trans;
XSQLDA *sqlda; XSQLDA *sqlda;
int commitok; int commitok;
} ibase_result_handle; } ibase_result_handle;
typedef struct _php3_ibase_query { typedef struct _php_ibase_query {
isc_stmt_handle query; isc_stmt_handle query;
isc_tr_handle trans; isc_tr_handle trans;
XSQLDA *sqlda; XSQLDA *sqlda;
int alloced; int alloced;
} ibase_query_handle; } ibase_query_handle;
typedef struct _php3_ibase_varchar { typedef struct _php_ibase_varchar {
short var_len; short var_len;
char var_str[1]; char var_str[1];
} IBASE_VCHAR; } IBASE_VCHAR;
extern ibase_module php3_ibase_module; extern ibase_module php_ibase_module;
#else #else
#define php3_ibase_module_ptr NULL #define php_ibase_module_ptr NULL
#endif /* HAVE_IBASE */ #endif /* HAVE_IBASE */
#define phpext_interbase_ptr php3_ibase_module_ptr #define phpext_interbase_ptr php_ibase_module_ptr
#endif /* _PHP3_IBASE_H */ #endif /* _PHP3_IBASE_H */

View file

@ -405,7 +405,7 @@ PHP_RINIT_FUNCTION(oci)
OCI(debug_mode) = 0; /* start "fresh" */ OCI(debug_mode) = 0; /* start "fresh" */
oci_debug("php3_rinit_oci8"); oci_debug("php_rinit_oci8");
return SUCCESS; return SUCCESS;
} }
@ -428,7 +428,7 @@ PHP_MSHUTDOWN_FUNCTION(oci)
{ {
OCILS_FETCH(); OCILS_FETCH();
oci_debug("php3_mshutdown_oci8"); oci_debug("php_mshutdown_oci8");
zend_hash_apply(OCI(user),(int (*)(void *))_user_pcleanup); zend_hash_apply(OCI(user),(int (*)(void *))_user_pcleanup);
zend_hash_apply(OCI(server),(int (*)(void *))_server_pcleanup); zend_hash_apply(OCI(server),(int (*)(void *))_server_pcleanup);
@ -483,7 +483,7 @@ PHP_RSHUTDOWN_FUNCTION(oci)
{ {
OCILS_FETCH(); OCILS_FETCH();
oci_debug("php3_rshutdown_oci8"); oci_debug("php_rshutdown_oci8");
zend_hash_apply(OCI(user),(int (*)(void *))_user_cleanup); zend_hash_apply(OCI(user),(int (*)(void *))_user_cleanup);
zend_hash_apply(OCI(server),(int (*)(void *))_server_cleanup); zend_hash_apply(OCI(server),(int (*)(void *))_server_cleanup);

View file

@ -477,7 +477,7 @@ void ODBC_SQL_ERROR(HENV henv, HDBC conn, HSTMT stmt, char *func)
} while ( SQL_SUCCEEDED( ret )); } while ( SQL_SUCCEEDED( ret ));
} }
void php3_odbc_fetch_attribs(INTERNAL_FUNCTION_PARAMETERS, int mode) void php_odgbc_fetch_attribs(INTERNAL_FUNCTION_PARAMETERS, int mode)
{ {
odbc_result *result; odbc_result *result;
pval **pv_res, **pv_flag; pval **pv_res, **pv_flag;
@ -608,7 +608,7 @@ PHP_FUNCTION(odbc_close_all)
Handle binary column data */ Handle binary column data */
PHP_FUNCTION(odbc_binmode) PHP_FUNCTION(odbc_binmode)
{ {
php3_odbc_fetch_attribs(INTERNAL_FUNCTION_PARAM_PASSTHRU,0); php_odgbc_fetch_attribs(INTERNAL_FUNCTION_PARAM_PASSTHRU,0);
} }
/* }}} */ /* }}} */
@ -616,7 +616,7 @@ PHP_FUNCTION(odbc_binmode)
Handle LONG columns */ Handle LONG columns */
PHP_FUNCTION(odbc_longreadlen) PHP_FUNCTION(odbc_longreadlen)
{ {
php3_odbc_fetch_attribs(INTERNAL_FUNCTION_PARAM_PASSTHRU,1); php_odgbc_fetch_attribs(INTERNAL_FUNCTION_PARAM_PASSTHRU,1);
} }
/* }}} */ /* }}} */
@ -650,7 +650,7 @@ PHP_FUNCTION(odbc_prepare)
rc = SQLAllocStmt(conn->hdbc, &(result->stmt)); rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) { if (rc == SQL_INVALID_HANDLE) {
efree(result); efree(result);
php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in php3_odbc_prepare"); php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in odbc_prepare");
RETURN_FALSE; RETURN_FALSE;
} }
@ -889,7 +889,7 @@ PHP_FUNCTION(odbc_cursor)
result->stmt, state, &error, errormsg, result->stmt, state, &error, errormsg,
sizeof(errormsg)-1, &errormsgsize); sizeof(errormsg)-1, &errormsgsize);
if (!strncmp(state,"S1015",5)) { if (!strncmp(state,"S1015",5)) {
sprintf(cursorname,"php3_curs_%d", (int)result->stmt); sprintf(cursorname,"php_curs_%d", (int)result->stmt);
if (SQLSetCursorName(result->stmt,cursorname,SQL_NTS) != SQL_SUCCESS) { if (SQLSetCursorName(result->stmt,cursorname,SQL_NTS) != SQL_SUCCESS) {
ODBC_SQL_ERROR(result->conn_ptr->henv, result->conn_ptr->hdbc, ODBC_SQL_ERROR(result->conn_ptr->henv, result->conn_ptr->hdbc,
result->stmt, "SQLSetCursorName"); result->stmt, "SQLSetCursorName");
@ -2202,7 +2202,7 @@ PHP_FUNCTION(odbc_tables)
rc = SQLAllocStmt(conn->hdbc, &(result->stmt)); rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) { if (rc == SQL_INVALID_HANDLE) {
efree(result); efree(result);
php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in php3_odbc_tables"); php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in odbc_tables");
RETURN_FALSE; RETURN_FALSE;
} }
@ -2284,7 +2284,7 @@ PHP_FUNCTION(odbc_columns)
rc = SQLAllocStmt(conn->hdbc, &(result->stmt)); rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) { if (rc == SQL_INVALID_HANDLE) {
efree(result); efree(result);
php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in php3_odbc_columns"); php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in odbc_columns");
RETURN_FALSE; RETURN_FALSE;
} }
@ -2363,7 +2363,7 @@ PHP_FUNCTION(odbc_columnprivileges)
rc = SQLAllocStmt(conn->hdbc, &(result->stmt)); rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) { if (rc == SQL_INVALID_HANDLE) {
efree(result); efree(result);
php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in php3_odbc_columnprivileges"); php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in odbc_columnprivileges");
RETURN_FALSE; RETURN_FALSE;
} }
@ -2461,7 +2461,7 @@ PHP_FUNCTION(odbc_foreignkeys)
rc = SQLAllocStmt(conn->hdbc, &(result->stmt)); rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) { if (rc == SQL_INVALID_HANDLE) {
efree(result); efree(result);
php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in php3_odbc_foreignkeys"); php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in odbc_foreignkeys");
RETURN_FALSE; RETURN_FALSE;
} }
@ -2540,7 +2540,7 @@ PHP_FUNCTION(odbc_gettypeinfo)
rc = SQLAllocStmt(conn->hdbc, &(result->stmt)); rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) { if (rc == SQL_INVALID_HANDLE) {
efree(result); efree(result);
php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in php3_odbc_gettypeinfo"); php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in odbc_gettypeinfo");
RETURN_FALSE; RETURN_FALSE;
} }
@ -2612,7 +2612,7 @@ PHP_FUNCTION(odbc_primarykeys)
rc = SQLAllocStmt(conn->hdbc, &(result->stmt)); rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) { if (rc == SQL_INVALID_HANDLE) {
efree(result); efree(result);
php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in php3_odbc_primarykeys"); php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in odbc_primarykeys");
RETURN_FALSE; RETURN_FALSE;
} }
@ -2694,7 +2694,7 @@ PHP_FUNCTION(odbc_procedurecolumns)
rc = SQLAllocStmt(conn->hdbc, &(result->stmt)); rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) { if (rc == SQL_INVALID_HANDLE) {
efree(result); efree(result);
php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in php3_odbc_procedurecolumns"); php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in odbc_procedurecolumns");
RETURN_FALSE; RETURN_FALSE;
} }
@ -2776,7 +2776,7 @@ PHP_FUNCTION(odbc_procedures)
rc = SQLAllocStmt(conn->hdbc, &(result->stmt)); rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) { if (rc == SQL_INVALID_HANDLE) {
efree(result); efree(result);
php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in php3_odbc_procedures"); php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in odbc_procedures");
RETURN_FALSE; RETURN_FALSE;
} }
@ -2862,7 +2862,7 @@ PHP_FUNCTION(odbc_specialcolumns)
rc = SQLAllocStmt(conn->hdbc, &(result->stmt)); rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) { if (rc == SQL_INVALID_HANDLE) {
efree(result); efree(result);
php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in php3_odbc_specialcolumns"); php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in odbc_specialcolumns");
RETURN_FALSE; RETURN_FALSE;
} }
@ -2947,7 +2947,7 @@ PHP_FUNCTION(odbc_statistics)
rc = SQLAllocStmt(conn->hdbc, &(result->stmt)); rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) { if (rc == SQL_INVALID_HANDLE) {
efree(result); efree(result);
php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in php3_odbc_statistics"); php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in odbc_statistics");
RETURN_FALSE; RETURN_FALSE;
} }
@ -3025,7 +3025,7 @@ PHP_FUNCTION(odbc_tableprivileges)
rc = SQLAllocStmt(conn->hdbc, &(result->stmt)); rc = SQLAllocStmt(conn->hdbc, &(result->stmt));
if (rc == SQL_INVALID_HANDLE) { if (rc == SQL_INVALID_HANDLE) {
efree(result); efree(result);
php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in php3_odbc_tableprivileges"); php_error(E_WARNING, "SQLAllocStmt error 'Invalid Handle' in odbc_tableprivileges");
RETURN_FALSE; RETURN_FALSE;
} }

View file

@ -92,7 +92,7 @@ PHP_FUNCTION(velocis_rollback);
PHP_FUNCTION(velocis_fieldnum); PHP_FUNCTION(velocis_fieldnum);
PHP_FUNCTION(velocis_fieldname); PHP_FUNCTION(velocis_fieldname);
extern velocis_module php3_velocis_module; extern velocis_module php_velocis_module;
#else #else

View file

@ -69,7 +69,7 @@ zend_module_entry velocis_module_entry = {
zend_module_entry *get_module() { return &velocis_module_entry; } zend_module_entry *get_module() { return &velocis_module_entry; }
#endif #endif
THREAD_LS velocis_module php3_velocis_module; THREAD_LS velocis_module php_velocis_module;
THREAD_LS static HENV henv; THREAD_LS static HENV henv;
static void _close_velocis_link(VConn *conn) static void _close_velocis_link(VConn *conn)
@ -97,12 +97,12 @@ static void _free_velocis_result(Vresult *res)
PHP_MINIT_FUNCTION(velocis) PHP_MINIT_FUNCTION(velocis)
{ {
SQLAllocEnv(&henv); SQLAllocEnv(&henv);
if ( cfg_get_long("velocis.max_links",&php3_velocis_module.max_links) == FAILURE ) { if ( cfg_get_long("velocis.max_links",&php_velocis_module.max_links) == FAILURE ) {
php3_velocis_module.max_links = -1; php_velocis_module.max_links = -1;
} }
php3_velocis_module.num_links = 0; php_velocis_module.num_links = 0;
php3_velocis_module.le_link = register_list_destructors(_close_velocis_link,NULL); php_velocis_module.le_link = register_list_destructors(_close_velocis_link,NULL);
php3_velocis_module.le_result = register_list_destructors(_free_velocis_result,NULL); php_velocis_module.le_result = register_list_destructors(_free_velocis_result,NULL);
return SUCCESS; return SUCCESS;
} }
@ -131,7 +131,7 @@ velocis_add_conn(HashTable *list,VConn *conn,HDBC hdbc)
{ {
int ind; int ind;
ind = zend_list_insert(conn,php3_velocis_module.le_link); ind = zend_list_insert(conn,php_velocis_module.le_link);
conn->hdbc = hdbc; conn->hdbc = hdbc;
conn->index = ind; conn->index = ind;
@ -145,7 +145,7 @@ velocis_find_conn(HashTable *list,int ind)
int type; int type;
conn = zend_list_find(ind,&type); conn = zend_list_find(ind,&type);
if ( !conn || type != php3_velocis_module.le_link ) { if ( !conn || type != php_velocis_module.le_link ) {
return(NULL); return(NULL);
} }
return(conn); return(conn);
@ -162,7 +162,7 @@ velocis_add_result(HashTable *list,Vresult *res,VConn *conn)
{ {
int ind; int ind;
ind = zend_list_insert(res,php3_velocis_module.le_result); ind = zend_list_insert(res,php_velocis_module.le_result);
res->conn = conn; res->conn = conn;
res->index = ind; res->index = ind;
@ -176,7 +176,7 @@ velocis_find_result(HashTable *list,int ind)
int type; int type;
res = zend_list_find(ind,&type); res = zend_list_find(ind,&type);
if ( !res || type != php3_velocis_module.le_result ) { if ( !res || type != php_velocis_module.le_result ) {
return(NULL); return(NULL);
} }
return(res); return(res);
@ -201,8 +201,8 @@ PHP_FUNCTION(velocis_connect)
VConn *new; VConn *new;
long ind; long ind;
if ( php3_velocis_module.max_links != -1 && php3_velocis_module.num_links == php3_velocis_module.max_links ) { if ( php_velocis_module.max_links != -1 && php_velocis_module.num_links == php_velocis_module.max_links ) {
php_error(E_WARNING,"Velocis: Too many open connections (%d)",php3_velocis_module.num_links); php_error(E_WARNING,"Velocis: Too many open connections (%d)",php_velocis_module.num_links);
RETURN_FALSE; RETURN_FALSE;
} }
if ( ARG_COUNT(ht) != 3 || if ( ARG_COUNT(ht) != 3 ||
@ -233,7 +233,7 @@ PHP_FUNCTION(velocis_connect)
RETURN_FALSE; RETURN_FALSE;
} }
ind = velocis_add_conn(list,new,hdbc); ind = velocis_add_conn(list,new,hdbc);
php3_velocis_module.num_links++; php_velocis_module.num_links++;
RETURN_LONG(ind); RETURN_LONG(ind);
} }
@ -254,7 +254,7 @@ PHP_FUNCTION(velocis_close)
SQLDisconnect(conn->hdbc); SQLDisconnect(conn->hdbc);
SQLFreeConnect(conn->hdbc); SQLFreeConnect(conn->hdbc);
velocis_del_conn(list,id->value.lval); velocis_del_conn(list,id->value.lval);
php3_velocis_module.num_links--; php_velocis_module.num_links--;
RETURN_TRUE; RETURN_TRUE;
} }

View file

@ -113,7 +113,7 @@ void php_dl(pval *file,int type,pval *return_value)
error_type = E_CORE_ERROR; error_type = E_CORE_ERROR;
} }
#if MSVC5 #if MSVC5
php_error(error_type,"Unable to load dynamic library '%s'<br>\n%s",libpath,php3_win_err()); php_error(error_type,"Unable to load dynamic library '%s'<br>\n%s",libpath,php_win_err());
#else #else
php_error(error_type,"Unable to load dynamic library '%s' - %s",libpath,dlerror()); php_error(error_type,"Unable to load dynamic library '%s' - %s",libpath,dlerror());
#endif #endif

View file

@ -39,8 +39,8 @@ typedef struct {
int gzgetss_state; int gzgetss_state;
} php_zlib_globals; } php_zlib_globals;
extern zend_module_entry php3_zlib_module_entry; extern zend_module_entry php_zlib_module_entry;
#define zlib_module_ptr &php3_zlib_module_entry #define zlib_module_ptr &php_zlib_module_entry
extern PHP_MINIT_FUNCTION(zlib); extern PHP_MINIT_FUNCTION(zlib);
extern PHP_MSHUTDOWN_FUNCTION(zlib); extern PHP_MSHUTDOWN_FUNCTION(zlib);

View file

@ -79,7 +79,7 @@ static php_zlib_globals zlib_globals;
/* True globals, no need for thread safety */ /* True globals, no need for thread safety */
static int le_zp; static int le_zp;
function_entry php3_zlib_functions[] = { function_entry php_zlib_functions[] = {
PHP_FE(readgzfile, NULL) PHP_FE(readgzfile, NULL)
PHP_FE(gzrewind, NULL) PHP_FE(gzrewind, NULL)
PHP_FE(gzclose, NULL) PHP_FE(gzclose, NULL)
@ -98,9 +98,9 @@ function_entry php3_zlib_functions[] = {
{NULL, NULL, NULL} {NULL, NULL, NULL}
}; };
zend_module_entry php3_zlib_module_entry = { zend_module_entry php_zlib_module_entry = {
"zlib", "zlib",
php3_zlib_functions, php_zlib_functions,
PHP_MINIT(zlib), PHP_MINIT(zlib),
PHP_MSHUTDOWN(zlib), PHP_MSHUTDOWN(zlib),
NULL, NULL,
@ -149,14 +149,14 @@ PHP_MINFO_FUNCTION(zlib)
PUTS(")."); PUTS(").");
} }
static gzFile *php3_gzopen_with_path(char *filename, char *mode, char *path, char **opened_path); static gzFile *php_gzopen_with_path(char *filename, char *mode, char *path, char **opened_path);
static gzFile php3_gzopen_wrapper(char *path, char *mode, int options) static gzFile php_gzopen_wrapper(char *path, char *mode, int options)
{ {
PLS_FETCH(); PLS_FETCH();
if (options & USE_PATH && PG(include_path) != NULL) { if (options & USE_PATH && PG(include_path) != NULL) {
return php3_gzopen_with_path(path, mode, PG(include_path), NULL); return php_gzopen_with_path(path, mode, PG(include_path), NULL);
} }
else { else {
if (options & ENFORCE_SAFE_MODE && PG(safe_mode) && (!php_checkuid(path,1))) { if (options & ENFORCE_SAFE_MODE && PG(safe_mode) && (!php_checkuid(path,1))) {
@ -171,7 +171,7 @@ static gzFile php3_gzopen_wrapper(char *path, char *mode, int options)
* Tries to open a .gz-file with a PATH-style list of directories. * Tries to open a .gz-file with a PATH-style list of directories.
* If the filename starts with "." or "/", the path is ignored. * If the filename starts with "." or "/", the path is ignored.
*/ */
static gzFile *php3_gzopen_with_path(char *filename, char *mode, char *path, char **opened_path) static gzFile *php_gzopen_with_path(char *filename, char *mode, char *path, char **opened_path)
{ {
char *pathbuf, *ptr, *end; char *pathbuf, *ptr, *end;
char trypath[MAXPATHLEN + 1]; char trypath[MAXPATHLEN + 1];
@ -303,7 +303,7 @@ PHP_FUNCTION(gzfile) {
} }
convert_to_string_ex(filename); convert_to_string_ex(filename);
zp = php3_gzopen_wrapper((*filename)->value.str.val,"r", use_include_path|ENFORCE_SAFE_MODE); zp = php_gzopen_wrapper((*filename)->value.str.val,"r", use_include_path|ENFORCE_SAFE_MODE);
if (!zp) { if (!zp) {
php_error(E_WARNING,"gzFile(\"%s\") - %s",(*filename)->value.str.val,strerror(errno)); php_error(E_WARNING,"gzFile(\"%s\") - %s",(*filename)->value.str.val,strerror(errno));
RETURN_FALSE; RETURN_FALSE;
@ -361,9 +361,9 @@ PHP_FUNCTION(gzopen) {
/* /*
* We need a better way of returning error messages from * We need a better way of returning error messages from
* php3_gzopen_wrapper(). * php_gzopen_wrapper().
*/ */
zp = php3_gzopen_wrapper((*arg1)->value.str.val, p, use_include_path|ENFORCE_SAFE_MODE); zp = php_gzopen_wrapper((*arg1)->value.str.val, p, use_include_path|ENFORCE_SAFE_MODE);
if (!zp) { if (!zp) {
php_error(E_WARNING,"gzopen(\"%s\",\"%s\") - %s", php_error(E_WARNING,"gzopen(\"%s\",\"%s\") - %s",
(*arg1)->value.str.val, p, strerror(errno)); (*arg1)->value.str.val, p, strerror(errno));
@ -659,9 +659,9 @@ PHP_FUNCTION(readgzfile) {
/* /*
* We need a better way of returning error messages from * We need a better way of returning error messages from
* php3_gzopen_wrapper(). * php_gzopen_wrapper().
*/ */
zp = php3_gzopen_wrapper((*arg1)->value.str.val,"r", use_include_path|ENFORCE_SAFE_MODE); zp = php_gzopen_wrapper((*arg1)->value.str.val,"r", use_include_path|ENFORCE_SAFE_MODE);
if (!zp){ if (!zp){
php_error(E_WARNING,"ReadGzFile(\"%s\") - %s",(*arg1)->value.str.val,strerror(errno)); php_error(E_WARNING,"ReadGzFile(\"%s\") - %s",(*arg1)->value.str.val,strerror(errno));
RETURN_FALSE; RETURN_FALSE;

View file

@ -1,42 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP version 4.0 |
+----------------------------------------------------------------------+
| Copyright (c) 1997, 1998, 1999 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 2.0 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available at through the world-wide-web at |
| http://www.php.net/license/2_0.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Jaakko Hyvätti <jaakko.hyvatti@iki.fi> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#include "php_config.h"
#include <stdio.h>
#include <stdarg.h>
#if BROKEN_SPRINTF
int
php_sprintf (char*s, const char* format, ...)
{
va_list args;
char *ret;
va_start (args, format);
s[0] = '\0';
ret = vsprintf (s, format, args);
va_end (args);
if (!ret)
return -1;
return strlen (s);
}
#endif /* BROKEN_SPRINTF */

View file

@ -6,7 +6,7 @@
static char Win_Error_msg[256]; static char Win_Error_msg[256];
#endif #endif
char *php3_win_err(void) char *php_win_err(void)
{ {
FormatMessage( FormatMessage(
FORMAT_MESSAGE_FROM_SYSTEM, FORMAT_MESSAGE_FROM_SYSTEM,

View file

@ -1 +1 @@
extern char *php3_win_err(void); extern char *php_win_err(void);