ADOFieldObject PHP Class Code Examples

This page contains top rated real world PHP examples of class ADOFieldObject extracted from open source projects. You can rate examples to help us improve the quality of examples

Example #1
Show file File: adodb-mssqlnative.inc.php Project: benvanstaveren/movabletype
0
 function FetchField($fieldOffset = -1)
 {
     if ($this->connection->debug) {
         error_log("<hr>fetchfield: {$fieldOffset}, fetch array: <pre>" . print_r($this->fields, true) . "</pre> backtrace: " . adodb_backtrace(false));
     }
     if ($fieldOffset != -1) {
         $this->fieldOffset = $fieldOffset;
     }
     /*$arrKeys = array_keys($this->fields);
     		if(array_key_exists($this->fieldOffset,$arrKeys) && !array_key_exists($arrKeys[$this->fieldOffset],$this->fields)) {
     			$f = false;
     		} else {
     			$f = new ADOFetchObj();
     			$f->name = $arrKeys[$this->fieldOffset];
     			if($fieldOffset == -1) $this->fieldOffset++;
     		}
     
             if (empty($f)) {
                 $f = false;//PHP Notice: Only variable references should be returned by reference
             }*/
     $fieldMeta = @sqlsrv_field_metadata($this->_queryID);
     $f = new ADOFieldObject();
     $f->name = $fieldMeta[$this->fieldOffset]['Name'];
     $f->type = $fieldMeta[$this->fieldOffset]['Type'];
     $f->max_length = $fieldMeta[$this->fieldOffset]['Size'];
     return $f;
 }
Example #2
Show file File: adodb-ibase.inc.php Project: CristianOspinaOspina/testlinkpruebas
0
 function FetchField($fieldOffset = -1)
 {
     $fld = new ADOFieldObject();
     $ibf = ibase_field_info($this->_queryID, $fieldOffset);
     switch (ADODB_ASSOC_CASE) {
         case 2:
             // the default
             $fld->name = $ibf['alias'];
             if (empty($fld->name)) {
                 $fld->name = $ibf['name'];
             }
             break;
         case 0:
             $fld->name = strtoupper($ibf['alias']);
             if (empty($fld->name)) {
                 $fld->name = strtoupper($ibf['name']);
             }
             break;
         case 1:
             $fld->name = strtolower($ibf['alias']);
             if (empty($fld->name)) {
                 $fld->name = strtolower($ibf['name']);
             }
             break;
     }
     $fld->type = $ibf['type'];
     $fld->max_length = $ibf['length'];
     /*       This needs to be populated from the metadata */
     $fld->not_null = false;
     $fld->has_default = false;
     $fld->default_value = 'null';
     return $fld;
 }
Example #3
Show file File: adodb-ibase.inc.php Project: nicolas34732/address_book
0
 function FetchField($fieldOffset = -1)
 {
     $fld = new ADOFieldObject();
     $ibf = ibase_field_info($this->_queryID, $fieldOffset);
     $name = empty($ibf['alias']) ? $ibf['name'] : $ibf['alias'];
     switch (ADODB_ASSOC_CASE) {
         case ADODB_ASSOC_CASE_UPPER:
             $fld->name = strtoupper($name);
             break;
         case ADODB_ASSOC_CASE_LOWER:
             $fld->name = strtolower($name);
             break;
         case ADODB_ASSOC_CASE_NATIVE:
         default:
             $fld->name = $name;
             break;
     }
     $fld->type = $ibf['type'];
     $fld->max_length = $ibf['length'];
     /*       This needs to be populated from the metadata */
     $fld->not_null = false;
     $fld->has_default = false;
     $fld->default_value = 'null';
     return $fld;
 }
