> Can you send this patch to the list as an attachment? It's a little messed > up due to line endings. Here you are.
Index: ext/interbase/interbase.c =================================================================== RCS file: /repository/php4/ext/interbase/interbase.c,v retrieving revision 1.58 diff -u -r1.58 interbase.c --- ext/interbase/interbase.c 2001/06/09 09:30:42 1.58 +++ ext/interbase/interbase.c 2001/07/06 14:59:01 @@ -25,6 +25,15 @@ /* Changes: + 2001-06-13: Jeremy Bettis <[EMAIL PROTECTED]> + - Return the text of blobs in _php_ibase_fetch_hash, not the blob + handles, even if the BLOB is not of TEXT type + 2001-05-31: Jeremy Bettis <[EMAIL PROTECTED]> + - If a blob handle was expected and something else was + received create a blob and add the value to it. + - If the incoming argument to a bind parameter is NULL + then store a NULL in the database. + - More verbose date errors. 1999-09-21: Ivo Panacek <[EMAIL PROTECTED]> - added COMPILE_DL section - more verbose php_info_ibase function @@ -1130,7 +1139,7 @@ /* {{{ _php_ibase_bind() Bind parameter placeholders in a previously prepared query */ -static int _php_ibase_bind(XSQLDA *sqlda, pval **b_vars, BIND_BUF *buf) +static int _php_ibase_bind(XSQLDA *sqlda, pval **b_vars, BIND_BUF *buf, ibase_query +*ib_query) { XSQLVAR *var; pval *b_var; @@ -1143,6 +1152,15 @@ var->sqlind = &buf[i].sqlind; b_var = b_vars[i]; + if (b_var->type == IS_NULL) { + static char nothing[64]; + static short null_flag = -1; + var->sqldata = nothing; + var->sqltype |= 1; + var->sqlind = &null_flag; + if (var->sqllen > 64) + var->sqllen = 64; + } else switch(var->sqltype & ~1) { case SQL_TEXT: /* direct to variable */ case SQL_VARYING: @@ -1220,7 +1238,7 @@ 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){ - _php_ibase_module_error("invalid date/time format"); + _php_ibase_module_error("invalid +date/time format: Expected 3 or 6 fields, got %d. Use format m/d/Y H:i:s. You gave +'%s'", n, b_var->value.str.val); return FAILURE; } t.tm_year -= 1900; @@ -1278,12 +1296,36 @@ 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) { + IBLS_FETCH(); + ibase_blob_handle *ib_blob; + ib_blob = (ibase_blob_handle *) +emalloc(sizeof(ibase_blob_handle)); + ib_blob->trans_handle = +ib_query->trans; + ib_blob->link = ib_query->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); + _php_ibase_error(); + return FAILURE; + } + convert_to_string(b_var); + if (isc_put_segment(IB_STATUS, +&ib_blob->bl_handle, (unsigned short) b_var->value.str.len, b_var->value.str.val)) { + _php_ibase_error(); + return FAILURE; + } + if (isc_close_blob(IB_STATUS, +&ib_blob->bl_handle)) { + _php_ibase_error(); + return FAILURE; + } + ib_blob_id = ib_blob; + var->sqldata = (void ISC_FAR +*)&ib_blob_id->bl_qd; +/* _php_ibase_module_error("invalid blob id string"); return FAILURE; +*/ + } else { + ib_blob_id = (ibase_blob_handle +*)b_var->value.str.val; + var->sqldata = (void ISC_FAR +*)&ib_blob_id->bl_qd; } - ib_blob_id = (ibase_blob_handle *)b_var->value.str.val; - - var->sqldata = (void ISC_FAR *)&ib_blob_id->bl_qd; } break; case SQL_ARRAY: @@ -1395,7 +1437,7 @@ in_sqlda = emalloc(XSQLDA_LENGTH(ib_query->in_sqlda->sqld)); memcpy(in_sqlda, ib_query->in_sqlda, XSQLDA_LENGTH(ib_query->in_sqlda->sqld)); bind_buf = emalloc(sizeof(BIND_BUF) * ib_query->in_sqlda->sqld); - if (_php_ibase_bind(in_sqlda, args, bind_buf) == FAILURE) { + if (_php_ibase_bind(in_sqlda, args, bind_buf, ib_query) == FAILURE) { IBDEBUG("Could not bind input XSQLDA... (_php_ibase_exec)"); goto _php_ibase_exec_error; } @@ -1961,7 +2003,7 @@ _php_ibase_var_pval(tmp, var->sqldata, var->sqltype, var->sqllen, var->sqlscale, flag); break; case SQL_BLOB: - if (flag & PHP_IBASE_TEXT) { /* text ? */ + if (1 /*flag & PHP_IBASE_TEXT*/) { /* text ? */ int stat; isc_blob_handle bl_handle = NULL; ISC_LONG max_len = 0, cur_len = 0;
-- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]