[PHP-DEV] CVS update: php3/functions From: jah (php-dev <email protected>)
Date: 06/29/98

Date: Monday June 29, 1998 @ 8:36
Author: jah

Update of /repository/php3/functions
In directory asf:/tmp/cvs-serv5887/functions

Modified Files:
        pgsql.c
Log Message:

pg_loread hopefully handles binary data correct now...

Index: php3/functions/pgsql.c
diff -c php3/functions/pgsql.c:1.65 php3/functions/pgsql.c:1.66
*** php3/functions/pgsql.c:1.65 Mon Jun 22 16:28:35 1998
--- php3/functions/pgsql.c Mon Jun 29 08:36:54 1998
***************
*** 28,34 ****
     +----------------------------------------------------------------------+
   */
   
! /* $Id: pgsql.c,v 1.65 1998/06/22 20:28:35 zeev Exp $ */
  
  #include <stdlib.h>
  
--- 28,34 ----
     +----------------------------------------------------------------------+
   */
   
! /* $Id: pgsql.c,v 1.66 1998/06/29 12:36:54 jah Exp $ */
  
  #include <stdlib.h>
  
***************
*** 1259,1265 ****
  void php3_pgsql_lo_read(INTERNAL_FUNCTION_PARAMETERS)
  {
            pval *pgsql_id, *len;
! int id, buf_len, type;
          char *buf;
          pgLofp *pgsql;
  
--- 1259,1265 ----
  void php3_pgsql_lo_read(INTERNAL_FUNCTION_PARAMETERS)
  {
            pval *pgsql_id, *len;
! int id, buf_len, type, nbytes;
          char *buf;
          pgLofp *pgsql;
  
***************
*** 1285,1296 ****
          }
          
          buf = (char *) emalloc(sizeof(char)*(buf_len+1));
! if (!lo_read((PGconn *)pgsql->conn, pgsql->lofd, buf, buf_len)) {
                  efree(buf);
                  RETURN_FALSE;
          }
          return_value->value.str.val = buf;
! return_value->value.str.len = strlen(return_value->value.str.val);
          return_value->type = IS_STRING;
  }
  
--- 1285,1297 ----
          }
          
          buf = (char *) emalloc(sizeof(char)*(buf_len+1));
! if ((nbytes = lo_read((PGconn *)pgsql->conn, pgsql->lofd, buf, buf_len))<0) {
                  efree(buf);
                  RETURN_FALSE;
          }
          return_value->value.str.val = buf;
! return_value->value.str.len = nbytes;
! return_value->value.str.val[nbytes] = 0;
          return_value->type = IS_STRING;
  }