[PHP-DEV] CVS update: php3/functions From: danny (php-dev <email protected>)
Date: 09/25/98

Date: Friday September 25, 1998 @ 16:08
Author: danny

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

Modified Files:
        ifx.ec
Log Message:

Added support for stored procedures, both cursory and noncursory.
Result columns automatically renamed : [Expr_1] , [Expr_2] , etc...

Index: php3/functions/ifx.ec
diff -c php3/functions/ifx.ec:1.28 php3/functions/ifx.ec:1.29
*** php3/functions/ifx.ec:1.28 Tue Sep 22 13:08:58 1998
--- php3/functions/ifx.ec Fri Sep 25 16:08:36 1998
***************
*** 86,91 ****
--- 86,94 ----
  - supports now IUS- serial8,int8,boolean, nchar, nvchar, lvarchar
  - still incomplete slob-support
  
+ Changes 25.9.1998 (danny.heijl <email protected>)
+ - cursory and non-cursory stored procedures
+
  */
  
  
***************
*** 914,919 ****
--- 917,923 ----
      int ctype;
      int affected_rows;
      int query_type;
+ int cursoryproc;
          
      Informix_TLS_VARS;
  
***************
*** 1006,1016 ****
      for (i = 0; i < MAXSLOBS; ++i)
          Ifx_Result->slob_id[i] = -1;
  $endif;
  
      Ifx_Result->iscursory = -1; /* prevent ifx_do */
      Ifx_Result->paramquery=0;
      
! if (query_type != 0) { /* not a select, execute immediate */
        /* ##
           ## NONSELECT-STATEMENT
           ##
--- 1010,1028 ----
      for (i = 0; i < MAXSLOBS; ++i)
          Ifx_Result->slob_id[i] = -1;
  $endif;
+
+ cursoryproc = 0;
+ if (query_type == SQ_EXECPROC) {
+ EXEC SQL GET DESCRIPTOR :descrpid :i = COUNT;
+ if (i > 0) {
+ cursoryproc = 1;
+ }
+ }
  
      Ifx_Result->iscursory = -1; /* prevent ifx_do */
      Ifx_Result->paramquery=0;
      
! if ((query_type != 0) && (!cursoryproc)) { /* NO RESULT SET */
        /* ##
           ## NONSELECT-STATEMENT
           ##
***************
*** 1243,1248 ****
--- 1255,1261 ----
      int ctype;
      int affected_rows;
      int query_type;
+ int cursoryproc;
      
      Informix_TLS_VARS;
  
***************
*** 1339,1348 ****
          Ifx_Result->slob_id[i] = -1;
  $endif;
    
      Ifx_Result->iscursory = -1; /* prevent ifx_do */
      Ifx_Result->paramquery=0;
  
! if (query_type != 0) { /* not a select, execute immediate */
        /* ##
           ## NONSELECT-STATEMENT
           ##
--- 1352,1369 ----
          Ifx_Result->slob_id[i] = -1;
  $endif;
    
+ cursoryproc = 0;
+ if (query_type == SQ_EXECPROC) {
+ EXEC SQL GET DESCRIPTOR :descrpid :i = COUNT;
+ if (i > 0) {
+ cursoryproc = 1;
+ }
+ }
+
      Ifx_Result->iscursory = -1; /* prevent ifx_do */
      Ifx_Result->paramquery=0;
  
! if ((query_type != 0) && (!cursoryproc)) { /* NO RESULT SET */
        /* ##
           ## NONSELECT-STATEMENT
           ##
***************
*** 1943,1948 ****
--- 1964,1972 ----
          p = fieldname; /* rtrim fieldname */
          while ((*p != ' ') && (p < &fieldname[sizeof(fieldname) - 1])) ++p;
          *p = 0;
+
+ if (strcmp("(expression)", fieldname) == 0) /* stored proc */
+ sprintf(fieldname, "[Expr_%d]", i);
  
          if (indicator == -1) { /* NULL */
             if((Informix_GLOBAL(php3_ifx_module).textasvarchar==0
***************
*** 2257,2262 ****
--- 2281,2288 ----
          *p = toupper(*p);
          while ((*p != ' ') && (p < &fieldname[sizeof(fieldname) - 1])) ++p;
          *p = 0;
+ if (strcmp("(expression)", fieldname) == 0) /* stored proc */
+ sprintf(fieldname, "[Expr_%d]", i);
          
          php3_printf("<th>%s</th>", fieldname);
      }
***************
*** 2555,2560 ****
--- 2581,2588 ----
          p = fieldname; /* rtrim fieldname */
          while ((*p != ' ') && (p < &fieldname[sizeof(fieldname) - 1])) ++p;
          *p = 0;
+ if (strcmp("(expression)", fieldname) == 0) /* stored proc */
+ sprintf(fieldname, "[Expr_%d]", i);
          
          switch (fieldtype) {
              case SQLSERIAL :
***************
*** 2761,2766 ****
--- 2789,2797 ----
          p = fieldname; /* rtrim fieldname */
          while ((*p != ' ') && (p < &fieldname[sizeof(fieldname) - 1])) ++p;
          *p = 0;
+ if (strcmp("(expression)", fieldname) == 0) /* stored proc */
+ sprintf(fieldname, "[Expr_%d]", i);
+
          switch (fieldtype) {
              case SQLSERIAL :
                  char_data = "SQLSERIAL";

--
PHP Development Mailing List   http://www.php.net/
To unsubscribe send an empty message to php-dev-unsubscribe <email protected>
For help: php-dev-help <email protected>