On May 23, 7:02 am, "Jeff Loiselle" <[EMAIL PROTECTED]> wrote:

> Welcome to being me.

Hi Jeff,

Great job by the way (considering) and thank you for dbo_oracle.php

I was shocked to find there was no way to get Oracle to return the
full table.column specifier in OCI_ASSOC.  If we could get that then
the OCI_ASSOC to OCI_NUM conversion (and inline _map build) would work
just find.  I thought about doing OCI_ASSOC to OCI_NUM mapping to load
the column names and then just scraping the query for tables and
assigning them that way, logically there is a way to pair those up
(and support * queries), however,  I've got to get a project complete
(grin).

The real answer would be a better PHP OCI driver with something
equivilent to [OJ]DBC MetaData.  I was surprised this was not
available.  I also considered using dbo_odbc, but it seems as everyone
else is targeting OCI and that would prove a better cross platform
solution as my Production environment will be Linux.

For what it's worth, here is the function I wrote in an attempt to
extract MetaData from an OCI_ASSOC call:

/**
 * Convert associative results to numeric results.  We get the
 * associative results so we can extract metadata.  This function
 * Also builds the _map array that contains returned column and
 * table names.  This function manipulates the
 * _results, _assocResults and _map properties directly to
 * conserve server memory.  _assocResults is zapped
 * after call.
 *
 */
    function assocToNum() {
      $rowcount=0;
      $this->_results=array();
      $this->_map = array();
      foreach ($this->_assocResults as $arow) {
        $nrow=array();
        foreach ($arow as $cname => $cvalue) {
          // build metadata map
          if ($rowcount == 0) {
                        $e = explode('.', $cname);
                        if (count($e) > 1) {
                                $table = $e[0];
                                $field = strtolower($e[1]);
                        } else {
                                $table = 0;
                                $field = strtolower($e[0]);
                        }
                        $this->_map[] = array($table, $field);
          }
          // convert OCI_ASSOC row to OCI_NUM row
          $nrow[]=$cvalue;
        }
        $this->_results[]=$nrow;
        $rowcount++;
      }
      //clobber _assocResults to conserve memory
      $this->_assocResults=array();
    }

--Dave


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to