static void _php_ibase_close_plink(zend_resource *rsrc) /* {{{ */ { ibase_db_link *link = (ibase_db_link *) rsrc->ptr; _php_ibase_commit_link(link); IBDEBUG("Closing permanent link..."); if (link->handle != 0) { isc_detach_database(IB_STATUS, &link->handle); } IBG(num_persistent)--; IBG(num_links)--; free(link); }
/* print php interbase module error and save it for ibase_errmsg() */ void _php_ibase_module_error(char *msg, ...) /* {{{ */ { va_list ap; va_start(ap, msg); /* vsnprintf NUL terminates the buf and writes at most n-1 chars+NUL */ vsnprintf(IBG(errmsg), MAX_ERRMSG, msg, ap); va_end(ap); IBG(sql_code) = -999; /* no SQL error */ php_error_docref(NULL, E_WARNING, "%s", IBG(errmsg)); }
/* print interbase error and save it for ibase_errmsg() */ void _php_ibase_error(void) /* {{{ */ { char *s = IBG(errmsg); const ISC_STATUS *statusp = IB_STATUS; IBG(sql_code) = isc_sqlcode(IB_STATUS); while ((s - IBG(errmsg)) < MAX_ERRMSG && fb_interpret(s, MAX_ERRMSG - strlen(IBG(errmsg)) - 1, &statusp)) { strcat(IBG(errmsg), " "); s = IBG(errmsg) + strlen(IBG(errmsg)); } php_error_docref(NULL, E_WARNING, "%s", IBG(errmsg)); }
/* print interbase error and save it for ibase_errmsg() */ void _php_ibase_error(TSRMLS_D) /* {{{ */ { char *s = IBG(errmsg); ISC_STATUS *statusp = IB_STATUS; IBG(sql_code) = isc_sqlcode(IB_STATUS); while ((s - IBG(errmsg)) < MAX_ERRMSG - (IBASE_MSGSIZE + 2) && isc_interprete(s, &statusp)) { strcat(IBG(errmsg), " "); s = IBG(errmsg) + strlen(IBG(errmsg)); } php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", IBG(errmsg)); }
{ va_list ap; #ifdef ZTS va_start(ap, TSRMLS_C); #else va_start(ap, msg); #endif /* vsnprintf NUL terminates the buf and writes at most n-1 chars+NUL */ vsnprintf(IBG(errmsg), MAX_ERRMSG, msg, ap); va_end(ap); IBG(sql_code) = -999; /* no SQL error */ php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", IBG(errmsg)); } /* }}} */ /* {{{ internal macros, functions and structures */ typedef struct { isc_db_handle *db_ptr; long tpb_len; char *tpb_ptr; } ISC_TEB; /* }}} */ /* Fill ib_link and trans with the correct database link and transaction. */ void _php_ibase_get_link_trans(INTERNAL_FUNCTION_PARAMETERS, /* {{{ */ zval *link_id, ibase_db_link **ib_link, ibase_trans **trans)