Example #4
Show file File: adodb-pdo.inc.php Project: humor-zo/chaofan
0
 function FetchField($fieldOffset = -1)
 {
     $off = $fieldOffset + 1;
     // offsets begin at 1
     $o = new ADOFieldObject();
     $arr = @$this->_queryID->getColumnMeta($fieldOffset);
     if (!$arr) {
         $o->name = 'bad getColumnMeta()';
         $o->max_length = -1;
         $o->type = 'VARCHAR';
         $o->precision = 0;
         #		$false = false;
         return $o;
     }
     //adodb_pr($arr);
     $o->name = $arr['name'];
     if (isset($arr['native_type']) && $arr['native_type'] != "null") {
         $o->type = $arr['native_type'];
     } else {
         $o->type = adodb_pdo_type($arr['pdo_type']);
     }
     $o->max_length = $arr['len'];
     $o->precision = $arr['precision'];
     if (ADODB_ASSOC_CASE == 0) {
         $o->name = strtolower($o->name);
     } else {
         if (ADODB_ASSOC_CASE == 1) {
             $o->name = strtoupper($o->name);
         }
     }
     return $o;
 }
Example #5
Show file File: adodb-odbc_oracle.inc.php Project: dalinhuang/vincenttodolist
0
 function MetaColumns($table, $normalize = true)
 {
     global $ADODB_FETCH_MODE;
     $rs = $this->Execute(sprintf($this->metaColumnsSQL, strtoupper($table)));
     if ($rs === false) {
         $false = false;
         return $false;
     }
     $retarr = array();
     while (!$rs->EOF) {
         //print_r($rs->fields);
         $fld = new ADOFieldObject();
         $fld->name = $rs->fields[0];
         $fld->type = $rs->fields[1];
         $fld->max_length = $rs->fields[2];
         if ($ADODB_FETCH_MODE == ADODB_FETCH_NUM) {
             $retarr[] = $fld;
         } else {
             $retarr[strtoupper($fld->name)] = $fld;
         }
         $rs->MoveNext();
     }
     $rs->Close();
     return $retarr;
 }
Example #6
Show file File: adodb-fbsql.inc.php Project: mindfeederllc/openemr
0
 function MetaColumns($table, $normalize = true)
 {
     if ($this->metaColumnsSQL) {
         $rs = $this->Execute(sprintf($this->metaColumnsSQL, $table));
         if ($rs === false) {
             return false;
         }
         $retarr = array();
         while (!$rs->EOF) {
             $fld = new ADOFieldObject();
             $fld->name = $rs->fields[0];
             $fld->type = $rs->fields[1];
             // split type into type(length):
             if (preg_match("/^(.+)\\((\\d+)\\)\$/", $fld->type, $query_array)) {
                 $fld->type = $query_array[1];
                 $fld->max_length = $query_array[2];
             } else {
                 $fld->max_length = -1;
             }
             $fld->not_null = $rs->fields[2] != 'YES';
             $fld->primary_key = $rs->fields[3] == 'PRI';
             $fld->auto_increment = strpos($rs->fields[5], 'auto_increment') !== false;
             $fld->binary = strpos($fld->type, 'blob') !== false;
             $retarr[strtoupper($fld->name)] = $fld;
             $rs->MoveNext();
         }
         $rs->Close();
         return $retarr;
     }
     return false;
 }
Example #7
Show file File: adodb-ado_mssql.inc.php Project: klr2003/sourceread
0
 function MetaColumns($table)
 {
     $table = strtoupper($table);
     $arr = array();
     $dbc = $this->_connectionID;
     $osoptions = array();
     $osoptions[0] = null;
     $osoptions[1] = null;
     $osoptions[2] = $table;
     $osoptions[3] = null;
     $adors = @$dbc->OpenSchema(4, $osoptions);
     //tables
     if ($adors) {
         while (!$adors->EOF) {
             $fld = new ADOFieldObject();
             $c = $adors->Fields(3);
             $fld->name = $c->Value;
             $fld->type = 'CHAR';
             // cannot discover type in ADO!
             $fld->max_length = -1;
             $arr[strtoupper($fld->name)] = $fld;
             $adors->MoveNext();
         }
         $adors->Close();
     }
     $false = false;
     return empty($arr) ? $false : $arr;
 }