CVS update: php3/functions
| From: | jah | Date: | Sat, 19 Dec 1998 20:53:08 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-2883@lists.php.net to get a copy of this message | ||
Date: Saturday December 19, 1998 @ 15:53
Author: jah
Update of /repository/php3/functions
In directory asf:/u/temp/cvs-serv20220/functions
Modified Files:
interbase.c
Log Message:
Fixed(?) some problems with datetime type and NULLs.
Index: php3/functions/interbase.c
diff -c php3/functions/interbase.c:1.5 php3/functions/interbase.c:1.6
*** php3/functions/interbase.c:1.5 Sat Dec 19 14:00:03 1998
--- php3/functions/interbase.c Sat Dec 19 15:53:08 1998
***************
*** 28,34 ****
+----------------------------------------------------------------------+
*/
! /* $Id: interbase.c,v 1.5 1998/12/19 19:00:03 jah Exp $ */
/* TODO: A lot... */
--- 28,34 ----
+----------------------------------------------------------------------+
*/
! /* $Id: interbase.c,v 1.6 1998/12/19 20:53:08 jah Exp $ */
/* TODO: A lot... */
***************
*** 735,741 ****
--- 735,743 ----
char string_data[255];
char *fieldname;
char *char_data;
+ /*
struct tm t;
+ */
ibase_result_handle *ibase_result;
ISC_STATUS status[20];
XSQLVAR *var;
***************
*** 769,776 ****
for (i = 0; i < ibase_result->sqlda->sqld; i++) {
var[i].sqlname[var[i].sqlname_length] = '\0';
fieldname = var[i].sqlname;
! if (ibase_result->sqlda->sqlvar[i].sqlind) {
! /* Column is NULL. Something to be done here? */
}
coltype = var[i].sqltype & ~1;
switch(coltype) {
--- 771,781 ----
for (i = 0; i < ibase_result->sqlda->sqld; i++) {
var[i].sqlname[var[i].sqlname_length] = '\0';
fieldname = var[i].sqlname;
! if (*var[i].sqlind < 0) {
! /* XXX. Column is NULL. This is not the best idea to do, think something... */
! add_get_index_stringl(return_value, i, NULL, 0, (void **) &pval_ptr, 1);
! _php3_hash_pointer_update(return_value->value.ht, fieldname, var[i].sqlname_length+1,
pval_ptr);
! continue;
}
coltype = var[i].sqltype & ~1;
switch(coltype) {
***************
*** 841,855 ****
add_get_index_stringl(return_value, i, string_data, collen, (void **) &pval_ptr, 1);
_php3_hash_pointer_update(return_value->value.ht, fieldname, var[i].sqlname_length+1,
pval_ptr);
break;
! case SQL_DATE:
! isc_decode_date((ISC_QUAD *) var[i].sqldata, &t);
#if HAVE_STRFTIME
! collen = (int) strftime(string_data, 255, IBASE_GLOBAL(php3_ibase_module).timeformat,
&t);
#else
! collen = sprintf(string_data, "%4d-%02d-%02d %02d:%02d:%02d", t.tm_year+1900,
t.tm_mon+1, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec);
! #endif
add_get_index_stringl(return_value, i, string_data, collen, (void **) &pval_ptr, 1);
_php3_hash_pointer_update(return_value->value.ht, fieldname, var[i].sqlname_length+1,
pval_ptr);
break;
case SQL_BLOB:
case SQL_ARRAY:
--- 846,867 ----
add_get_index_stringl(return_value, i, string_data, collen, (void **) &pval_ptr, 1);
_php3_hash_pointer_update(return_value->value.ht, fieldname, var[i].sqlname_length+1,
pval_ptr);
break;
! case SQL_DATE: {
! struct tm *t;
! t = emalloc(sizeof(struct tm));
!
! isc_decode_date((ISC_QUAD *) var[i].sqldata, t);
! /*
#if HAVE_STRFTIME
! collen = (int) strftime(string_data, 255, IBASE_GLOBAL(php3_ibase_module).timeformat, t);
#else
! */
! collen = sprintf(string_data, "%4d-%02d-%02d %02d:%02d:%02d", t->tm_year+1900,
t->tm_mon+1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec);
! /* #endif */
add_get_index_stringl(return_value, i, string_data, collen, (void **) &pval_ptr, 1);
_php3_hash_pointer_update(return_value->value.ht, fieldname, var[i].sqlname_length+1,
pval_ptr);
+ efree(t);
+ }
break;
case SQL_BLOB:
case SQL_ARRAY:
--
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