CVS update: php3/functions
| From: | andrew | Date: | Sat, 20 Mar 1999 15:03:32 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-4691@lists.php.net to get a copy of this message | ||
Date: Saturday March 20, 1999 @ 10:03
Author: andrew
Update of /repository/php3/functions
In directory asf:/u/temp/cvs-serv19249/functions
Modified Files:
interbase.c php3_interbase.h
Log Message:
Added charset parameter to ibase_connect, ibase_pconnect
Initial arrays support added. Now read-only, not tested on
multidimensional arrays.
Constant argument ibase_fetch() "TEXT" changed to constant IBASE_TEXT,
added IBASE_TIMESTAMP for fetching DATE as timestamp.
Constant arguments ibase_trans() changed:
"READ" IBASE_READ
"COMMITED" IBASE_COMMITED
"CONSISTENCY" IBASE_CONSISTENCY
"NOWAIT" IBASE_NOWAIT
Index: php3/functions/interbase.c
diff -c php3/functions/interbase.c:1.13 php3/functions/interbase.c:1.14
*** php3/functions/interbase.c:1.13 Tue Mar 9 01:23:14 1999
--- php3/functions/interbase.c Sat Mar 20 10:03:32 1999
***************
*** 28,34 ****
+----------------------------------------------------------------------+
*/
! /* $Id: interbase.c,v 1.13 1999/03/09 06:23:14 andrew Exp $ */
/* TODO: Arrays, roles?
A lot... */
--- 28,34 ----
+----------------------------------------------------------------------+
*/
! /* $Id: interbase.c,v 1.14 1999/03/20 15:03:32 andrew Exp $ */
/* TODO: Arrays, roles?
A lot... */
***************
*** 46,83 ****
#include "fsock.h"
#include "head.h"
! /* {{{ extension definition structures */ /*fold00*/
function_entry ibase_functions[] = {
! {"ibase_connect", php3_ibase_connect, NULL},
! {"ibase_pconnect", php3_ibase_pconnect, NULL},
! {"ibase_close", php3_ibase_close, NULL},
! {"ibase_query", php3_ibase_query, NULL},
! {"ibase_fetch_row", php3_ibase_fetch_row, NULL},
! {"ibase_fetch_object", php3_ibase_fetch_object,NULL},
! {"ibase_free_result", php3_ibase_free_result, NULL},
! {"ibase_prepare", php3_ibase_prepare, NULL},
! {"ibase_execute", php3_ibase_execute, NULL},
! {"ibase_free_query", php3_ibase_free_query, NULL},
! {"ibase_timefmt", php3_ibase_timefmt, NULL},
!
! {"ibase_num_fields", php3_ibase_num_fields, NULL},
! {"ibase_field_info", php3_ibase_field_info, NULL},
!
! {"ibase_trans", php3_ibase_trans, NULL},
! {"ibase_commit", php3_ibase_commit, NULL},
! {"ibase_rollback", php3_ibase_rollback, NULL},
!
! {"ibase_blob_info", php3_ibase_blob_info, NULL},
! {"ibase_blob_create", php3_ibase_blob_create, NULL},
! {"ibase_blob_add", php3_ibase_blob_add, NULL},
! {"ibase_blob_cancel", php3_ibase_blob_cancel, NULL},
! {"ibase_blob_close", php3_ibase_blob_close, NULL},
! {"ibase_blob_open", php3_ibase_blob_open, NULL},
! {"ibase_blob_get", php3_ibase_blob_get, NULL},
! {"ibase_blob_echo", php3_ibase_blob_echo, NULL},
! {"ibase_blob_import", php3_ibase_blob_import, NULL},
!
! {"ibase_errmsg", php3_ibase_errmsg, NULL},
{NULL, NULL, NULL}
};
--- 46,84 ----
#include "fsock.h"
#include "head.h"
! /* {{{ extension definition structures */
function_entry ibase_functions[] = {
! PHP_FE(ibase_connect, NULL)
! PHP_FE(ibase_pconnect, NULL)
! PHP_FE(ibase_close, NULL)
! PHP_FE(ibase_query, NULL)
! PHP_FE(ibase_fetch_row, NULL)
! PHP_FE(ibase_fetch_object, NULL)
! PHP_FE(ibase_free_result, NULL)
! PHP_FE(ibase_prepare, NULL)
! PHP_FE(ibase_execute, NULL)
! PHP_FE(ibase_free_query, NULL)
! PHP_FE(ibase_timefmt, NULL)
!
! PHP_FE(ibase_num_fields, NULL)
! PHP_FE(ibase_field_info, NULL)
!
! PHP_FE(ibase_trans, NULL)
! PHP_FE(ibase_commit, NULL)
! PHP_FE(ibase_rollback, NULL)
!
! PHP_FE(ibase_blob_info, NULL)
! PHP_FE(ibase_blob_create, NULL)
! PHP_FE(ibase_blob_add, NULL)
! PHP_FE(ibase_blob_cancel, NULL)
! PHP_FE(ibase_blob_close, NULL)
! PHP_FE(ibase_blob_open, NULL)
! PHP_FE(ibase_blob_get, NULL)
! PHP_FE(ibase_blob_echo, NULL)
! PHP_FE(ibase_blob_import, NULL)
!
! PHP_FE(ibase_errmsg, NULL)
!
{NULL, NULL, NULL}
};
***************
*** 86,102 ****
"InterBase",
ibase_functions,
php3_minit_ibase,
! NULL,
php3_rinit_ibase,
php3_rfinish_ibase,
! NULL /*php3_info_ibase*/,
STANDARD_MODULE_PROPERTIES
};
/* }}} */
! /* {{{ internal macros and structs */ /*fold00*/
/* db_handle and transaction handle keep in one variable
link = db_handle * IBASE_TRANS_ON_LINK + trans_handle
*/
--- 87,105 ----
"InterBase",
ibase_functions,
php3_minit_ibase,
! php3_mfinish_ibase,
php3_rinit_ibase,
php3_rfinish_ibase,
! php3_info_ibase,
STANDARD_MODULE_PROPERTIES
};
/* }}} */
! /* {{{ internal macros and structures */
+ #define IB_STATUS (IBASE_GLOBAL(php3_ibase_module).status)
+
/* db_handle and transaction handle keep in one variable
link = db_handle * IBASE_TRANS_ON_LINK + trans_handle
*/
***************
*** 109,115 ****
link_id /= IBASE_TRANS_ON_LINK; \
ib_link = (ibase_db_link *) php3_list_find(link_id, &type); \
if (type!=IBASE_GLOBAL(php3_ibase_module).le_link &&
type!=IBASE_GLOBAL(php3_ibase_module).le_plink) { \
! _php3_module_error("%d is not link or transaction index",link_id); \
RETURN_FALSE; \
}}
--- 112,118 ----
link_id /= IBASE_TRANS_ON_LINK; \
ib_link = (ibase_db_link *) php3_list_find(link_id, &type); \
if (type!=IBASE_GLOBAL(php3_ibase_module).le_link &&
type!=IBASE_GLOBAL(php3_ibase_module).le_plink) { \
! _php3_ibase_module_error("%d is not link or transaction index",link_id); \
RETURN_FALSE; \
}}
***************
*** 119,125 ****
int type; \
ib_query = (ibase_query *) php3_list_find(query_id, &type); \
if (type!=IBASE_GLOBAL(php3_ibase_module).le_query) { \
! _php3_module_error("%d is not query index",query_id); \
RETURN_FALSE; \
}}
--- 122,128 ----
int type; \
ib_query = (ibase_query *) php3_list_find(query_id, &type); \
if (type!=IBASE_GLOBAL(php3_ibase_module).le_query) { \
! _php3_ibase_module_error("%d is not query index",query_id); \
RETURN_FALSE; \
}}
***************
*** 128,134 ****
int type; \
ib_result = (ibase_result *) php3_list_find(result_id, &type); \
if (type!=IBASE_GLOBAL(php3_ibase_module).le_result) { \
! _php3_module_error("%d is not result index",result_id); \
RETURN_FALSE; \
}}
--- 131,137 ----
int type; \
ib_result = (ibase_result *) php3_list_find(result_id, &type); \
if (type!=IBASE_GLOBAL(php3_ibase_module).le_result) { \
! _php3_ibase_module_error("%d is not result index",result_id); \
RETURN_FALSE; \
}}
***************
*** 151,166 ****
/* get blob identifier from argument
*/
! #define GET_BLOB_ID_ARG(blob_arg, ib_blob) \
{\
! if(blob_arg->type != IS_STRING\
! || blob_arg->value.str.len != sizeof(ibase_blob_handle)\
! || ((ibase_blob_handle *)(blob_arg->value.str.val))->bl_handle != 0){\
! _php3_module_error("invalid blob id");\
RETURN_FALSE;\
}\
- ib_blob = (ibase_blob_handle *)blob_arg->value.str.val;\
}
--- 154,173 ----
/* get blob identifier from argument
+ on empty unset argumnet ib_blob set to NULL
*/
! #define GET_BLOB_ID_ARG(blob_arg, ib_blob)\
{\
! if(blob_arg->type == IS_STRING && blob_arg->value.str.len == 0){\
! ib_blob = NULL;\
! }else if(blob_arg->type != IS_STRING\
! || blob_arg->value.str.len != sizeof(ibase_blob_handle)\
! || ((ibase_blob_handle *)(blob_arg->value.str.val))->bl_handle != 0){\
! _php3_ibase_module_error("invalid blob id");\
RETURN_FALSE;\
+ }else{\
+ ib_blob = (ibase_blob_handle *)blob_arg->value.str.val;\
}\
}
***************
*** 173,179 ****
convert_to_long(blob_arg); \
blob_ptr = (ibase_blob_handle *) php3_list_find(blob_arg->value.lval, &type); \
if (type!=IBASE_GLOBAL(php3_ibase_module).le_blob) { \
! _php3_module_error("%d is not blob handle",blob_arg->value.lval); \
RETURN_FALSE; \
} \
}
--- 180,186 ----
convert_to_long(blob_arg); \
blob_ptr = (ibase_blob_handle *) php3_list_find(blob_arg->value.lval, &type); \
if (type!=IBASE_GLOBAL(php3_ibase_module).le_blob) { \
! _php3_ibase_module_error("%d is not blob handle",blob_arg->value.lval); \
RETURN_FALSE; \
} \
}
***************
*** 189,195 ****
/* }}} */
! /* {{{ thread safety stuff */ /*fold00*/
#if defined(THREAD_SAFE)
typedef ibase_global_struct{
ibase_module php3_ibase_module;
--- 196,202 ----
/* }}} */
! /* {{{ thread safety stuff */
#if defined(THREAD_SAFE)
typedef ibase_global_struct{
ibase_module php3_ibase_module;
***************
*** 210,221 ****
/* error handling ---------------------------- */
! /* {{{ proto string ibase_errmsg() */ /*fold00*/
/* Return error message */
void php3_ibase_errmsg(INTERNAL_FUNCTION_PARAMETERS)
{
char *errmsg = IBASE_GLOBAL(php3_ibase_module).errmsg;
IBASE_TLS_VARS;
if(errmsg[0]){
RETURN_STRING(errmsg,1);
}
--- 217,229 ----
/* error handling ---------------------------- */
! /* {{{ proto string ibase_errmsg() */
/* Return error message */
void php3_ibase_errmsg(INTERNAL_FUNCTION_PARAMETERS)
{
char *errmsg = IBASE_GLOBAL(php3_ibase_module).errmsg;
IBASE_TLS_VARS;
+
if(errmsg[0]){
RETURN_STRING(errmsg,1);
}
***************
*** 224,237 ****
/* }}} */
! /* {{{ _php3_ibase_error() */ /*fold00*/
/* print interbase error and save it for ibase_errmsg() */
! static void _php3_ibase_error(ISC_STATUS *status)
{
char *s, *errmsg = IBASE_GLOBAL(php3_ibase_module).errmsg;
s = errmsg;
! while((s - errmsg) < MAX_ERRMSG - (IBASE_MSGSIZE + 2) && isc_interprete(s,
&status)){
strcat(errmsg, " ");
s = errmsg + strlen(errmsg);
}
--- 232,246 ----
/* }}} */
! /* {{{ _php3_ibase_error() */
/* print interbase error and save it for ibase_errmsg() */
! static void _php3_ibase_error(void)
{
char *s, *errmsg = IBASE_GLOBAL(php3_ibase_module).errmsg;
+ ISC_STATUS *statusp = IB_STATUS;
s = errmsg;
! while((s - errmsg) < MAX_ERRMSG - (IBASE_MSGSIZE + 2) && isc_interprete(s,
&statusp)){
strcat(errmsg, " ");
s = errmsg + strlen(errmsg);
}
***************
*** 240,248 ****
/* }}} */
! /* {{{ _php3_module_error() */ /*fold00*/
/* print php interbase module error and save it for ibase_errmsg() */
! static void _php3_module_error(char *msg, ...)
{
char *errmsg = IBASE_GLOBAL(php3_ibase_module).errmsg;
va_list ap;
--- 249,257 ----
/* }}} */
! /* {{{ _php3_ibase_module_error() */
/* print php interbase module error and save it for ibase_errmsg() */
! static void _php3_ibase_module_error(char *msg, ...)
{
char *errmsg = IBASE_GLOBAL(php3_ibase_module).errmsg;
va_list ap;
***************
*** 261,267 ****
/* destructors ---------------------- */
! /* {{{ _php3_ibase_free_xsqlda() */ /*fold00*/
/* not actual destructor ... */
static void _php3_ibase_free_xsqlda(XSQLDA *sqlda)
{
--- 270,276 ----
/* destructors ---------------------- */
! /* {{{ _php3_ibase_free_xsqlda() */
/* not actual destructor ... */
static void _php3_ibase_free_xsqlda(XSQLDA *sqlda)
{
***************
*** 281,366 ****
/* }}} */
! /* {{{ _php3_ibase_commit_link() */ /*fold00*/
static void _php3_ibase_commit_link(ibase_db_link *link)
{
- ISC_STATUS status[20];
int i;
! if(link->trans[0] != NULL){ /* commit default */
! if(isc_commit_transaction(status, &link->trans[0])){
! _php3_ibase_error(status);
}
! link->trans[0] = NULL;
}
for(i = 1; i < IBASE_TRANS_ON_LINK; i++){
if(link->trans[i] != NULL){
! if(isc_rollback_transaction(status, &link->trans[i])){
! _php3_ibase_error(status);
}
! link->trans[i] = NULL;
}
}
}
/* }}} */
! /* {{{ _php3_ibase_close_link() */ /*fold00*/
static void _php3_ibase_close_link(ibase_db_link *link)
{
- ISC_STATUS status[20];
- IBASE_TLS_VARS;
-
_php3_ibase_commit_link(link);
! isc_detach_database(status, &link->link);
IBASE_GLOBAL(php3_ibase_module).num_links--;
efree(link);
}
/* }}} */
! /* {{{ _php3_ibase_close_plink() */ /*fold00*/
static void _php3_ibase_close_plink(ibase_db_link *link)
{
- ISC_STATUS status[20];
- IBASE_TLS_VARS;
-
_php3_ibase_commit_link(link);
! isc_detach_database(status, &link->link);
! php3_ibase_module.num_persistent--;
! php3_ibase_module.num_links--;
free(link);
}
/* }}} */
! /* {{{ _php3_ibase_free_result() */ /*fold00*/
static void _php3_ibase_free_result(ibase_result *ib_result)
{
- ISC_STATUS status[20];
-
if (ib_result){
_php3_ibase_free_xsqlda(ib_result->out_sqlda);
if(ib_result->drop_stmt && ib_result->stmt){
! if(isc_dsql_free_statement(status, &ib_result->stmt, DSQL_drop)){
! _php3_ibase_error(status);
}
}else{
! if(isc_dsql_free_statement(status, &ib_result->stmt, DSQL_close)){
! _php3_ibase_error(status);
}
}
efree(ib_result);
}
}
/* }}} */
! /* {{{ _php3_ibase_free_query() */ /*fold00*/
static void _php3_ibase_free_query(ibase_query *ib_query)
{
! ISC_STATUS status[20];
!
if(ib_query){
if (ib_query->in_sqlda) {
efree(ib_query->in_sqlda);
--- 290,368 ----
/* }}} */
! /* {{{ _php3_ibase_commit_link() */
static void _php3_ibase_commit_link(ibase_db_link *link)
{
int i;
! if(link->trans[0] != NULL){ /* commit default */
! if(isc_commit_transaction(IB_STATUS, &link->trans[0])){
! _php3_ibase_error();
}
! link->trans[0] = NULL;
}
for(i = 1; i < IBASE_TRANS_ON_LINK; i++){
if(link->trans[i] != NULL){
! if(isc_rollback_transaction(IB_STATUS, &link->trans[i])){
! _php3_ibase_error();
}
! link->trans[i] = NULL;
}
}
}
/* }}} */
! /* {{{ _php3_ibase_close_link() */
static void _php3_ibase_close_link(ibase_db_link *link)
{
_php3_ibase_commit_link(link);
! isc_detach_database(IB_STATUS, &link->link);
IBASE_GLOBAL(php3_ibase_module).num_links--;
efree(link);
}
/* }}} */
! /* {{{ _php3_ibase_close_plink() */
static void _php3_ibase_close_plink(ibase_db_link *link)
{
_php3_ibase_commit_link(link);
! isc_detach_database(IB_STATUS, &link->link);
! IBASE_GLOBAL(php3_ibase_module).num_persistent--;
! IBASE_GLOBAL(php3_ibase_module).num_links--;
free(link);
}
/* }}} */
! /* {{{ _php3_ibase_free_result() */
static void _php3_ibase_free_result(ibase_result *ib_result)
{
if (ib_result){
_php3_ibase_free_xsqlda(ib_result->out_sqlda);
if(ib_result->drop_stmt && ib_result->stmt){
! if(isc_dsql_free_statement(IB_STATUS, &ib_result->stmt, DSQL_drop)){
! _php3_ibase_error();
}
}else{
! if(isc_dsql_free_statement(IB_STATUS, &ib_result->stmt, DSQL_close)){
! _php3_ibase_error();
}
}
+ if(ib_result->out_array){
+ efree(ib_result->out_array);
+ }
efree(ib_result);
}
}
/* }}} */
! /* {{{ _php3_ibase_free_query() */
static void _php3_ibase_free_query(ibase_query *ib_query)
{
!
if(ib_query){
if (ib_query->in_sqlda) {
efree(ib_query->in_sqlda);
***************
*** 369,393 ****
efree(ib_query->out_sqlda);
}
if(ib_query->stmt){
! if(isc_dsql_free_statement(status, &ib_query->stmt, DSQL_drop)){
! _php3_ibase_error(status);
}
}
efree(ib_query);
}
}
/* }}} */
! /* {{{ _php3_ibase_free_blob() */ /*fold00*/
static void _php3_ibase_free_blob(ibase_blob_handle *ib_blob)
{
- ISC_STATUS status[20];
- IBASE_TLS_VARS;
if(ib_blob->bl_handle != NULL){ /* blob open*/
! if(isc_cancel_blob(status, &ib_blob->bl_handle)){
! _php3_ibase_error(status);
}
}
efree(ib_blob);
--- 371,399 ----
efree(ib_query->out_sqlda);
}
if(ib_query->stmt){
! if(isc_dsql_free_statement(IB_STATUS, &ib_query->stmt, DSQL_drop)){
! _php3_ibase_error();
}
}
+ if(ib_query->in_array){
+ efree(ib_query->in_array);
+ }
+ if(ib_query->out_array){
+ efree(ib_query->out_array);
+ }
efree(ib_query);
}
}
/* }}} */
! /* {{{ _php3_ibase_free_blob() */
static void _php3_ibase_free_blob(ibase_blob_handle *ib_blob)
{
if(ib_blob->bl_handle != NULL){ /* blob open*/
! if(isc_cancel_blob(IB_STATUS, &ib_blob->bl_handle)){
! _php3_ibase_error();
}
}
efree(ib_blob);
***************
*** 395,401 ****
/* }}} */
! /* {{{ startup, shutdown and info functions */ /*fold00*/
int php3_minit_ibase(INIT_FUNC_ARGS)
{
IBASE_TLS_VARS;
--- 401,407 ----
/* }}} */
! /* {{{ startup, shutdown and info functions */
int php3_minit_ibase(INIT_FUNC_ARGS)
{
IBASE_TLS_VARS;
***************
*** 426,431 ****
--- 432,446 ----
IBASE_GLOBAL(php3_ibase_module).le_blob = register_list_destructors(_php3_ibase_free_blob, NULL);
IBASE_GLOBAL(php3_ibase_module).le_link = register_list_destructors(_php3_ibase_close_link,
NULL);
IBASE_GLOBAL(php3_ibase_module).le_plink = register_list_destructors(_php3_ibase_commit_link,
_php3_ibase_close_plink);
+
+ REGISTER_LONG_CONSTANT("IBASE_DEFAULT", PHP3_IBASE_DEFAULT, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_TEXT", PHP3_IBASE_TEXT, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_TIMESTAMP", PHP3_IBASE_TIMESTAMP, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_READ", PHP3_IBASE_READ, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_COMMITED", PHP3_IBASE_COMMITED, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_CONSISTENCY", PHP3_IBASE_CONSISTENCY, CONST_PERSISTENT);
+ REGISTER_LONG_CONSTANT("IBASE_NOWAIT", PHP3_IBASE_NOWAIT, CONST_PERSISTENT);
+
return SUCCESS;
}
***************
*** 440,451 ****
return SUCCESS;
}
- /* TODO IF NEEDED
int php3_mfinish_ibase(void)
{
}
! */
int php3_rfinish_ibase(void)
{
--- 455,466 ----
return SUCCESS;
}
int php3_mfinish_ibase(void)
{
+ return SUCCESS;
}
!
int php3_rfinish_ibase(void)
{
***************
*** 457,475 ****
}
! void php3_info_ibase(void) /*fold00*/
{
! php3_printf("");
}
/* }}} */
! /* {{{ _php_ibase_attach_db() */ /*fold00*/
static int _php_ibase_attach_db(char *server, char *uname, char *passwd, char *charset, int
buffers, char *role, isc_db_handle *db)
{
char dpb_buffer[256], *dpb, *p;
int dpb_length, len;
- ISC_STATUS status[20];
dpb = dpb_buffer;
--- 472,489 ----
}
! void php3_info_ibase(void)
{
! php3_printf("$Revision: 1.14 $");
}
/* }}} */
! /* {{{ _php_ibase_attach_db() */
static int _php_ibase_attach_db(char *server, char *uname, char *passwd, char *charset, int
buffers, char *role, isc_db_handle *db)
{
char dpb_buffer[256], *dpb, *p;
int dpb_length, len;
dpb = dpb_buffer;
***************
*** 517,541 ****
dpb_length = dpb - dpb_buffer;
! if(isc_attach_database(status, strlen(server), server, db, dpb_length, dpb_buffer)){
! _php3_ibase_error(status);
! return 1;
}
! return 0;
}
/* }}} */
! /* {{{ _php3_ibase_connect() */ /*fold00*/
static void _php3_ibase_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
{
! pval *server, *uname, *passwd;
!
! char *ib_server, *ib_uname, *ib_passwd;
! int i, ib_server_len, ib_uname_len, ib_passwd_len;
isc_db_handle db_handle = NULL;
char *hashed_details;
! int hashed_details_length;
ibase_db_link *ib_link;
IBASE_TLS_VARS;
--- 531,554 ----
dpb_length = dpb - dpb_buffer;
! if(isc_attach_database(IB_STATUS, strlen(server), server, db, dpb_length, dpb_buffer)){
! _php3_ibase_error();
! return FAILURE;
}
! return SUCCESS;
}
/* }}} */
! /* {{{ _php3_ibase_connect() */
static void _php3_ibase_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
{
! pval **args;
! char *ib_server, *ib_uname, *ib_passwd, *ib_charset = NULL;
! int i, ib_uname_len, ib_passwd_len;
isc_db_handle db_handle = NULL;
char *hashed_details;
! int hashed_details_length = 0;
ibase_db_link *ib_link;
IBASE_TLS_VARS;
***************
*** 545,605 ****
ib_passwd = IBASE_GLOBAL(php3_ibase_module).default_password;
ib_uname_len = ib_uname ? strlen(ib_uname) : 0;
ib_passwd_len = ib_passwd ? strlen(ib_passwd) : 0;
!
! switch(ARG_COUNT(ht)) {
! case 1:
! {
! if (getParameters(ht, 1, &server) == FAILURE) {
! RETURN_FALSE;
! }
! convert_to_string(server);
! ib_server = server->value.str.val;
! ib_server_len = server->value.str.len;
! hashed_details_length = server->value.str.len+ib_uname_len+ib_passwd_len+5+3;
! hashed_details = (char *) emalloc(hashed_details_length+1);
! sprintf(hashed_details, "ibase_%s_%s_%s", ib_server, ib_uname, ib_passwd);
! }
! break;
! case 2:
! {
! if (getParameters(ht, 2, &server, &uname) == FAILURE) {
! RETURN_FALSE;
! }
! convert_to_string(server);
! convert_to_string(uname);
! ib_server = server->value.str.val;
! ib_uname = uname->value.str.val;
! ib_server_len = server->value.str.len;
! ib_uname_len = uname->value.str.len;
! hashed_details_length = server->value.str.len+uname->value.str.len+ib_passwd_len+5+3;
! hashed_details = (char *) emalloc(hashed_details_length+1);
! sprintf(hashed_details, "ibase_%s_%s_%s", ib_server, ib_uname, ib_passwd);
! }
! break;
! case 3:
! {
! if (getParameters(ht, 3, &server, &uname, &passwd) == FAILURE) {
! RETURN_FALSE;
! }
! convert_to_string(server);
! convert_to_string(uname);
! convert_to_string(passwd);
! ib_server = server->value.str.val;
! ib_uname = uname->value.str.val;
! ib_passwd = passwd->value.str.val;
! ib_server_len = server->value.str.len;
! ib_uname_len = uname->value.str.len;
! ib_passwd_len = passwd->value.str.len;
! hashed_details_length =
server->value.str.len+uname->value.str.len+passwd->value.str.len+5+3;
! hashed_details = (char *) emalloc(hashed_details_length+1);
! sprintf(hashed_details, "ibase_%s_%s_%s", ib_server, ib_uname, ib_passwd);
! }
! break;
! default:
WRONG_PARAM_COUNT;
- break;
}
if (persistent) {
list_entry *le;
--- 558,601 ----
ib_passwd = IBASE_GLOBAL(php3_ibase_module).default_password;
ib_uname_len = ib_uname ? strlen(ib_uname) : 0;
ib_passwd_len = ib_passwd ? strlen(ib_passwd) : 0;
!
! if(ARG_COUNT(ht) < 1 || ARG_COUNT(ht) > 4){
WRONG_PARAM_COUNT;
}
+
+ args = emalloc(sizeof(pval*) * ARG_COUNT(ht));
+ if (getParametersArray(ht, ARG_COUNT(ht), args) == FAILURE) {
+ efree(args);
+ RETURN_FALSE;
+ }
+ switch(ARG_COUNT(ht)) {
+ case 4:
+ convert_to_string(args[3]);
+ ib_charset = args[3]->value.str.val;
+ hashed_details_length += args[3]->value.str.len;
+ /* fallout */
+ case 3:
+ convert_to_string(args[2]);
+ ib_passwd = args[2]->value.str.val;
+ hashed_details_length += args[2]->value.str.len;
+ /* fallout */
+ case 2:
+ convert_to_string(args[1]);
+ ib_uname = args[1]->value.str.val;
+ hashed_details_length += args[1]->value.str.len;
+ /* fallout */
+ case 1:
+ convert_to_string(args[0]);
+ ib_server = args[0]->value.str.val;
+ hashed_details_length += args[0]->value.str.len;
+ }/* case */
+
+ efree(args);
+
+ hashed_details = (char *) emalloc(hashed_details_length+strlen("ibase_%s_%s_%s_%s")+1);
+ sprintf(hashed_details, "ibase_%s_%s_%s_%s", ib_server, ib_uname, ib_passwd,
ib_charset);
+
if (persistent) {
list_entry *le;
***************
*** 607,625 ****
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) {
! _php3_module_error("Too many open links (%d)",
IBASE_GLOBAL(php3_ibase_module).num_links);
efree(hashed_details);
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) {
! _php3_module_error("Too many open persistent links (%d)",
IBASE_GLOBAL(php3_ibase_module).num_persistent);
efree(hashed_details);
RETURN_FALSE;
}
/* create the ib_link */
! if (_php_ibase_attach_db(ib_server, ib_uname, ib_passwd, NULL, 0, NULL, &db_handle)) {
efree(hashed_details);
RETURN_FALSE;
}
--- 603,621 ----
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) {
! _php3_ibase_module_error("Too many open links (%d)",
IBASE_GLOBAL(php3_ibase_module).num_links);
efree(hashed_details);
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) {
! _php3_ibase_module_error("Too many open persistent links (%d)",
IBASE_GLOBAL(php3_ibase_module).num_persistent);
efree(hashed_details);
RETURN_FALSE;
}
/* create the ib_link */
! if (_php_ibase_attach_db(ib_server, ib_uname, ib_passwd, ib_charset, 0, NULL, &db_handle)
== FAILURE) {
efree(hashed_details);
RETURN_FALSE;
}
***************
*** 676,688 ****
}
}
if (IBASE_GLOBAL(php3_ibase_module).max_links!=-1 &&
IBASE_GLOBAL(php3_ibase_module).num_links>=IBASE_GLOBAL(php3_ibase_module).max_links) {
! _php3_module_error("Too many open links (%d)",
IBASE_GLOBAL(php3_ibase_module).num_links);
efree(hashed_details);
RETURN_FALSE;
}
/* create the ib_link */
! if (_php_ibase_attach_db(ib_server, ib_uname, ib_passwd, NULL, 0, NULL, &db_handle)) {
efree(hashed_details);
RETURN_FALSE;
}
--- 672,684 ----
}
}
if (IBASE_GLOBAL(php3_ibase_module).max_links!=-1 &&
IBASE_GLOBAL(php3_ibase_module).num_links>=IBASE_GLOBAL(php3_ibase_module).max_links) {
! _php3_ibase_module_error("Too many open links (%d)",
IBASE_GLOBAL(php3_ibase_module).num_links);
efree(hashed_details);
RETURN_FALSE;
}
/* create the ib_link */
! if (_php_ibase_attach_db(ib_server, ib_uname, ib_passwd, ib_charset, 0, NULL, &db_handle) ==
FAILURE) {
efree(hashed_details);
RETURN_FALSE;
}
***************
*** 712,744 ****
/* }}} */
! /* {{{ proto int ibase_connect(string database [, string username] [, string password]) */
/*fold00*/
/* Open a connection to an InterBase database */
! void php3_ibase_connect(INTERNAL_FUNCTION_PARAMETERS)
{
_php3_ibase_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
}
/* }}} */
! /* {{{ proto int ibase_pconnect(string database [, string username] [, string password]) */
/*fold00*/
/* Open a persistent connection to an InterBase database */
! void php3_ibase_pconnect(INTERNAL_FUNCTION_PARAMETERS)
{
_php3_ibase_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
}
/* }}} */
! /* {{{ proto int ibase_close([int link_identifier]) */ /*fold00*/
/* Close an InterBase connection */
! void php3_ibase_close(INTERNAL_FUNCTION_PARAMETERS)
{
pval *link_arg;
ibase_db_link *ib_link;
int link_id, trans_n;
IBASE_TLS_VARS;
RESET_ERRMSG;
switch (ARG_COUNT(ht)) {
--- 708,741 ----
/* }}} */
! /* {{{ proto int ibase_connect(string database [, string username] [, string password] [, string
charset]) */
/* Open a connection to an InterBase database */
! PHP_FUNCTION(ibase_connect)
{
_php3_ibase_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
}
/* }}} */
! /* {{{ proto int ibase_pconnect(string database [, string username] [, string password] [, string
charset] ) */
/* Open a persistent connection to an InterBase database */
! PHP_FUNCTION(ibase_pconnect)
{
_php3_ibase_connect(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
}
/* }}} */
! /* {{{ proto int ibase_close([int link_identifier]) */
/* Close an InterBase connection */
! PHP_FUNCTION(ibase_close)
{
pval *link_arg;
ibase_db_link *ib_link;
int link_id, trans_n;
IBASE_TLS_VARS;
+
RESET_ERRMSG;
switch (ARG_COUNT(ht)) {
***************
*** 764,812 ****
}
/* }}} */
! /* {{{ _php3_ibase_alloc_query() */ /*fold00*/
/* allocate and prepare query */
static int _php3_ibase_alloc_query(ibase_query **ib_queryp, isc_db_handle link, isc_tr_handle
trans, char *query)
{
#define IB_QUERY (*ib_queryp)
!
! ISC_STATUS status[20];
!
IB_QUERY = emalloc(sizeof(ibase_query));
IB_QUERY->link = link;
IB_QUERY->trans = trans;
IB_QUERY->stmt = NULL;
!
! if (isc_dsql_allocate_statement(status, &link, &IB_QUERY->stmt)) {
! _php3_ibase_error(status);
! efree(IB_QUERY);
! IB_QUERY=NULL;
! return FAILURE;
}
IB_QUERY->out_sqlda = emalloc(XSQLDA_LENGTH(0));
IB_QUERY->out_sqlda->sqln = 0;
IB_QUERY->out_sqlda->version = SQLDA_VERSION1;
! if (isc_dsql_prepare(status, &IB_QUERY->trans, &IB_QUERY->stmt, 0, query,
SQLDA_VERSION1, IB_QUERY->out_sqlda)) {
! _php3_ibase_error(status);
! efree(IB_QUERY->out_sqlda);
! efree(IB_QUERY);
! IB_QUERY = NULL;
! return FAILURE;
}
/* not enough output variables ? */
if(IB_QUERY->out_sqlda->sqld > IB_QUERY->out_sqlda->sqln){
IB_QUERY->out_sqlda =
erealloc(IB_QUERY->out_sqlda,XSQLDA_LENGTH(IB_QUERY->out_sqlda->sqld));
IB_QUERY->out_sqlda->sqln = IB_QUERY->out_sqlda->sqld;
IB_QUERY->out_sqlda->version = SQLDA_VERSION1;
! if (isc_dsql_describe(status, &IB_QUERY->stmt, SQLDA_VERSION1, IB_QUERY->out_sqlda)) {
! _php3_ibase_error(status);
! efree(IB_QUERY->out_sqlda);
! efree(IB_QUERY);
! IB_QUERY = NULL;
! return FAILURE;
}
}
--- 761,902 ----
}
/* }}} */
+ /* {{{ _php3_ibase_alloc_array() */
+ static int _php3_ibase_alloc_array(ibase_array **ib_arrayp, int *array_cntp,
+ XSQLDA *sqlda, isc_db_handle link, isc_tr_handle trans)
+ {
+ #define IB_ARRAY (*ib_arrayp)
+
+ int i, dim, ar_cnt, ar_length;
+ XSQLVAR *var;
+
+
+ IB_ARRAY = NULL;
+
+ ar_cnt = 0; /* find arrays */
+ var = sqlda->sqlvar;
+ for(i = 0; i < sqlda->sqld; i++, var++){
+ if((var->sqltype & ~1) == SQL_ARRAY)
+ ar_cnt++;
+ }
+
+ if(ar_cnt){ /* have arrays ? */
+
+ *array_cntp = ar_cnt;
+ IB_ARRAY = emalloc(sizeof(ibase_array)*ar_cnt);
+ ar_cnt = 0;
+ var = sqlda->sqlvar;
+ for(i = 0; i < sqlda->sqld; i++, var++){
+ if((var->sqltype & ~1) == SQL_ARRAY){
+
+ ISC_ARRAY_DESC *ar_desc = &IB_ARRAY[ar_cnt].ar_desc;
+
+ if(isc_array_lookup_bounds(IB_STATUS, &link, &trans,
+ var->relname, var->sqlname, ar_desc)){
+ _php3_ibase_error();
+ efree(IB_ARRAY);
+ IB_ARRAY = NULL;
+ return FAILURE;
+ }
+
+ switch (ar_desc->array_desc_dtype){
+ case blr_text:
+ case blr_text2:
+ IB_ARRAY[ar_cnt].el_type = SQL_TEXT;
+ IB_ARRAY[ar_cnt].el_size = ar_desc->array_desc_length+1;
+ break;
+ case blr_short:
+ IB_ARRAY[ar_cnt].el_type = SQL_SHORT;
+ IB_ARRAY[ar_cnt].el_size = sizeof(short);
+ break;
+ case blr_long:
+ IB_ARRAY[ar_cnt].el_type = SQL_LONG;
+ IB_ARRAY[ar_cnt].el_size = sizeof(long);
+ break;
+ case blr_float:
+ IB_ARRAY[ar_cnt].el_type = SQL_FLOAT;
+ IB_ARRAY[ar_cnt].el_size = sizeof(float);
+ break;
+ case blr_double:
+ IB_ARRAY[ar_cnt].el_type = SQL_DOUBLE;
+ IB_ARRAY[ar_cnt].el_size = sizeof(double);
+ break;
+ case blr_date:
+ IB_ARRAY[ar_cnt].el_type = SQL_DATE;
+ IB_ARRAY[ar_cnt].el_size = sizeof(ISC_QUAD);
+ break;
+ case blr_varying:
+ case blr_varying2: /* changed to SQL_TEXT ? */
+ /* sql_type = SQL_VARYING; Why? FIXME: ??? */
+ IB_ARRAY[ar_cnt].el_type = SQL_TEXT;
+ IB_ARRAY[ar_cnt].el_size = ar_desc->array_desc_length+sizeof(short);
+ break;
+ default:
+ _php3_ibase_module_error("unexpected array type %d in relation '%s' column
'%s')",
+ ar_desc->array_desc_dtype,var->relname, var->sqlname);
+ efree(IB_ARRAY);
+ IB_ARRAY = NULL;
+ return FAILURE;
+ }/* switch array_desc_type */
+
+ ar_length = 0; /* calculate elements count */
+ for(dim = 0; dim < ar_desc->array_desc_dimensions; dim++){
+ ar_length += 1 + ar_desc->array_desc_bounds[dim].array_bound_upper
+ - ar_desc->array_desc_bounds[dim].array_bound_lower;
+ }
+ IB_ARRAY[ar_cnt].ar_size = IB_ARRAY[ar_cnt].el_size * ar_length;
+
+ ar_cnt++;
+
+ }/* if SQL_ARRAY */
+ }/* for column */
+ }/* if array_cnt */
+
+ return SUCCESS;
+ #undef IB_ARRAY
+ }
+ /* }}} */
+
! /* {{{ _php3_ibase_alloc_query() */
/* allocate and prepare query */
static int _php3_ibase_alloc_query(ibase_query **ib_queryp, isc_db_handle link, isc_tr_handle
trans, char *query)
{
#define IB_QUERY (*ib_queryp)
!
IB_QUERY = emalloc(sizeof(ibase_query));
IB_QUERY->link = link;
IB_QUERY->trans = trans;
IB_QUERY->stmt = NULL;
! IB_QUERY->out_sqlda = NULL;
! IB_QUERY->in_sqlda = NULL;
! IB_QUERY->in_array = NULL;
! IB_QUERY->in_array_cnt = 0;
! IB_QUERY->out_array = NULL;
! IB_QUERY->out_array_cnt = 0;
!
! if (isc_dsql_allocate_statement(IB_STATUS, &link, &IB_QUERY->stmt)) {
! _php3_ibase_error();
! goto _php3_ibase_alloc_query_error;
}
IB_QUERY->out_sqlda = emalloc(XSQLDA_LENGTH(0));
IB_QUERY->out_sqlda->sqln = 0;
IB_QUERY->out_sqlda->version = SQLDA_VERSION1;
! if (isc_dsql_prepare(IB_STATUS, &IB_QUERY->trans, &IB_QUERY->stmt, 0, query,
SQLDA_VERSION1, IB_QUERY->out_sqlda)) {
! _php3_ibase_error();
! goto _php3_ibase_alloc_query_error;
}
+
/* not enough output variables ? */
if(IB_QUERY->out_sqlda->sqld > IB_QUERY->out_sqlda->sqln){
IB_QUERY->out_sqlda =
erealloc(IB_QUERY->out_sqlda,XSQLDA_LENGTH(IB_QUERY->out_sqlda->sqld));
IB_QUERY->out_sqlda->sqln = IB_QUERY->out_sqlda->sqld;
IB_QUERY->out_sqlda->version = SQLDA_VERSION1;
! if (isc_dsql_describe(IB_STATUS, &IB_QUERY->stmt, SQLDA_VERSION1,
IB_QUERY->out_sqlda)) {
! _php3_ibase_error();
! goto _php3_ibase_alloc_query_error;
}
}
***************
*** 814,842 ****
IB_QUERY->in_sqlda = emalloc(XSQLDA_LENGTH(0));
IB_QUERY->in_sqlda->sqln = 0;
IB_QUERY->in_sqlda->version = SQLDA_VERSION1;
! if (isc_dsql_describe_bind(status, &IB_QUERY->stmt, SQLDA_VERSION1,
IB_QUERY->in_sqlda)) {
! efree(IB_QUERY->out_sqlda);
! efree(IB_QUERY->in_sqlda);
! efree(IB_QUERY);
! IB_QUERY = NULL;
! _php3_ibase_error(status);
! return FAILURE;
}
/* not enough input variables ? */
if(IB_QUERY->in_sqlda->sqln < IB_QUERY->in_sqlda->sqld){
IB_QUERY->in_sqlda =
erealloc(IB_QUERY->in_sqlda,XSQLDA_LENGTH(IB_QUERY->in_sqlda->sqld));
IB_QUERY->in_sqlda->sqln = IB_QUERY->in_sqlda->sqld;
IB_QUERY->in_sqlda->version = SQLDA_VERSION1;
! if (isc_dsql_describe_bind(status, &IB_QUERY->stmt, SQLDA_VERSION1,
IB_QUERY->in_sqlda)) {
! efree(IB_QUERY->out_sqlda);
! efree(IB_QUERY->in_sqlda);
! efree(IB_QUERY);
! IB_QUERY = NULL;
! _php3_ibase_error(status);
! return FAILURE;
}
}
/* no, haven't placeholders at all */
if(IB_QUERY->in_sqlda->sqld == 0){
efree(IB_QUERY->in_sqlda);
--- 904,936 ----
IB_QUERY->in_sqlda = emalloc(XSQLDA_LENGTH(0));
IB_QUERY->in_sqlda->sqln = 0;
IB_QUERY->in_sqlda->version = SQLDA_VERSION1;
! if (isc_dsql_describe_bind(IB_STATUS, &IB_QUERY->stmt, SQLDA_VERSION1,
IB_QUERY->in_sqlda)) {
! _php3_ibase_error();
! goto _php3_ibase_alloc_query_error;
}
+
/* not enough input variables ? */
if(IB_QUERY->in_sqlda->sqln < IB_QUERY->in_sqlda->sqld){
IB_QUERY->in_sqlda =
erealloc(IB_QUERY->in_sqlda,XSQLDA_LENGTH(IB_QUERY->in_sqlda->sqld));
IB_QUERY->in_sqlda->sqln = IB_QUERY->in_sqlda->sqld;
IB_QUERY->in_sqlda->version = SQLDA_VERSION1;
! if (isc_dsql_describe_bind(IB_STATUS, &IB_QUERY->stmt, SQLDA_VERSION1,
IB_QUERY->in_sqlda)) {
! _php3_ibase_error();
! goto _php3_ibase_alloc_query_error;
}
}
+ /* allocate arrays... */
+ if (_php3_ibase_alloc_array(&IB_QUERY->in_array, &IB_QUERY->in_array_cnt,
+ IB_QUERY->in_sqlda, link, trans) == FAILURE){
+ goto _php3_ibase_alloc_query_error; /* error report already done */
+ }
+
+ if (_php3_ibase_alloc_array(&IB_QUERY->out_array, &IB_QUERY->out_array_cnt,
+ IB_QUERY->out_sqlda, link, trans) == FAILURE){
+ goto _php3_ibase_alloc_query_error;
+ }
+
/* no, haven't placeholders at all */
if(IB_QUERY->in_sqlda->sqld == 0){
efree(IB_QUERY->in_sqlda);
***************
*** 847,872 ****
efree(IB_QUERY->out_sqlda);
IB_QUERY->out_sqlda = NULL;
}
!
return SUCCESS;
#undef IB_QUERY
}
/* }}} */
! /* {{{ _php3_ibase_bind() */ /*fold00*/
/* bind php variables to XSQLDA */
static int _php3_ibase_bind(XSQLDA *sqlda, pval **b_vars, BIND_BUF *buf)
{
XSQLVAR *var;
pval *b_var;
int i;
var = sqlda->sqlvar;
for(i = 0; i < sqlda->sqld; var++, i++) { /* binded vars */
buf[i].sqlind = 0;
var->sqlind = &buf[i].sqlind;
b_var = b_vars[i];
switch(var->sqltype & ~1) {
case SQL_TEXT: /* direct to variable */
case SQL_VARYING:
--- 941,982 ----
efree(IB_QUERY->out_sqlda);
IB_QUERY->out_sqlda = NULL;
}
!
return SUCCESS;
+
+ _php3_ibase_alloc_query_error:
+
+ if(IB_QUERY->out_sqlda)
+ efree(IB_QUERY->out_sqlda);
+ if(IB_QUERY->in_sqlda)
+ efree(IB_QUERY->in_sqlda);
+ if(IB_QUERY->out_array)
+ efree(IB_QUERY->out_array);
+ efree(IB_QUERY);
+ IB_QUERY = NULL;
+
+ return FAILURE;
#undef IB_QUERY
}
/* }}} */
! /* {{{ _php3_ibase_bind() */
/* bind php variables to XSQLDA */
static int _php3_ibase_bind(XSQLDA *sqlda, pval **b_vars, BIND_BUF *buf)
{
XSQLVAR *var;
pval *b_var;
int i;
+
var = sqlda->sqlvar;
for(i = 0; i < sqlda->sqld; var++, i++) { /* binded vars */
+
buf[i].sqlind = 0;
var->sqlind = &buf[i].sqlind;
b_var = b_vars[i];
+
switch(var->sqltype & ~1) {
case SQL_TEXT: /* direct to variable */
case SQL_VARYING:
***************
*** 878,884 ****
case SQL_SHORT:
convert_to_long(b_var);
if(b_var->value.lval > SHRT_MAX || b_var->value.lval < SHRT_MIN){
! _php3_module_error("field %*s overflow", var->aliasname_length,
var->aliasname);
return FAILURE;
}
buf[i].val.sval = (short)b_var->value.lval;
--- 988,994 ----
case SQL_SHORT:
convert_to_long(b_var);
if(b_var->value.lval > SHRT_MAX || b_var->value.lval < SHRT_MIN){
! _php3_ibase_module_error("field %*s overflow", var->aliasname_length,
var->aliasname);
return FAILURE;
}
buf[i].val.sval = (short)b_var->value.lval;
***************
*** 905,918 ****
t.tm_min = t.tm_sec = 0;
convert_to_string(b_var);
#if HAVE_STRFTIME /*FIXME: HAVE_STRPTIME ?*/
strptime(b_var->value.str.val, IBASE_GLOBAL(php3_ibase_module).timeformat, &t);
#else
{
int n = sscanf(b_var->value.str.val,"%d%*[/]%d%*[/]%d %d%*[:]%d%*[:]%d",
&t.tm_mon, &t.tm_mday, &t.tm_year, &t.tm_hour, &t.tm_min,
&t.tm_sec);
if(n != 3 && n != 6){
! _php3_module_error("invalid date/time format");
return FAILURE;
}
--- 1015,1030 ----
t.tm_min = t.tm_sec = 0;
convert_to_string(b_var);
+
#if HAVE_STRFTIME /*FIXME: HAVE_STRPTIME ?*/
+
strptime(b_var->value.str.val, IBASE_GLOBAL(php3_ibase_module).timeformat, &t);
#else
{
int n = sscanf(b_var->value.str.val,"%d%*[/]%d%*[/]%d %d%*[:]%d%*[:]%d",
&t.tm_mon, &t.tm_mday, &t.tm_year, &t.tm_hour, &t.tm_min,
&t.tm_sec);
if(n != 3 && n != 6){
! _php3_ibase_module_error("invalid date/time format");
return FAILURE;
}
***************
*** 930,936 ****
if(b_var->type != IS_STRING
|| b_var->value.str.len != sizeof(ibase_blob_handle)
|| ((ibase_blob_handle *)(b_var->value.str.val))->bl_handle != 0){
! _php3_module_error("invalid blob id string");
return FAILURE;
}
ib_blob_id = (ibase_blob_handle *)b_var->value.str.val;
--- 1042,1048 ----
if(b_var->type != IS_STRING
|| b_var->value.str.len != sizeof(ibase_blob_handle)
|| ((ibase_blob_handle *)(b_var->value.str.val))->bl_handle != 0){
! _php3_ibase_module_error("invalid blob id string");
return FAILURE;
}
ib_blob_id = (ibase_blob_handle *)b_var->value.str.val;
***************
*** 939,945 ****
}
break;
case SQL_ARRAY:
! _php3_module_error("binding arrays not supported yet");
return FAILURE;
break;
}/*switch*/
--- 1051,1057 ----
}
break;
case SQL_ARRAY:
! _php3_ibase_module_error("binding arrays not supported yet");
return FAILURE;
break;
}/*switch*/
***************
*** 949,960 ****
/* }}} */
! /* {{{ _php3_ibase_alloc_xsqlda() */ /*fold00*/
static void _php3_ibase_alloc_xsqlda(XSQLDA *sqlda)
{
int i;
XSQLVAR *var = sqlda->sqlvar;
for (i = 0; i < sqlda->sqld; i++, var++) {
switch(var->sqltype & ~1){
case SQL_TEXT:
--- 1061,1073 ----
/* }}} */
! /* {{{ _php3_ibase_alloc_xsqlda() */
static void _php3_ibase_alloc_xsqlda(XSQLDA *sqlda)
{
int i;
XSQLVAR *var = sqlda->sqlvar;
+
for (i = 0; i < sqlda->sqld; i++, var++) {
switch(var->sqltype & ~1){
case SQL_TEXT:
***************
*** 990,1003 ****
/* }}} */
! /* {{{ _php3_ibase_exec() */ /*fold00*/
static int _php3_ibase_exec(ibase_result **ib_resultp, ibase_query *ib_query, int argc, pval
**args)
{
#define IB_RESULT (*ib_resultp)
XSQLDA *in_sqlda = NULL, *out_sqlda = NULL;
BIND_BUF *bind_buf = NULL;
int rv = FAILURE;
! ISC_STATUS status[20];
IB_RESULT = NULL;
--- 1103,1116 ----
/* }}} */
! /* {{{ _php3_ibase_exec() */
static int _php3_ibase_exec(ibase_result **ib_resultp, ibase_query *ib_query, int argc, pval
**args)
{
#define IB_RESULT (*ib_resultp)
XSQLDA *in_sqlda = NULL, *out_sqlda = NULL;
BIND_BUF *bind_buf = NULL;
int rv = FAILURE;
!
IB_RESULT = NULL;
***************
*** 1011,1021 ****
out_sqlda = IB_RESULT->out_sqlda = emalloc(XSQLDA_LENGTH(ib_query->out_sqlda->sqld));
memcpy(out_sqlda,ib_query->out_sqlda,XSQLDA_LENGTH(ib_query->out_sqlda->sqld));
_php3_ibase_alloc_xsqlda(out_sqlda);
}
if(ib_query->in_sqlda){ /* has placeholders */
if (ib_query->in_sqlda->sqld != argc){
! _php3_module_error("placeholders (%d) and variables (%d)
mismatch",ib_query->in_sqlda->sqld, argc);
goto _php3_ibase_exec_error; /* yes mommy, goto! */
}
in_sqlda = emalloc(XSQLDA_LENGTH(ib_query->in_sqlda->sqld));
--- 1124,1141 ----
out_sqlda = IB_RESULT->out_sqlda = emalloc(XSQLDA_LENGTH(ib_query->out_sqlda->sqld));
memcpy(out_sqlda,ib_query->out_sqlda,XSQLDA_LENGTH(ib_query->out_sqlda->sqld));
_php3_ibase_alloc_xsqlda(out_sqlda);
+
+ if(ib_query->out_array){
+ IB_RESULT->out_array = emalloc(sizeof(ibase_array)*ib_query->out_array_cnt);
+ memcpy(IB_RESULT->out_array, ib_query->out_array,
sizeof(ibase_array)*ib_query->out_array_cnt);
+ }else{
+ IB_RESULT->out_array = NULL;
+ }
}
if(ib_query->in_sqlda){ /* has placeholders */
if (ib_query->in_sqlda->sqld != argc){
! _php3_ibase_module_error("placeholders (%d) and variables (%d)
mismatch",ib_query->in_sqlda->sqld, argc);
goto _php3_ibase_exec_error; /* yes mommy, goto! */
}
in_sqlda = emalloc(XSQLDA_LENGTH(ib_query->in_sqlda->sqld));
***************
*** 1026,1034 ****
}
}
! if (isc_dsql_execute(status, &ib_query->trans, &ib_query->stmt, 1, in_sqlda)) {
! _php3_ibase_error(status);
! goto _php3_ibase_exec_error;
}
rv = SUCCESS;
--- 1146,1154 ----
}
}
! if (isc_dsql_execute(IB_STATUS, &ib_query->trans, &ib_query->stmt, 1, in_sqlda)) {
! _php3_ibase_error();
! goto _php3_ibase_exec_error;
}
rv = SUCCESS;
***************
*** 1055,1119 ****
/* }}} */
! /* {{{ proto int ibase_trans([int link_identifier, ][string trans_args]) */ /*fold00*/
/* Start transaction */
! void php3_ibase_trans(INTERNAL_FUNCTION_PARAMETERS)
{
! pval *link_arg, *trans_arg;
! char tpb[20], *tpbp = NULL, *trans_args = NULL;
! int tpb_len = 0, link_id, trans_n;
ibase_db_link *ib_link;
- ISC_STATUS status[20];
IBASE_TLS_VARS;
!
RESET_ERRMSG;
! switch (ARG_COUNT(ht)) {
! case 0:
! link_id = IBASE_GLOBAL(php3_ibase_module).default_link;
! break;
! case 1:
! if (getParameters(ht, 1, &trans_arg) == FAILURE) {
! RETURN_FALSE;
! }
! link_id = IBASE_GLOBAL(php3_ibase_module).default_link;
! convert_to_string(trans_arg);
! trans_args = trans_arg->value.str.val;
! break;
! case 2:
! if (getParameters(ht, 2, &link_arg, &trans_arg) == FAILURE) {
! RETURN_FALSE;
! }
! convert_to_long(link_arg);
! link_id = link_arg->value.lval;
! convert_to_string(trans_arg);
! trans_args = trans_arg->value.str.val;
! break;
! default:
! WRONG_PARAM_COUNT;
! break;
}
GET_LINK_TRANS(link_id, ib_link, trans_n);
! if(trans_args){
tpb[tpb_len++] = isc_tpb_version3;
tpbp = tpb;
/* access mode */
! if(strstr(trans_args,"READ")||strstr(trans_args,"read")) /* READ ONLY
TRANSACTION */
tpb[tpb_len++] = isc_tpb_read;
else
tpb[tpb_len++] = isc_tpb_write;
/* isolation level */
! if(strstr(trans_args,"COMMITED")||strstr(trans_args,"commited"))
tpb[tpb_len++] = isc_tpb_read_committed;
! else if (strstr(trans_args,"CONSISTENCY")||strstr(trans_args,"consistency"))
tpb[tpb_len++] = isc_tpb_consistency;
else
tpb[tpb_len++] = isc_tpb_concurrency;
/* lock resolution */
! if(strstr(trans_args,"NOWAIT")||strstr(trans_args,"nowait"))
tpb[tpb_len++] = isc_tpb_nowait;
else
tpb[tpb_len++] = isc_tpb_wait;
--- 1175,1248 ----
/* }}} */
! /* {{{ proto int ibase_trans([int trans_args [, int link_identifier]]) */
/* Start transaction */
! PHP_FUNCTION(ibase_trans)
{
! pval **args;
! char tpb[20], *tpbp = NULL;
! long trans_argl = 0;
! int tpb_len = 0, argn, link_id, trans_n;
ibase_db_link *ib_link;
IBASE_TLS_VARS;
!
RESET_ERRMSG;
+
+ link_id = IBASE_GLOBAL(php3_ibase_module).default_link;
+
+ /* TODO: multi-databases trans */
+ argn = ARG_COUNT(ht);
+ if(argn < 0 || argn > 2){
+ WRONG_PARAM_COUNT;
+ }
+
+ if(argn){
+ args = emalloc(sizeof(pval*) * argn);
+ if (getParametersArray(ht, argn, args) == FAILURE) {
+ efree(args);
+ RETURN_FALSE;
+ }
+
+ argn--;
+ convert_to_long(args[argn]); /* last arg - trans_args */
+ trans_argl = args[argn]->value.lval;
+
+ /* TODO: multi
+ do{
+ link_id[argn] = args[argn];
+ convert_to_long(args[argn]);
+ GET_LINK_TRANS(args[argn].value.lval, ib_link[argn], trans_n);
+ }while(argn--); */
+
+ if(argn){
+ argn--;
+ convert_to_long(args[argn]);
+ link_id = args[argn]->value.lval;
+ }
! efree(args);
}
GET_LINK_TRANS(link_id, ib_link, trans_n);
! if(trans_argl){
tpb[tpb_len++] = isc_tpb_version3;
tpbp = tpb;
/* access mode */
! if(trans_argl & PHP3_IBASE_READ) /* READ ONLY TRANSACTION */
tpb[tpb_len++] = isc_tpb_read;
else
tpb[tpb_len++] = isc_tpb_write;
/* isolation level */
! if(trans_argl & PHP3_IBASE_COMMITED){
tpb[tpb_len++] = isc_tpb_read_committed;
! }else if (trans_argl & PHP3_IBASE_CONSISTENCY)
tpb[tpb_len++] = isc_tpb_consistency;
else
tpb[tpb_len++] = isc_tpb_concurrency;
/* lock resolution */
! if(trans_argl & PHP3_IBASE_NOWAIT)
tpb[tpb_len++] = isc_tpb_nowait;
else
tpb[tpb_len++] = isc_tpb_wait;
***************
*** 1125,1136 ****
&& ib_link->trans[trans_n]; trans_n++)
;
if(trans_n == IBASE_TRANS_ON_LINK){
! _php3_module_error("too many transactions on link");
RETURN_FALSE;
}
! if (isc_start_transaction(status, &ib_link->trans[trans_n], 1, &ib_link->link,
tpb_len, tpbp)) {
! _php3_ibase_error(status);
RETURN_FALSE;
}
--- 1254,1265 ----
&& ib_link->trans[trans_n]; trans_n++)
;
if(trans_n == IBASE_TRANS_ON_LINK){
! _php3_ibase_module_error("too many transactions on link");
RETURN_FALSE;
}
! if (isc_start_transaction(IB_STATUS, &ib_link->trans[trans_n], 1, &ib_link->link,
tpb_len, tpbp)) {
! _php3_ibase_error();
RETURN_FALSE;
}
***************
*** 1139,1153 ****
/* }}} */
! /* {{{ _php3_ibase_def_trans() */ /*fold00*/
/* open default transaction */
static int _php3_ibase_def_trans(ibase_db_link * ib_link, int trans_n)
{
- ISC_STATUS status[20];
if(trans_n == 0 && ib_link->trans[0] == NULL){
! if (isc_start_transaction(status, &ib_link->trans[0], 1, &ib_link->link, 0, NULL))
{
! _php3_ibase_error(status);
return FAILURE;
}
}
--- 1268,1281 ----
/* }}} */
! /* {{{ _php3_ibase_def_trans() */
/* open default transaction */
static int _php3_ibase_def_trans(ibase_db_link * ib_link, int trans_n)
{
if(trans_n == 0 && ib_link->trans[0] == NULL){
! if (isc_start_transaction(IB_STATUS, &ib_link->trans[0], 1, &ib_link->link, 0,
NULL)) {
! _php3_ibase_error();
return FAILURE;
}
}
***************
*** 1156,1162 ****
/*}}}*/
! /* {{{ _php3_ibase_trans_end() */ /*fold00*/
#define COMMIT 1
#define ROLLBACK 0
static void _php3_ibase_trans_end(INTERNAL_FUNCTION_PARAMETERS, int commit)
--- 1284,1290 ----
/*}}}*/
! /* {{{ _php3_ibase_trans_end() */
#define COMMIT 1
#define ROLLBACK 0
static void _php3_ibase_trans_end(INTERNAL_FUNCTION_PARAMETERS, int commit)
***************
*** 1164,1171 ****
pval *link_trans_arg;
int link_id = 0, trans_n = 0;
ibase_db_link *ib_link;
- ISC_STATUS status[20];
IBASE_TLS_VARS;
RESET_ERRMSG;
--- 1292,1299 ----
pval *link_trans_arg;
int link_id = 0, trans_n = 0;
ibase_db_link *ib_link;
IBASE_TLS_VARS;
+
RESET_ERRMSG;
***************
*** 1188,1200 ****
GET_LINK_TRANS(link_id, ib_link, trans_n);
if (commit) {
! if(isc_commit_transaction(status, &ib_link->trans[trans_n])){
! _php3_ibase_error(status);
RETURN_FALSE;
}
}else{
! if(isc_rollback_transaction(status, &ib_link->trans[trans_n])){
! _php3_ibase_error(status);
RETURN_FALSE;
}
}
--- 1316,1328 ----
GET_LINK_TRANS(link_id, ib_link, trans_n);
if (commit) {
! if(isc_commit_transaction(IB_STATUS, &ib_link->trans[trans_n])){
! _php3_ibase_error();
RETURN_FALSE;
}
}else{
! if(isc_rollback_transaction(IB_STATUS, &ib_link->trans[trans_n])){
! _php3_ibase_error();
RETURN_FALSE;
}
}
***************
*** 1205,1231 ****
/* }}} */
! /* {{{ proto int ibase_commit([int link_identifier, ] int trans_number) */ /*fold00*/
/* Commit transaction */
! void php3_ibase_commit(INTERNAL_FUNCTION_PARAMETERS)
{
_php3_ibase_trans_end(INTERNAL_FUNCTION_PARAM_PASSTHRU, COMMIT);
}
/* }}} */
! /* {{{ proto int ibase_rollback([int link_identifier, ] int trans_number) */ /*fold00*/
/* Roolback transaction */
! void php3_ibase_rollback(INTERNAL_FUNCTION_PARAMETERS)
{
_php3_ibase_trans_end(INTERNAL_FUNCTION_PARAM_PASSTHRU, ROLLBACK);
}
/* }}} */
! /* {{{ proto int ibase_query([int link_identifier, ]string query[,bind args]) */ /*fold00*/
/* Execute a query. */
! void php3_ibase_query(INTERNAL_FUNCTION_PARAMETERS)
{
pval **args, **bind_args = NULL;
int i, link_id = 0, trans_n = 0, bind_n = 0;
--- 1333,1359 ----
/* }}} */
! /* {{{ proto int ibase_commit([int link_identifier, ] int trans_number) */
/* Commit transaction */
! PHP_FUNCTION(ibase_commit)
{
_php3_ibase_trans_end(INTERNAL_FUNCTION_PARAM_PASSTHRU, COMMIT);
}
/* }}} */
! /* {{{ proto int ibase_rollback([int link_identifier, ] int trans_number) */
/* Roolback transaction */
! PHP_FUNCTION(ibase_rollback)
{
_php3_ibase_trans_end(INTERNAL_FUNCTION_PARAM_PASSTHRU, ROLLBACK);
}
/* }}} */
! /* {{{ proto int ibase_query([int link_identifier, ]string query[,bind args]) */
/* Execute a query. */
! PHP_FUNCTION(ibase_query)
{
pval **args, **bind_args = NULL;
int i, link_id = 0, trans_n = 0, bind_n = 0;
***************
*** 1234,1239 ****
--- 1362,1368 ----
ibase_query *ib_query;
ibase_result *ib_result;
IBASE_TLS_VARS;
+
RESET_ERRMSG;
***************
*** 1261,1267 ****
query = args[i]->value.str.val;
i++; /* next arg */
}else{
! _php3_module_error("query argument missed");
efree(args);
RETURN_FALSE;
}
--- 1390,1396 ----
query = args[i]->value.str.val;
i++; /* next arg */
}else{
! _php3_ibase_module_error("query argument missed");
efree(args);
RETURN_FALSE;
}
***************
*** 1302,1322 ****
}
/* }}} */
! /* {{{ _php3_ibase_fetch_hash() */ /*fold00*/
! static void _php3_ibase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS)
{
! pval *result_arg, *blflag_arg;
! int blobchar = 0, i, collen;
! char string_data[255], *char_data;
ibase_result *ib_result;
- ISC_STATUS status[20];
XSQLVAR *var;
- IBASE_VCHAR *vchar;
IBASE_TLS_VARS;
!
RESET_ERRMSG;
!
switch(ARG_COUNT(ht)){
case 1:
if (ARG_COUNT(ht)==1 && getParameters(ht, 1, &result_arg)==FAILURE) {
--- 1431,1587 ----
}
/* }}} */
+
+ /* {{{ _php3_ibase_var_pval() */
+ static int _php3_ibase_var_pval(pval *val, void *data, int type, int len, int scale, int flag)
+ {
+ char string_data[255];
+
+
+ switch(type & ~1) {
+ case SQL_VARYING:
+ len = ((IBASE_VCHAR *) data)->var_len;
+ data = ((IBASE_VCHAR *) data)->var_str;
+ /* fallout */
+ case SQL_TEXT:
+ val->value.str.val = (char *)emalloc(sizeof(char)*(len+1));
+ strncpy(val->value.str.val, data, len);
+ if (php3_ini.magic_quotes_runtime) {
+ char *tmp = val->value.str.val;
+ val->value.str.val = _php3_addslashes(val->value.str.val, len, &len, 0);
+ efree(tmp);
+ }
+ val->type = IS_STRING;
+ val->value.str.len = len;
+ break;
+ case SQL_LONG:
+ if (scale) {
+ int j, f = 1;
+ float n = *(long *)(data);
+
+ for (j = 0; j < -scale; j++)
+ f *= 10;
+ val->type = IS_STRING;
+ val->value.str.len = sprintf(string_data, "%.*f", -scale, n / f);
+ val->value.str.val = estrdup(string_data);
+ }else{
+ val->type = IS_LONG;
+ val->value.lval = *(long *)(data);
+ }
+ break;
+ case SQL_SHORT:
+ val->type = IS_LONG;
+ val->value.lval = *(short *)(data);
+ break;
+ case SQL_FLOAT:
+ val->type = IS_DOUBLE;
+ val->value.dval = *(float *)(data);
+ break;
+ case SQL_DOUBLE:
+ if (scale) {
+ val->type = IS_STRING;
+ val->value.str.len = sprintf(string_data, "%.*f", -scale, *(double *)data);
+ val->value.str.val = estrdup(string_data);
+ }else{
+ val->type = IS_DOUBLE;
+ val->value.dval = *(double *)data;
+ }
+ break;
+ case SQL_DATE:{
+ struct tm t;
+ long timestamp = -1;
+
+ isc_decode_date((ISC_QUAD *) data, &t);
+ timestamp = mktime(&t);
+ t.tm_zone = tzname[0];
+
+ if(flag & PHP3_IBASE_TIMESTAMP){
+ val->type = IS_LONG;
+ val->value.lval = timestamp;
+ }else{
+ val->type = IS_STRING;
+ #if HAVE_STRFTIME
+ val->value.str.len = strftime(string_data, sizeof(string_data),
IBASE_GLOBAL(php3_ibase_module).timeformat, &t);
+ #else
+ if(!t.tm_hour && !t.tm_min && !t.tm_sec)
+ val->value.str.len = sprintf(string_data, "%02d/%02d/%4d", t.tm_mon+1,
t.tm_mday, t.tm_year+1900);
+ else
+ val->value.str.len = sprintf(string_data, "%02d/%02d/%4d %02d:%02d:%02d",
+ t.tm_mon+1, t.tm_mday, t.tm_year+1900, t.tm_hour, t.tm_min, t.tm_sec);
+ #endif
+ val->value.str.val = estrdup(string_data);
+ break;
+ }
+ }
+ default:
+ return FAILURE;
+ }/* switch (type) */
+ return SUCCESS;
+ }
+ /* }}} */
+
+ /* {{{ _php3_ibase_arr_pval() */
+ /* create multidimension array - resursion function
+ (*datap) argument changed */
+ static int _php3_ibase_arr_pval(pval *ar_pval, char **datap, ibase_array *ib_array, int dim, int
flag)
+ {
+ pval tmp;
+ int i, dim_len, l_bound, u_bound;
+
+
+ if (dim > 16){ /* InterBase limit */
+ _php3_ibase_module_error("php module internal error in %s %d",__FILE__,__LINE__);
+ return FAILURE;
+ }
+
+ u_bound = ib_array->ar_desc.array_desc_bounds[dim].array_bound_upper;
+ l_bound = ib_array->ar_desc.array_desc_bounds[dim].array_bound_lower;
+ dim_len = 1 + u_bound - l_bound;
+
+ if(dim < ib_array->ar_desc.array_desc_dimensions - 1){ /* array again */
+ for(i = 0; i < dim_len; i++){
+ /* recursion here */
+ if(_php3_ibase_arr_pval(ar_pval, datap, ib_array, dim+1, flag) == FAILURE){
+ return FAILURE;
+ }
+ }
+ }else{ /* data at last */
+
+ array_init(ar_pval);
+
+ for(i = 0; i < dim_len; i++){
+ if(_php3_ibase_var_pval(&tmp, *datap, ib_array->el_type,
+ ib_array->ar_desc.array_desc_length,
+ ib_array->ar_desc.array_desc_scale,
+ flag) == FAILURE){
+ return FAILURE;
+ }
+ _php3_hash_index_update(ar_pval->value.ht,
+ l_bound + i,
+ (void *) &tmp, sizeof(pval),NULL);
+ *datap += ib_array->el_size;
+ }
+ }
+ return SUCCESS;
+ }
+
+
+ /* {{{ _php3_ibase_fetch_hash() */
+
+ #define FETCH_ARRAY 1
+ #define FETCH_OBJECT 2
! static void _php3_ibase_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, int fetch_type)
{
! pval *result_arg, *flag_arg;
! long flag = 0;
! int i, arr_cnt;
ibase_result *ib_result;
XSQLVAR *var;
IBASE_TLS_VARS;
!
RESET_ERRMSG;
!
switch(ARG_COUNT(ht)){
case 1:
if (ARG_COUNT(ht)==1 && getParameters(ht, 1, &result_arg)==FAILURE) {
***************
*** 1324,1481 ****
}
break;
case 2:
! if(ARG_COUNT(ht)==2 && getParameters(ht, 2, &result_arg, &blflag_arg)==FAILURE)
{
RETURN_FALSE;
}
! convert_to_string(blflag_arg);
! if(strcasecmp(blflag_arg->value.str.val,"TEXT")){ /* FIXME: need? */
! _php3_module_error("invalid blob flag '%s'",
blflag_arg->value.str.val);
! RETURN_FALSE;
! }else{
! blobchar = 1;
! }
break;
default:
WRONG_PARAM_COUNT;
break;
-
}
convert_to_long(result_arg);
!
GET_RESULT(result_arg->value.lval, ib_result);
!
if (ib_result->out_sqlda == NULL) {
! _php3_module_error("trying to fetch results from a non-select query");
RETURN_FALSE;
}
!
! if(isc_dsql_fetch(status, &ib_result->stmt, 1, ib_result->out_sqlda) == 100L){
RETURN_FALSE; /* end of cursor */
}
! if(status[0] && status[1]){ /* error in fetch */
! _php3_ibase_error(status);
RETURN_FALSE;
}
! if (array_init(return_value)==FAILURE) {
! RETURN_FALSE;
}
!
var = ib_result->out_sqlda->sqlvar;
for (i = 0; i < ib_result->out_sqlda->sqld; i++, var++) {
! switch(var->sqltype & ~1) {
! case SQL_TEXT:
! if (((var->sqltype & 1) == 0) || *var->sqlind != -1){
! char_data = (char *)emalloc(sizeof(char)*(var->sqllen+1));
! collen = sprintf(char_data, "%*.*s", var->sqllen, var->sqllen,
var->sqldata);
! if (php3_ini.magic_quotes_runtime) {
! int newlen;
! char *tmp = _php3_addslashes(char_data, collen, &newlen, 0);
! efree(char_data);
! add_get_index_stringl(return_value, i, tmp, newlen, (void **) &result_arg, 0);
! } else {
! add_get_index_stringl(return_value, i, char_data, collen, (void **) &result_arg, 0);
! }
! _php3_hash_pointer_update(return_value->value.ht, var->aliasname,
var->aliasname_length+1, result_arg);
! }
! break;
! case SQL_VARYING:
! if (((var->sqltype & 1) == 0) || *var->sqlind != -1){
! vchar = (IBASE_VCHAR *) var->sqldata;
! char_data = (char *)emalloc(sizeof(char)*(vchar->var_len+1));
! collen = sprintf(char_data, "%*.*s", vchar->var_len, vchar->var_len,
vchar->var_str);
! if (php3_ini.magic_quotes_runtime) {
! int newlen;
! char *tmp = _php3_addslashes(char_data, collen, &newlen, 0);
! efree(char_data);
! add_get_index_stringl(return_value, i, tmp, newlen, (void **) &result_arg, 0);
! } else {
! add_get_index_stringl(return_value, i, char_data, collen, (void **) &result_arg, 0);
! }
! _php3_hash_pointer_update(return_value->value.ht, var->aliasname,
var->aliasname_length+1, result_arg);
! }
! break;
! case SQL_SHORT:
! if (((var->sqltype & 1) == 0) || *var->sqlind != -1){
! add_get_index_long(return_value, i, *(short *)(var->sqldata), (void **) &result_arg);
! _php3_hash_pointer_update(return_value->value.ht, var->aliasname,
var->aliasname_length+1, result_arg);
! }
! break;
! case SQL_LONG:
! if (((var->sqltype & 1) == 0) || *var->sqlind != -1){
! if (var->sqlscale) {
! int j, f = 1;
! float n;
! n = *(long *)(var->sqldata);
! for (j = 0; j < -var->sqlscale; j++)
! f *= 10;
! n /= f;
! collen = sprintf(string_data, "%.*f", -var->sqlscale, n);
! add_get_index_stringl(return_value, i, string_data, collen, (void **) &result_arg, 1);
! } else {
! add_get_index_long(return_value, i, *(long *)(var->sqldata), (void **) &result_arg);
! }
! _php3_hash_pointer_update(return_value->value.ht, var->aliasname,
var->aliasname_length+1, result_arg);
! }
! break;
! case SQL_FLOAT:
! if (((var->sqltype & 1) == 0) || *var->sqlind != -1){
! add_get_index_double(return_value, i, *(float *)(var->sqldata), (void **)
&result_arg);
! _php3_hash_pointer_update(return_value->value.ht, var->aliasname,
var->aliasname_length+1, result_arg);
! }
! break;
! case SQL_DOUBLE:
! if (((var->sqltype & 1) == 0) || *var->sqlind != -1){
! if (var->sqlscale) {
! collen = sprintf(string_data, "%.*f", -var->sqlscale, *(double
*)(var->sqldata));
! add_get_index_stringl(return_value, i, string_data, collen, (void **) &result_arg, 1);
! } else {
! add_get_index_double(return_value, i, *(double *)(var->sqldata), (void **)
&result_arg);
! }
! _php3_hash_pointer_update(return_value->value.ht, var->aliasname,
var->aliasname_length+1, result_arg);
! }
! break;
! case SQL_DATE:
! if (((var->sqltype & 1) == 0) || *var->sqlind != -1){
!
! struct tm t;
!
! isc_decode_date((ISC_QUAD *) var->sqldata, &t);
! t.tm_zone = "none"; /* timezone in database ? */
!
! #if HAVE_STRFTIME
! collen = (int) strftime(string_data, 255, IBASE_GLOBAL(php3_ibase_module).timeformat,
&t);
! #else
! if(!t.tm_hour && !t.tm_min && !t.tm_sec)
! collen = sprintf(string_data, "%02d/%02d/%4d", t.tm_mon+1, t.tm_mday,
t.tm_year+1900);
! else
! collen = sprintf(string_data, "%02d/%02d/%4d %02d:%02d:%02d",
! t.tm_mon+1, t.tm_mday, t.tm_year+1900, t.tm_hour, t.tm_min, t.tm_sec);
! #endif
! add_get_index_stringl(return_value, i, string_data, collen, (void **) &result_arg, 1);
! _php3_hash_pointer_update(return_value->value.ht, var->aliasname,
var->aliasname_length+1, result_arg);
! }
! break;
! case SQL_BLOB:
! if(blobchar){ /* text ? */
! if (((var->sqltype & 1) == 0) || *var->sqlind != -1){
! int stat;
isc_blob_handle bl_handle = NULL;
ISC_LONG max_len = 0, cur_len = 0;
char bl_items[1], *bl_data, bl_info[20], *p;
!
! if(isc_open_blob(status, &ib_result->link, &ib_result->trans, &bl_handle,
(ISC_QUAD ISC_FAR *) var->sqldata)){
! _php3_ibase_error(status);
RETURN_FALSE;
}
!
bl_items[0] = isc_info_blob_total_length;
! if(isc_blob_info(status,&bl_handle,sizeof(bl_items),bl_items,sizeof(bl_info),bl_info)){
! _php3_ibase_error(status);
RETURN_FALSE;
}
/* find total length of blob's data */
for (p = bl_info; *p != isc_info_end && p < bl_info+sizeof(bl_info);){
int item_len, item = *p++;
--- 1589,1666 ----
}
break;
case 2:
! if(ARG_COUNT(ht)==2 && getParameters(ht, 2, &result_arg, &flag_arg)==FAILURE) {
RETURN_FALSE;
}
! convert_to_long(flag_arg);
! flag = flag_arg->value.lval;
break;
default:
WRONG_PARAM_COUNT;
break;
}
convert_to_long(result_arg);
!
GET_RESULT(result_arg->value.lval, ib_result);
!
if (ib_result->out_sqlda == NULL) {
! _php3_ibase_module_error("trying to fetch results from a non-select query");
RETURN_FALSE;
}
!
! if(isc_dsql_fetch(IB_STATUS, &ib_result->stmt, 1, ib_result->out_sqlda) == 100L){
RETURN_FALSE; /* end of cursor */
}
! if(IB_STATUS[0] && IB_STATUS[1]){ /* error in fetch */
! _php3_ibase_error();
RETURN_FALSE;
}
! if(fetch_type == FETCH_ARRAY){
! if (array_init(return_value)==FAILURE) {
! RETURN_FALSE;
! }
! }else if(fetch_type == FETCH_OBJECT){
! if (object_init(return_value)==FAILURE) {
! RETURN_FALSE;
! }
}
!
! arr_cnt = 0;
var = ib_result->out_sqlda->sqlvar;
for (i = 0; i < ib_result->out_sqlda->sqld; i++, var++) {
! pval tmp;
! if (((var->sqltype & 1) == 0) || *var->sqlind != -1){
! switch(var->sqltype & ~1) {
! case SQL_VARYING:
! case SQL_TEXT:
! case SQL_SHORT:
! case SQL_LONG:
! case SQL_FLOAT:
! case SQL_DOUBLE:
! case SQL_DATE:
! _php3_ibase_var_pval(&tmp, var->sqldata, var->sqltype, var->sqllen,
var->sqlscale, flag);
! break;
! case SQL_BLOB:
! if(flag & PHP3_IBASE_TEXT){ /* text ? */
! int stat;
isc_blob_handle bl_handle = NULL;
ISC_LONG max_len = 0, cur_len = 0;
char bl_items[1], *bl_data, bl_info[20], *p;
!
! if(isc_open_blob(IB_STATUS, &ib_result->link, &ib_result->trans,
&bl_handle, (ISC_QUAD ISC_FAR *) var->sqldata)){
! _php3_ibase_error();
RETURN_FALSE;
}
!
bl_items[0] = isc_info_blob_total_length;
!
if(isc_blob_info(IB_STATUS,&bl_handle,sizeof(bl_items),bl_items,sizeof(bl_info),bl_info)){
! _php3_ibase_error();
RETURN_FALSE;
}
+
/* find total length of blob's data */
for (p = bl_info; *p != isc_info_end && p < bl_info+sizeof(bl_info);){
int item_len, item = *p++;
***************
*** 1485,1574 ****
max_len = isc_vax_integer(p, item_len);
p += item_len;
}
!
bl_data = emalloc(max_len+1);
!
for(cur_len = stat = 0; stat == 0 && cur_len < max_len; ){
unsigned short seg_len, max_seg = max_len-cur_len > USHRT_MAX ? USHRT_MAX :
max_len-cur_len;
! stat = isc_get_segment(status, &bl_handle, &seg_len, max_seg,
&bl_data[cur_len]);
cur_len += seg_len;
if(cur_len > max_len){ /* never!*/
efree(bl_data);
! _php3_module_error("php module internal error in %s %d",__FILE__,__LINE__);
RETURN_FALSE;
}
}
!
! if (status[0] && status[1] && (status[1] != isc_segstr_eof)){
efree(bl_data);
! _php3_ibase_error(status);
RETURN_FALSE;
}
bl_data[cur_len] = '\0';
! if(isc_close_blob(status, &bl_handle)){
efree(bl_data);
! _php3_ibase_error(status);
! RETURN_FALSE;
}
! add_get_index_stringl(return_value, i, bl_data, cur_len, (void **) &result_arg, 0);
! _php3_hash_pointer_update(return_value->value.ht, var->aliasname,
var->aliasname_length+1, result_arg);
! } /* if not null */
! }else{ /* blob id only */
! ISC_QUAD *bl_qd = (ISC_QUAD ISC_FAR *) var->sqldata;
! ibase_blob_handle ib_blob_id;
!
! ib_blob_id.link = ib_result->link;
! ib_blob_id.trans_handle = ib_result->trans;
! ib_blob_id.bl_qd.gds_quad_high = bl_qd->gds_quad_high;
! ib_blob_id.bl_qd.gds_quad_low = bl_qd->gds_quad_low;
! ib_blob_id.bl_handle = NULL;
! add_get_index_stringl(return_value, i, (char *)&ib_blob_id, sizeof(ibase_blob_handle),
(void **) &result_arg, 1);
! _php3_hash_pointer_update(return_value->value.ht, var->aliasname,
var->aliasname_length+1, result_arg);
! }
! break;
! case SQL_ARRAY:
! {
! /* TODO, currently just show the id */
! ISC_QUAD bid;
! bid = *(ISC_QUAD ISC_FAR *) var->sqldata;
! sprintf(string_data, "%lx:%lx", bid.isc_quad_high, bid.isc_quad_low);
! add_get_index_stringl(return_value, i, string_data, collen, (void **) &result_arg, 1);
! _php3_hash_pointer_update(return_value->value.ht, var->aliasname,
var->aliasname_length+1, result_arg);
}
- break;
- default:
break;
! }/*switch*/
}/*for field*/
}
/* }}} */
! /* {{{ proto array ibase_fetch_row(int result [,blob_flag]) */ /*fold00*/
/* Fetch a row from the results of a query. */
! void php3_ibase_fetch_row(INTERNAL_FUNCTION_PARAMETERS)
{
! _php3_ibase_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU);
}
/* }}} */
! /* {{{ proto object ibase_fetch_object(int result [,blob_flag]) */ /*fold00*/
/* Fetch a object from the results of a query. */
! void php3_ibase_fetch_object(INTERNAL_FUNCTION_PARAMETERS)
{
! _php3_ibase_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU);
! if (return_value->type==IS_ARRAY) {
! return_value->type = IS_OBJECT;
! }
}
/* }}} */
! /* {{{ proto int ibase_free_result(int result) */ /*fold00*/
/* Free the memory used by a result. */
! void php3_ibase_free_result(INTERNAL_FUNCTION_PARAMETERS)
{
pval *result_arg;
ibase_result *ib_result;
--- 1670,1779 ----
max_len = isc_vax_integer(p, item_len);
p += item_len;
}
!
bl_data = emalloc(max_len+1);
!
for(cur_len = stat = 0; stat == 0 && cur_len < max_len; ){
unsigned short seg_len, max_seg = max_len-cur_len > USHRT_MAX ? USHRT_MAX :
max_len-cur_len;
! stat = isc_get_segment(IB_STATUS, &bl_handle, &seg_len, max_seg,
&bl_data[cur_len]);
cur_len += seg_len;
if(cur_len > max_len){ /* never!*/
efree(bl_data);
! _php3_ibase_module_error("php module internal error in %s
%d",__FILE__,__LINE__);
RETURN_FALSE;
}
}
!
! if (IB_STATUS[0] && IB_STATUS[1] && (IB_STATUS[1] != isc_segstr_eof)){
efree(bl_data);
! _php3_ibase_error();
RETURN_FALSE;
}
bl_data[cur_len] = '\0';
! if(isc_close_blob(IB_STATUS, &bl_handle)){
efree(bl_data);
! _php3_ibase_error();
! RETURN_FALSE;
}
! tmp.type = IS_STRING;
! tmp.value.str.len = cur_len;
! tmp.value.str.val = bl_data;
! }else{ /* blob id only */
! ISC_QUAD *bl_qd = (ISC_QUAD ISC_FAR *) var->sqldata;
! ibase_blob_handle *ib_blob_id;
!
! ib_blob_id = (ibase_blob_handle *) emalloc(sizeof(ibase_blob_handle));
!
! ib_blob_id->link = ib_result->link;
! ib_blob_id->trans_handle = ib_result->trans;
! ib_blob_id->bl_qd.gds_quad_high = bl_qd->gds_quad_high;
! ib_blob_id->bl_qd.gds_quad_low = bl_qd->gds_quad_low;
! ib_blob_id->bl_handle = NULL;
!
! tmp.type = IS_STRING;
! tmp.value.str.len = sizeof(ibase_blob_handle);
! tmp.value.str.val = (char *)ib_blob_id;
! }
! break;
! case SQL_ARRAY:{
! ISC_QUAD ar_qd = *(ISC_QUAD ISC_FAR *) var->sqldata;
! ibase_array *ib_array = &ib_result->out_array[arr_cnt];
! void *ar_data;
! char *tmp_ptr;
! ar_data = emalloc(ib_array->ar_size);
!
! if (isc_array_get_slice(IB_STATUS, &ib_result->link, &ib_result->trans,
! &ar_qd, &ib_array->ar_desc, ar_data, &ib_array->ar_size)){
! _php3_ibase_error();
! RETURN_FALSE;
! }
!
! tmp_ptr = ar_data; /* avoid changes in _arr_pval */
! if(_php3_ibase_arr_pval(&tmp, &tmp_ptr, ib_array, 0, flag) == FAILURE){
! RETURN_FALSE;
! }
! efree(ar_data);
}
break;
! default:
! break;
! }/*switch*/
! if (fetch_type & FETCH_ARRAY) {
! _php3_hash_index_update(return_value->value.ht, i, (void *) &tmp, sizeof(pval),NULL);
! }else{
! _php3_hash_update(return_value->value.ht, var->aliasname, var->aliasname_length+1,
(void *) &tmp, sizeof(pval), NULL);
! }
! }/* if not null */
! if((var->sqltype & ~1) == SQL_ARRAY){
! arr_cnt++;
! }
}/*for field*/
}
/* }}} */
! /* {{{ proto array ibase_fetch_row(int result [,blob_flag]) */
/* Fetch a row from the results of a query. */
! PHP_FUNCTION(ibase_fetch_row)
{
! _php3_ibase_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, FETCH_ARRAY);
}
/* }}} */
! /* {{{ proto object ibase_fetch_object(int result [,blob_flag]) */
/* Fetch a object from the results of a query. */
! PHP_FUNCTION(ibase_fetch_object)
{
! _php3_ibase_fetch_hash(INTERNAL_FUNCTION_PARAM_PASSTHRU, FETCH_OBJECT);
}
/* }}} */
! /* {{{ proto int ibase_free_result(int result) */
/* Free the memory used by a result. */
! PHP_FUNCTION(ibase_free_result)
{
pval *result_arg;
ibase_result *ib_result;
***************
*** 1593,1601 ****
/* }}} */
! /* {{{ proto int ibase_prepare([int link_identifier, ]string query) */ /*fold00*/
/* Prepare a query for later execution. */
! void php3_ibase_prepare(INTERNAL_FUNCTION_PARAMETERS)
{
pval *link_arg, *query_arg;
int link_id, trans_n = 0;
--- 1798,1806 ----
/* }}} */
! /* {{{ proto int ibase_prepare([int link_identifier, ]string query) */
/* Prepare a query for later execution. */
! PHP_FUNCTION(ibase_prepare)
{
pval *link_arg, *query_arg;
int link_id, trans_n = 0;
***************
*** 1603,1608 ****
--- 1808,1814 ----
ibase_query *ib_query;
char *query;
IBASE_TLS_VARS;
+
RESET_ERRMSG;
***************
*** 1644,1657 ****
/* }}} */
! /* {{{ proto int ibase_execute(int query [,bind_args ... ]) */ /*fold00*/
/* Execute a previously prepared query. */
! void php3_ibase_execute(INTERNAL_FUNCTION_PARAMETERS)
{
pval **args, **bind_args = NULL;
ibase_query *ib_query;
ibase_result *ib_result;
IBASE_TLS_VARS;
RESET_ERRMSG;
--- 1850,1864 ----
/* }}} */
! /* {{{ proto int ibase_execute(int query [,bind_args ... ]) */
/* Execute a previously prepared query. */
! PHP_FUNCTION(ibase_execute)
{
pval **args, **bind_args = NULL;
ibase_query *ib_query;
ibase_result *ib_result;
IBASE_TLS_VARS;
+
RESET_ERRMSG;
***************
*** 1687,1699 ****
/* }}} */
! /* {{{ proto int ibase_free_query(int query) */ /*fold00*/
/* Free memory used by a query */
! void php3_ibase_free_query(INTERNAL_FUNCTION_PARAMETERS)
{
pval *query_arg;
ibase_query *ib_query;
IBASE_TLS_VARS;
RESET_ERRMSG;
--- 1894,1907 ----
/* }}} */
! /* {{{ proto int ibase_free_query(int query) */
/* Free memory used by a query */
! PHP_FUNCTION(ibase_free_query)
{
pval *query_arg;
ibase_query *ib_query;
IBASE_TLS_VARS;
+
RESET_ERRMSG;
***************
*** 1711,1722 ****
/* }}} */
! /* {{{ proto int ibase_timefmt(string format) */ /*fold00*/
/* Sets the format of datetime columns returned from queries. Still nonfunctional. */
! void php3_ibase_timefmt(INTERNAL_FUNCTION_PARAMETERS)
{
pval *fmt;
IBASE_TLS_VARS;
RESET_ERRMSG;
--- 1919,1931 ----
/* }}} */
! /* {{{ proto int ibase_timefmt(string format) */
/* Sets the format of datetime columns returned from queries. Still nonfunctional. */
! PHP_FUNCTION(ibase_timefmt)
{
pval *fmt;
IBASE_TLS_VARS;
+
RESET_ERRMSG;
***************
*** 1729,1748 ****
IBASE_GLOBAL(php3_ibase_module).timeformat = estrdup(fmt->value.str.val);
RETURN_TRUE;
#else
! _php3_module_error("ibase_timefmt not supported on this platform");
RETURN_FALSE;
#endif
}
/* }}} */
! /* {{{ proto int ibase_num_fields(int result) */ /*fold00*/
/* Get the number of fields in result */
! void php3_ibase_num_fields(INTERNAL_FUNCTION_PARAMETERS)
{
pval *result;
int type;
ibase_result *ib_result;
RESET_ERRMSG;
--- 1938,1958 ----
IBASE_GLOBAL(php3_ibase_module).timeformat = estrdup(fmt->value.str.val);
RETURN_TRUE;
#else
! _php3_ibase_module_error("ibase_timefmt not supported on this platform");
RETURN_FALSE;
#endif
}
/* }}} */
! /* {{{ proto int ibase_num_fields(int result) */
/* Get the number of fields in result */
! PHP_FUNCTION(ibase_num_fields)
{
pval *result;
int type;
ibase_result *ib_result;
+
RESET_ERRMSG;
***************
*** 1754,1765 ****
ib_result = (ibase_result *) php3_list_find(result->value.lval, &type);
if (type!=IBASE_GLOBAL(php3_ibase_module).le_result) {
! _php3_module_error("%d is not result index", result->value.lval);
RETURN_FALSE;
}
if (ib_result->out_sqlda == NULL) {
! _php3_module_error("trying to get num fields from a non-select query");
RETURN_FALSE;
}
--- 1964,1975 ----
ib_result = (ibase_result *) php3_list_find(result->value.lval, &type);
if (type!=IBASE_GLOBAL(php3_ibase_module).le_result) {
! _php3_ibase_module_error("%d is not result index", result->value.lval);
RETURN_FALSE;
}
if (ib_result->out_sqlda == NULL) {
! _php3_ibase_module_error("trying to get num fields from a non-select query");
RETURN_FALSE;
}
***************
*** 1768,1776 ****
/* }}} */
! /* {{{ proto array ibase_field_info(int result, int field_number) */ /*fold00*/
/* Get information about a field */
! void php3_ibase_field_info(INTERNAL_FUNCTION_PARAMETERS)
{
pval *ret_val, *result_arg, *field_arg;
ibase_result *ib_result;
--- 1978,1986 ----
/* }}} */
! /* {{{ proto array ibase_field_info(int result, int field_number) */
/* Get information about a field */
! PHP_FUNCTION(ibase_field_info)
{
pval *ret_val, *result_arg, *field_arg;
ibase_result *ib_result;
***************
*** 1778,1783 ****
--- 1988,1994 ----
int len;
XSQLVAR *var;
IBASE_TLS_VARS;
+
RESET_ERRMSG;
***************
*** 1790,1796 ****
GET_RESULT(result_arg->value.lval, ib_result);
if (ib_result->out_sqlda == NULL) {
! _php3_module_error("trying to get field info from a non-select query");
RETURN_FALSE;
}
--- 2001,2007 ----
GET_RESULT(result_arg->value.lval, ib_result);
if (ib_result->out_sqlda == NULL) {
! _php3_ibase_module_error("trying to get field info from a non-select query");
RETURN_FALSE;
}
***************
*** 1844,1853 ****
/* blobs ----------------------------------- */
! /* {{{ _php3_ibase_blob_info(isc_blob_handle bl_handle,IBASE_BLOBINFO *bl_info) */ /*fold00*/
static int _php3_ibase_blob_info(isc_blob_handle bl_handle,IBASE_BLOBINFO *bl_info)
{
- ISC_STATUS status[20];
static char bl_items[] = {
isc_info_blob_num_segments,
--- 2055,2063 ----
/* blobs ----------------------------------- */
! /* {{{ _php3_ibase_blob_info(isc_blob_handle bl_handle,IBASE_BLOBINFO *bl_info) */
static int _php3_ibase_blob_info(isc_blob_handle bl_handle,IBASE_BLOBINFO *bl_info)
{
static char bl_items[] = {
isc_info_blob_num_segments,
***************
*** 1857,1870 ****
};
char bl_inf[sizeof(long)*8], *p;
bl_info->max_segment = 0;
bl_info->num_segments = 0;
bl_info->total_length = 0;
bl_info->bl_stream = 0;
! if(isc_blob_info(status,&bl_handle,sizeof(bl_items),bl_items,sizeof(bl_inf),bl_inf)){
! _php3_ibase_error(status);
return FAILURE;
}
--- 2067,2081 ----
};
char bl_inf[sizeof(long)*8], *p;
+
bl_info->max_segment = 0;
bl_info->num_segments = 0;
bl_info->total_length = 0;
bl_info->bl_stream = 0;
! if(isc_blob_info(IB_STATUS,&bl_handle,sizeof(bl_items),bl_items,sizeof(bl_inf),bl_inf)){
! _php3_ibase_error();
return FAILURE;
}
***************
*** 1889,1895 ****
break;
case isc_info_truncated:
case isc_info_error: /* hmm. don't think so...*/
! _php3_ibase_error(status);
return FAILURE;
}/*switch*/
p += item_len;
--- 2100,2106 ----
break;
case isc_info_truncated:
case isc_info_error: /* hmm. don't think so...*/
! _php3_ibase_module_error("php module internal error in %s %d",__FILE__,__LINE__);
return FAILURE;
}/*switch*/
p += item_len;
***************
*** 1899,1914 ****
/* }}} */
! /* {{{ proto int ibase_blob_create([int link_identifier]) */ /*fold00*/
/* Create blob for adding data */
! void php3_ibase_blob_create(INTERNAL_FUNCTION_PARAMETERS)
{
pval *link_arg;
int trans_n, link_id = 0;
- ISC_STATUS status[20];
ibase_db_link *ib_link;
ibase_blob_handle *ib_blob;
IBASE_TLS_VARS;
RESET_ERRMSG;
--- 2110,2125 ----
/* }}} */
! /* {{{ proto int ibase_blob_create([int link_identifier]) */
/* Create blob for adding data */
! PHP_FUNCTION(ibase_blob_create)
{
pval *link_arg;
int trans_n, link_id = 0;
ibase_db_link *ib_link;
ibase_blob_handle *ib_blob;
IBASE_TLS_VARS;
+
RESET_ERRMSG;
***************
*** 1940,1948 ****
ib_blob->link = ib_link->link;
ib_blob->bl_handle = NULL;
! if (isc_create_blob(status, &ib_blob->link, &ib_blob->trans_handle,
&ib_blob->bl_handle,&ib_blob->bl_qd)){
efree(ib_blob);
! _php3_ibase_error(status);
RETURN_FALSE;
}
--- 2151,2159 ----
ib_blob->link = ib_link->link;
ib_blob->bl_handle = NULL;
! if (isc_create_blob(IB_STATUS, &ib_blob->link, &ib_blob->trans_handle,
&ib_blob->bl_handle,&ib_blob->bl_qd)){
efree(ib_blob);
! _php3_ibase_error();
RETURN_FALSE;
}
***************
*** 1951,1964 ****
/* }}} */
! /* {{{ proto int ibase_blob_open(string blob_id) */ /*fold00*/
/* Open blob for retriving data parts */
! void php3_ibase_blob_open(INTERNAL_FUNCTION_PARAMETERS)
{
pval *blob_arg;
- ISC_STATUS status[20];
ibase_blob_handle *ib_blob, *ib_blob_id;
IBASE_TLS_VARS;
RESET_ERRMSG;
--- 2162,2175 ----
/* }}} */
! /* {{{ proto int ibase_blob_open(string blob_id) */
/* Open blob for retriving data parts */
! PHP_FUNCTION(ibase_blob_open)
{
pval *blob_arg;
ibase_blob_handle *ib_blob, *ib_blob_id;
IBASE_TLS_VARS;
+
RESET_ERRMSG;
***************
*** 1970,2003 ****
GET_BLOB_ID_ARG(blob_arg,ib_blob_id);
ib_blob->link = ib_blob_id->link;
ib_blob->trans_handle = ib_blob_id->trans_handle;
ib_blob->bl_qd.gds_quad_high = ib_blob_id->bl_qd.gds_quad_high;
ib_blob->bl_qd.gds_quad_low = ib_blob_id->bl_qd.gds_quad_low;
ib_blob->bl_handle = NULL;
!
! if(ib_blob->bl_qd.gds_quad_high || ib_blob->bl_qd.gds_quad_low){ /*not null ?*/
! if (isc_open_blob(status, &ib_blob->link, &ib_blob->trans_handle,
&ib_blob->bl_handle, &ib_blob->bl_qd)){
! efree(ib_blob);
! _php3_ibase_error(status);
! RETURN_FALSE;
! }
}
!
RETURN_LONG(php3_list_insert(ib_blob, IBASE_GLOBAL(php3_ibase_module).le_blob));
}
/* }}} */
! /* {{{ proto int ibase_blob_add(int blob_id, string data) */ /*fold00*/
/* Add data into created blob */
! void php3_ibase_blob_add(INTERNAL_FUNCTION_PARAMETERS)
{
pval *blob_arg,*string_arg;
- ISC_STATUS status[20];
ibase_blob_handle *ib_blob;
IBASE_TLS_VARS;
RESET_ERRMSG;
if (ARG_COUNT(ht)!=2 || getParameters(ht, 2, &blob_arg, &string_arg)==FAILURE) {
--- 2181,2215 ----
GET_BLOB_ID_ARG(blob_arg,ib_blob_id);
+ if(ib_blob_id == NULL){ /* blob IS NULL or argument unset */
+ RETURN_FALSE;
+ }
+
ib_blob->link = ib_blob_id->link;
ib_blob->trans_handle = ib_blob_id->trans_handle;
ib_blob->bl_qd.gds_quad_high = ib_blob_id->bl_qd.gds_quad_high;
ib_blob->bl_qd.gds_quad_low = ib_blob_id->bl_qd.gds_quad_low;
ib_blob->bl_handle = NULL;
! if (isc_open_blob(IB_STATUS, &ib_blob->link, &ib_blob->trans_handle,
&ib_blob->bl_handle, &ib_blob->bl_qd)){
! efree(ib_blob);
! _php3_ibase_error();
! RETURN_FALSE;
}
!
RETURN_LONG(php3_list_insert(ib_blob, IBASE_GLOBAL(php3_ibase_module).le_blob));
}
/* }}} */
! /* {{{ proto int ibase_blob_add(int blob_id, string data) */
/* Add data into created blob */
! PHP_FUNCTION(ibase_blob_add)
{
pval *blob_arg,*string_arg;
ibase_blob_handle *ib_blob;
IBASE_TLS_VARS;
+
RESET_ERRMSG;
if (ARG_COUNT(ht)!=2 || getParameters(ht, 2, &blob_arg, &string_arg)==FAILURE) {
***************
*** 2008,2015 ****
convert_to_string(string_arg);
! if (isc_put_segment(status, &ib_blob->bl_handle, string_arg->value.str.len,
string_arg->value.str.val)){
! _php3_ibase_error(status);
RETURN_FALSE;
}
RETURN_TRUE;
--- 2220,2227 ----
convert_to_string(string_arg);
! if (isc_put_segment(IB_STATUS, &ib_blob->bl_handle, string_arg->value.str.len,
string_arg->value.str.val)){
! _php3_ibase_error();
RETURN_FALSE;
}
RETURN_TRUE;
***************
*** 2017,2034 ****
/* }}} */
! /* {{{ proto string ibase_blob_get(int blob_id, int len) */ /*fold00*/
/* Get len bytes data from open blob */
! void php3_ibase_blob_get(INTERNAL_FUNCTION_PARAMETERS)
{
pval *blob_arg, *len_arg;
int stat;
char *bl_data;
unsigned short max_len = 0, cur_len, seg_len;
- ISC_STATUS status[20];
ibase_blob_handle *ib_blob;
IBASE_TLS_VARS;
RESET_ERRMSG;
if(ARG_COUNT(ht) != 2 || getParameters(ht, 2, &blob_arg, &len_arg) == FAILURE) {
--- 2229,2246 ----
/* }}} */
! /* {{{ proto string ibase_blob_get(int blob_id, int len) */
/* Get len bytes data from open blob */
! PHP_FUNCTION(ibase_blob_get)
{
pval *blob_arg, *len_arg;
int stat;
char *bl_data;
unsigned short max_len = 0, cur_len, seg_len;
ibase_blob_handle *ib_blob;
IBASE_TLS_VARS;
+
RESET_ERRMSG;
if(ARG_COUNT(ht) != 2 || getParameters(ht, 2, &blob_arg, &len_arg) == FAILURE) {
***************
*** 2045,2063 ****
bl_data = emalloc(max_len+1);
for(cur_len = stat = 0; stat == 0; ){
! stat = isc_get_segment(status, &ib_blob->bl_handle, &seg_len, max_len-cur_len,
&bl_data[cur_len]);
cur_len += seg_len;
if(cur_len > max_len){ /* never!*/
efree(bl_data);
! _php3_module_error("php module internal error in %s %d",__FILE__,__LINE__);
RETURN_FALSE;
}
}
bl_data[cur_len] = '\0';
! if (status[0] && (status[1] != isc_segstr_eof && status[1] != isc_segment)){
efree(bl_data);
! _php3_ibase_error(status);
RETURN_FALSE;
}
RETURN_STRINGL(bl_data,cur_len,0);
--- 2257,2275 ----
bl_data = emalloc(max_len+1);
for(cur_len = stat = 0; stat == 0; ){
! stat = isc_get_segment(IB_STATUS, &ib_blob->bl_handle, &seg_len, max_len-cur_len,
&bl_data[cur_len]);
cur_len += seg_len;
if(cur_len > max_len){ /* never!*/
efree(bl_data);
! _php3_ibase_module_error("php module internal error in %s %d",__FILE__,__LINE__);
RETURN_FALSE;
}
}
bl_data[cur_len] = '\0';
! if (IB_STATUS[0] && (IB_STATUS[1] != isc_segstr_eof && IB_STATUS[1] !=
isc_segment)){
efree(bl_data);
! _php3_ibase_error();
RETURN_FALSE;
}
RETURN_STRINGL(bl_data,cur_len,0);
***************
*** 2071,2085 ****
#define BLOB_CLOSE 1
#define BLOB_CANCEL 2
! /* {{{ _php3_ibase_blob_end() */ /*fold00*/
/* Close or Cancel created or Close open blob */
static void _php3_ibase_blob_end(INTERNAL_FUNCTION_PARAMETERS, int bl_end)
{
pval *blob_arg;
- ISC_STATUS status[20];
ibase_blob_handle *ib_blob;
IBASE_TLS_VARS;
RESET_ERRMSG;
if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &blob_arg)==FAILURE) {
--- 2283,2297 ----
#define BLOB_CLOSE 1
#define BLOB_CANCEL 2
! /* {{{ _php3_ibase_blob_end() */
/* Close or Cancel created or Close open blob */
static void _php3_ibase_blob_end(INTERNAL_FUNCTION_PARAMETERS, int bl_end)
{
pval *blob_arg;
ibase_blob_handle *ib_blob;
IBASE_TLS_VARS;
+
RESET_ERRMSG;
if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &blob_arg)==FAILURE) {
***************
*** 2090,2097 ****
if(bl_end == BLOB_CLOSE){ /* return id here */
if(ib_blob->bl_qd.gds_quad_high || ib_blob->bl_qd.gds_quad_low){ /*not null ?*/
! if (isc_close_blob(status, &ib_blob->bl_handle)){
! _php3_ibase_error(status);
RETURN_FALSE;
}
}
--- 2302,2309 ----
if(bl_end == BLOB_CLOSE){ /* return id here */
if(ib_blob->bl_qd.gds_quad_high || ib_blob->bl_qd.gds_quad_low){ /*not null ?*/
! if (isc_close_blob(IB_STATUS, &ib_blob->bl_handle)){
! _php3_ibase_error();
RETURN_FALSE;
}
}
***************
*** 2099,2106 ****
RETVAL_STRINGL((char *)ib_blob, sizeof(ibase_blob_handle), 1);
php3_list_delete(blob_arg->value.lval);
}else{ /* discard created blob */
! if (isc_cancel_blob(status, &ib_blob->bl_handle)){
! _php3_ibase_error(status);
RETURN_FALSE;
}
ib_blob->bl_handle = NULL;
--- 2311,2318 ----
RETVAL_STRINGL((char *)ib_blob, sizeof(ibase_blob_handle), 1);
php3_list_delete(blob_arg->value.lval);
}else{ /* discard created blob */
! if (isc_cancel_blob(IB_STATUS, &ib_blob->bl_handle)){
! _php3_ibase_error();
RETURN_FALSE;
}
ib_blob->bl_handle = NULL;
***************
*** 2111,2144 ****
/* }}} */
! /* {{{ proto int ibase_blob_close(int blob_id) */ /*fold00*/
/* Close blob */
! void php3_ibase_blob_close(INTERNAL_FUNCTION_PARAMETERS)
{
_php3_ibase_blob_end(INTERNAL_FUNCTION_PARAM_PASSTHRU,BLOB_CLOSE);
}
/* }}} */
! /* {{{ proto int ibase_blob_cancel(int blob_id) */ /*fold00*/
/* Cancel creating blob */
! void php3_ibase_blob_cancel(INTERNAL_FUNCTION_PARAMETERS)
{
_php3_ibase_blob_end(INTERNAL_FUNCTION_PARAM_PASSTHRU,BLOB_CANCEL);
}
/* }}} */
! /* {{{ proto object ibase_blob_info(string blob_id_str) */ /*fold00*/
/* Return blob length and other useful info */
! void php3_ibase_blob_info(INTERNAL_FUNCTION_PARAMETERS)
{
pval *blob_arg, *result_var;
- ISC_STATUS status[20];
ibase_blob_handle *ib_blob_id;
IBASE_BLOBINFO bl_info;
IBASE_TLS_VARS;
RESET_ERRMSG;
if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &blob_arg)==FAILURE) {
--- 2323,2356 ----
/* }}} */
! /* {{{ proto int ibase_blob_close(int blob_id) */
/* Close blob */
! PHP_FUNCTION(ibase_blob_close)
{
_php3_ibase_blob_end(INTERNAL_FUNCTION_PARAM_PASSTHRU,BLOB_CLOSE);
}
/* }}} */
! /* {{{ proto int ibase_blob_cancel(int blob_id) */
/* Cancel creating blob */
! PHP_FUNCTION(ibase_blob_cancel)
{
_php3_ibase_blob_end(INTERNAL_FUNCTION_PARAM_PASSTHRU,BLOB_CANCEL);
}
/* }}} */
! /* {{{ proto object ibase_blob_info(string blob_id_str) */
/* Return blob length and other useful info */
! PHP_FUNCTION(ibase_blob_info)
{
pval *blob_arg, *result_var;
ibase_blob_handle *ib_blob_id;
IBASE_BLOBINFO bl_info;
IBASE_TLS_VARS;
+
RESET_ERRMSG;
if (ARG_COUNT(ht)!=1 || getParameters(ht, 1, &blob_arg)==FAILURE) {
***************
*** 2152,2168 ****
}
if(ib_blob_id->bl_qd.gds_quad_high || ib_blob_id->bl_qd.gds_quad_low){ /*not null ?*/
! if (isc_open_blob(status, &ib_blob_id->link, &ib_blob_id->trans_handle,
&ib_blob_id->bl_handle, &ib_blob_id->bl_qd)){
! _php3_ibase_error(status);
RETURN_FALSE;
}
if(_php3_ibase_blob_info(ib_blob_id->bl_handle,&bl_info)){
RETURN_FALSE;
}
! if(isc_close_blob(status, &ib_blob_id->bl_handle)){
! _php3_ibase_error(status);
RETURN_FALSE;
}
ib_blob_id->bl_handle = NULL;
--- 2364,2380 ----
}
if(ib_blob_id->bl_qd.gds_quad_high || ib_blob_id->bl_qd.gds_quad_low){ /*not null ?*/
! if (isc_open_blob(IB_STATUS, &ib_blob_id->link, &ib_blob_id->trans_handle,
&ib_blob_id->bl_handle, &ib_blob_id->bl_qd)){
! _php3_ibase_error();
RETURN_FALSE;
}
if(_php3_ibase_blob_info(ib_blob_id->bl_handle,&bl_info)){
RETURN_FALSE;
}
! if(isc_close_blob(IB_STATUS, &ib_blob_id->bl_handle)){
! _php3_ibase_error();
RETURN_FALSE;
}
ib_blob_id->bl_handle = NULL;
***************
*** 2194,2211 ****
/* }}} */
! /* {{{ proto int ibase_blob_echo(string blob_id_str) */ /*fold00*/
/* Output blob contents to browser */
! void php3_ibase_blob_echo(INTERNAL_FUNCTION_PARAMETERS)
{
pval *blob_arg;
char bl_data[IBASE_BLOB_SEG];
unsigned short seg_len;
- ISC_STATUS status[20];
ibase_blob_handle *ib_blob_id;
! ISC_QUAD bl_qd;
!
IBASE_TLS_VARS;
RESET_ERRMSG;
--- 2406,2421 ----
/* }}} */
! /* {{{ proto int ibase_blob_echo(string blob_id_str) */
/* Output blob contents to browser */
! PHP_FUNCTION(ibase_blob_echo)
{
pval *blob_arg;
char bl_data[IBASE_BLOB_SEG];
unsigned short seg_len;
ibase_blob_handle *ib_blob_id;
!
IBASE_TLS_VARS;
RESET_ERRMSG;
***************
*** 2214,2246 ****
WRONG_PARAM_COUNT;
}
- /* GET_BLOB_STR_ARG(blob_arg, link,trans_handle,bl_qd); */
GET_BLOB_ID_ARG(blob_arg, ib_blob_id);
if (!php3_header()) {
RETURN_FALSE;
}
! if(bl_qd.gds_quad_high || bl_qd.gds_quad_low){ /*not null ?*/
! if (isc_open_blob(status, &ib_blob_id->link, &ib_blob_id->trans_handle,
&ib_blob_id->bl_handle,&ib_blob_id->bl_qd)){
! _php3_ibase_error(status);
RETURN_FALSE;
}
! while(!isc_get_segment(status, &ib_blob_id->bl_handle, &seg_len, sizeof(bl_data),
bl_data)
! || status[1] == isc_segment){
PHPWRITE(bl_data,seg_len);
}
! if (status[0] && (status[1] != isc_segstr_eof)){
! _php3_ibase_error(status);
RETURN_FALSE;
}
! if (isc_close_blob(status, &ib_blob_id->bl_handle)){
! _php3_ibase_error(status);
RETURN_FALSE;
}
ib_blob_id->bl_handle = NULL;
--- 2424,2455 ----
WRONG_PARAM_COUNT;
}
GET_BLOB_ID_ARG(blob_arg, ib_blob_id);
if (!php3_header()) {
RETURN_FALSE;
}
! if(ib_blob_id){ /*not null ?*/
! if (isc_open_blob(IB_STATUS, &ib_blob_id->link, &ib_blob_id->trans_handle,
&ib_blob_id->bl_handle,&ib_blob_id->bl_qd)){
! _php3_ibase_error();
RETURN_FALSE;
}
! while(!isc_get_segment(IB_STATUS, &ib_blob_id->bl_handle, &seg_len, sizeof(bl_data),
bl_data)
! || IB_STATUS[1] == isc_segment){
PHPWRITE(bl_data,seg_len);
}
! if (IB_STATUS[0] && (IB_STATUS[1] != isc_segstr_eof)){
! _php3_ibase_error();
RETURN_FALSE;
}
! if (isc_close_blob(IB_STATUS, &ib_blob_id->bl_handle)){
! _php3_ibase_error();
RETURN_FALSE;
}
ib_blob_id->bl_handle = NULL;
***************
*** 2255,2274 ****
extern int le_fp,le_pp;
extern int wsa_fp;
! /* {{{ proto string ibase_blob_import([link_identifier, ] file_id) */ /*fold00*/
/* Create blob, copy file in it, and close it*/
! void php3_ibase_blob_import(INTERNAL_FUNCTION_PARAMETERS)
{
pval *link_arg, *file_arg;
int trans_n, type, link_id = 0, file_id, size, b;
int issock=0, socketd=0, *sock;
- ISC_STATUS status[20];
ibase_blob_handle ib_blob;
ibase_db_link *ib_link;
char bl_data[IBASE_BLOB_SEG]; /* FIXME? blob_seg_size parameter? */
FILE *fp;
IBASE_TLS_VARS;
RESET_ERRMSG;
switch (ARG_COUNT(ht)) {
--- 2464,2483 ----
extern int le_fp,le_pp;
extern int wsa_fp;
! /* {{{ proto string ibase_blob_import([link_identifier, ] file_id) */
/* Create blob, copy file in it, and close it*/
! PHP_FUNCTION(ibase_blob_import)
{
pval *link_arg, *file_arg;
int trans_n, type, link_id = 0, file_id, size, b;
int issock=0, socketd=0, *sock;
ibase_blob_handle ib_blob;
ibase_db_link *ib_link;
char bl_data[IBASE_BLOB_SEG]; /* FIXME? blob_seg_size parameter? */
FILE *fp;
IBASE_TLS_VARS;
+
RESET_ERRMSG;
switch (ARG_COUNT(ht)) {
***************
*** 2306,2312 ****
socketd =* sock;
}
if ((!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) && (!socketd ||
type!=GLOBAL(wsa_fp))) {
! _php3_module_error("Unable to find file identifier %d",file_id);
RETURN_FALSE;
}
--- 2515,2521 ----
socketd =* sock;
}
if ((!fp || (type!=GLOBAL(le_fp) && type!=GLOBAL(le_pp))) && (!socketd ||
type!=GLOBAL(wsa_fp))) {
! _php3_ibase_module_error("Unable to find file identifier %d",file_id);
RETURN_FALSE;
}
***************
*** 2316,2337 ****
ib_blob.bl_qd.gds_quad_high = 0;
ib_blob.bl_qd.gds_quad_low = 0;
! if (isc_create_blob(status, &ib_blob.link, &ib_blob.trans_handle,
&ib_blob.bl_handle,&ib_blob.bl_qd)){
! _php3_ibase_error(status);
RETURN_FALSE;
}
size = 0;
while(issock?(b=SOCK_FGETS(bl_data,sizeof(bl_data),socketd)):(b = fread(bl_data, 1,
sizeof(bl_data), fp)) > 0) {
! if (isc_put_segment(status, &ib_blob.bl_handle, b, bl_data)){
! _php3_ibase_error(status);
RETURN_FALSE;
}
size += b ;
}
! if (isc_close_blob(status, &ib_blob.bl_handle)){
! _php3_ibase_error(status);
RETURN_FALSE;
}
--- 2525,2546 ----
ib_blob.bl_qd.gds_quad_high = 0;
ib_blob.bl_qd.gds_quad_low = 0;
! if (isc_create_blob(IB_STATUS, &ib_blob.link, &ib_blob.trans_handle,
&ib_blob.bl_handle,&ib_blob.bl_qd)){
! _php3_ibase_error();
RETURN_FALSE;
}
size = 0;
while(issock?(b=SOCK_FGETS(bl_data,sizeof(bl_data),socketd)):(b = fread(bl_data, 1,
sizeof(bl_data), fp)) > 0) {
! if (isc_put_segment(IB_STATUS, &ib_blob.bl_handle, b, bl_data)){
! _php3_ibase_error();
RETURN_FALSE;
}
size += b ;
}
! if (isc_close_blob(IB_STATUS, &ib_blob.bl_handle)){
! _php3_ibase_error();
RETURN_FALSE;
}
***************
*** 2352,2355 ****
* c-basic-offset: 4
* End:
*/
!
--- 2561,2564 ----
* c-basic-offset: 4
* End:
*/
!
Index: php3/functions/php3_interbase.h
diff -c php3/functions/php3_interbase.h:1.6 php3/functions/php3_interbase.h:1.7
*** php3/functions/php3_interbase.h:1.6 Tue Mar 2 08:08:30 1999
--- php3/functions/php3_interbase.h Sat Mar 20 10:03:32 1999
***************
*** 28,34 ****
+----------------------------------------------------------------------+
*/
! /* $Id: php3_interbase.h,v 1.6 1999/03/02 13:08:30 andrew Exp $ */
#ifndef _PHP3_IBASE_H
#define _PHP3_IBASE_H
--- 28,34 ----
+----------------------------------------------------------------------+
*/
! /* $Id: php3_interbase.h,v 1.7 1999/03/20 15:03:32 andrew Exp $ */
#ifndef _PHP3_IBASE_H
#define _PHP3_IBASE_H
***************
*** 86,91 ****
--- 86,92 ----
#define IBASE_BLOB_SEG 4096
typedef struct {
+ ISC_STATUS status[20];
long default_link;
long num_links, num_persistent;
long max_links, max_persistent;
***************
*** 103,108 ****
--- 104,116 ----
} ibase_db_link;
typedef struct {
+ ISC_ARRAY_DESC ar_desc;
+ int el_type, /* sqltype kinda SQL_TEXT, ...*/
+ el_size; /* element size in bytes */
+ ISC_LONG ISC_FAR ar_size; /* all array size in bytes */
+ } ibase_array;
+
+ typedef struct {
isc_tr_handle trans_handle;
isc_db_handle link;
ISC_QUAD bl_qd;
***************
*** 114,119 ****
--- 122,129 ----
isc_tr_handle trans;
isc_stmt_handle stmt;
XSQLDA *in_sqlda, *out_sqlda;
+ ibase_array *in_array, *out_array;
+ int in_array_cnt, out_array_cnt;
} ibase_query;
typedef struct {
***************
*** 122,127 ****
--- 132,138 ----
isc_stmt_handle stmt;
int drop_stmt;
XSQLDA *out_sqlda;
+ ibase_array *out_array;
} ibase_result;
typedef struct _php3_ibase_varchar {
***************
*** 130,135 ****
--- 141,156 ----
} IBASE_VCHAR;
extern ibase_module php3_ibase_module;
+
+ enum php3_interbase_option {
+ PHP3_IBASE_DEFAULT = 0,
+ PHP3_IBASE_TEXT = 1,
+ PHP3_IBASE_TIMESTAMP = 2,
+ PHP3_IBASE_READ = 4,
+ PHP3_IBASE_COMMITED = 8,
+ PHP3_IBASE_CONSISTENCY = 16,
+ PHP3_IBASE_NOWAIT = 32
+ };
#else
--
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