-L$FIREBIRD_LIBDIR
])
+ if test -f $prefix/include/php/ext/pdo/php_pdo_driver.h; then
+ pdo_inc_path=$prefix/include/php/ext
+ elif test -f $abs_srcdir/include/php/ext/pdo/php_pdo_driver.h; then
+ pdo_inc_path=$abs_srcdir/ext
+ elif test -f ext/pdo/php_pdo_driver.h; then
+ pdo_inc_path=ext
+ else
+ AC_MSG_ERROR([Cannot find php_pdo_driver.h.])
+ fi
+
PHP_ADD_LIBRARY_WITH_PATH($FIREBIRD_LIBNAME, $FIREBIRD_LIBDIR, PDO_FIREBIRD_SHARED_LIBADD)
PHP_ADD_INCLUDE($FIREBIRD_INCDIR)
AC_DEFINE(HAVE_PDO_FIREBIRD,1,[ ])
- PHP_NEW_EXTENSION(pdo_firebird, pdo_firebird.c firebird_driver.c firebird_statement.c, $ext_shared)
+ PHP_NEW_EXTENSION(pdo_firebird, pdo_firebird.c firebird_driver.c firebird_statement.c, $ext_shared,,-I$pdo_inc_path)
PHP_SUBST(PDO_FIREBIRD_SHARED_LIBADD)
fi
#include "config.h"
#endif
+#define _GNU_SOURCE
+
#include "php.h"
#include "php_ini.h"
#include "ext/standard/info.h"
#include "php_pdo_firebird.h"
#include "php_pdo_firebird_int.h"
-#define _GNU_SOURCE
-
/* map driver specific error message to PDO error */
void _firebird_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt, char const *file, long line TSRMLS_DC) /* {{{ */
{
pdo_firebird_db_handle *H = stmt ? ((pdo_firebird_stmt *)stmt->driver_data)->H
: (pdo_firebird_db_handle *)dbh->driver_data;
- long *error_code = stmt ? &stmt->error_code : &dbh->error_code;
+ enum pdo_error_type *error_code = stmt ? &stmt->error_code : &dbh->error_code;
switch (isc_sqlcode(H->isc_status)) {
static int firebird_handle_quoter(pdo_dbh_t *dbh, const char *unquoted, int unquotedlen, /* {{{ */
char **quoted, int *quotedlen TSRMLS_DC)
{
- pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data;
int qcount = 0;
char const *c;
/* Firebird only requires single quotes to be doubled if string lengths are used */
/* count the number of ' characters */
- for (c = unquoted; c = strchr(c,'\''); qcount++, c++);
+ for (c = unquoted; (c = strchr(c,'\'')); qcount++, c++);
if (!qcount) {
return 0;
*quoted = c = emalloc(*quotedlen+1);
/* foreach (chunk that ends in a quote) */
- for (l = unquoted; r = strchr(l,'\''); l = r+1) {
+ for (l = unquoted; (r = strchr(l,'\'')); l = r+1) {
/* copy the chunk */
strncpy(c, l, r-l);
/* if (the value is really being changed and a transaction is open) */
if ((Z_LVAL_P(val)?1:0) ^ dbh->auto_commit && dbh->in_txn) {
- if (dbh->auto_commit = Z_BVAL_P(val)) {
+ if ((dbh->auto_commit = Z_BVAL_P(val))) {
/* just keep the running transaction but commit it */
if (isc_commit_retaining(H->isc_status, &H->tr)) {
RECORD_ERROR(dbh);
pdo_firebird_db_handle *H = (pdo_firebird_db_handle *)dbh->driver_data;
switch (attr) {
- char tmp[200] = "Firebird 1.0/Interbase 6";
- info_func_t info_func;
+ char tmp[200];
case PDO_ATTR_AUTOCOMMIT:
ZVAL_LONG(val,dbh->auto_commit);
case PDO_ATTR_CLIENT_VERSION: {
#if defined(__GNUC__) || defined(PHP_WIN32)
+ info_func_t info_func = NULL;
#ifdef __GNUC__
- info_func_t info_func = (info_func_t)dlsym(RTLD_DEFAULT, "isc_get_client_version");
+ info_func = (info_func_t)dlsym(RTLD_DEFAULT, "isc_get_client_version");
#else
HMODULE l = GetModuleHandle("fbclient");
if (!l && !(l = GetModuleHandle("gds32"))) {
- return 0;
+ break;
}
info_func = (info_func_t)GetProcAddress(l, "isc_get_client_version");
#endif
if (info_func) {
info_func(tmp);
+ ZVAL_STRING(val,tmp,1);
+ } else {
+ ZVAL_STRING(val,"Firebird 1.0/Interbase 6",1);
}
- ZVAL_STRING(val,tmp,1);
#else
ZVAL_NULL(val);
#endif
if (sqlcode) {
add_next_index_long(info, sqlcode);
- while (l = isc_interprete(&buf[i],&s)) {
+ while ((l = isc_interprete(&buf[i],&s))) {
i += l;
strcpy(&buf[i++], " ");
}
isc_dpb_user_name, isc_dpb_password, isc_dpb_lc_ctype, isc_dpb_sql_role_name };
char const *dpb_values[] = { dbh->username, dbh->password, vars[1].optval, vars[2].optval };
char dpb_buffer[256] = { isc_dpb_version1 }, *dpb;
- short len;
dpb = dpb_buffer + 1;