Re: cvs: php3 /functions ifx.ec
| From: | Danny Heijl | Date: | Sat, 05 Aug 2000 14:20:01 +0000 |
| Subject: | Re: cvs: php3 /functions ifx.ec | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-1052@lists.php.net to get a copy of this message | ||
Informix pads the string with spaces so it does not matter which
character memset uses. I stop the scan at the first space.
I have my doubts about giving Informix 200 bytes for converting a
64 bit integer to a string but I did not write that bit of code.
Danny
---
Andi Gutmans wrote:
>
> I might be missing something in this patch because I don't know the module,
> but why can't you just memset() that string with '\0' in the beginning and
> in the end set the last character to a '\0' too (if necessary).
>
> Andi
>
> At 01:29 PM 8/5/00 +0000, Danny Heijl wrote:
> >danny Sat Aug 5 06:29:40 2000 EDT
> >
> > Modified files:
> > /php3/functions ifx.ec
> > Log:
> > - fix INT8 returning garbage bug. (danny)
> >
> >
> >Index: php3/functions/ifx.ec
> >diff -u php3/functions/ifx.ec:1.50 php3/functions/ifx.ec:1.51
> >--- php3/functions/ifx.ec:1.50 Sun Jun 11 08:47:54 2000
> >+++ php3/functions/ifx.ec Sat Aug 5 06:29:40 2000
> >@@ -30,7 +30,7 @@
> > +----------------------------------------------------------------------+
> > */
> >
> >-/* $Id: ifx.ec,v 1.50 2000/06/11 15:47:54 eschmid Exp $ */
> >+/* $Id: ifx.ec,v 1.51 2000/08/05 13:29:40 danny Exp $ */
> >
> > /* -------------------------------------------------------------------
> > * if you want a function reference : "grep '^\*\*' ifx.ec" will give
> >@@ -2200,7 +2200,11 @@
> > case SQLSERIAL8 :
> > case SQLINT8 :
> > EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :int8_var = DATA;
> >+ memset(string_data, ' ', sizeof(string_data));
> > ifx_int8toasc(&int8_var,string_data,200);
> >+ p = string_data; /* rtrim string_data */
> >+ while ((*p != ' ') && (p <
> >&string_data[sizeof(string_data) - 1])) ++p;
> >+ *p = 0;
> > add_assoc_string(return_value, fieldname, string_data, DUP);
> > break;
> > case SQLLVARCHAR:
> >@@ -2558,7 +2562,11 @@
> > case SQLSERIAL8:
> > case SQLINT8 :
> > EXEC SQL GET DESCRIPTOR :descrpid VALUE :i :int8_var
> > = DATA;
> >+ memset(string_data, ' ', sizeof(string_data));
> > ifx_int8toasc(&int8_var,string_data,200);
> >+ p = string_data; /* rtrim string_data */
> >+ while ((*p != ' ') && (p <
> >&string_data[sizeof(string_data) - 1])) ++p;
> >+ *p = 0;
> > php3_printf("<td>%s</td>", string_data);
> > break;
> > case SQLLVARCHAR:
> >
> >
> >
> >--
> >PHP CVS Mailing List (http://www.php.net/)
> >To unsubscribe, e-mail: php-cvs-unsubscribe@lists.php.net
> >For additional commands, e-mail: php-cvs-help@lists.php.net
> >To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
> ---
> Andi Gutmans <andi@zend.com>
> http://www.zend.com/