/** * Constructor method for the adapter. This constructor implements the setting of the * 3 required properties for the object. * * The body of this method was provided by Mario Falomir... Thanks. * * @param resource $d The datasource resource */ function odbcAdapter($d) { parent::RecordSetAdapter($d); // count number of fields $fieldcount = odbc_num_fields($d); $ob = ""; $be = $this->isBigEndian; $fc = pack('N', $fieldcount); if (odbc_num_rows($d) > 0) { $line = odbc_fetch_row($d, 0); do { // write all of the array elements $ob .= "\n" . $fc; for ($i = 1; $i <= $fieldcount; $i++) { // write all of the array elements $value = odbc_result($d, $i); if (is_string($value)) { // type as string $os = $this->_directCharsetHandler->transliterate($value); //string flag, string length, and string $len = strlen($os); if ($len < 65536) { $ob .= "" . pack('n', $len) . $os; } else { $ob .= "\f" . pack('N', $len) . $os; } } elseif (is_float($value) || is_int($value)) { // type as double $b = pack('d', $value); // pack the bytes if ($be) { // if we are a big-endian processor $r = strrev($b); } else { // add the bytes to the output $r = $b; } $ob .= "" . $r; } elseif (is_bool($value)) { //type as bool $ob .= ""; $ob .= pack('c', $value); } elseif (is_null($value)) { // null $ob .= ""; } } } while ($line = odbc_fetch_row($d)); } $this->serializedData = $ob; // grab the number of fields // loop over all of the fields for ($i = 1; $i <= $fieldcount; $i++) { // decode each field name ready for encoding when it goes through serialization // and save each field name into the array $this->columnNames[$i - 1] = $this->_directCharsetHandler->transliterate(odbc_field_name($d, $i)); } $this->numRows = odbc_num_rows($d); }
function zendrowAdapter($d) { parent::RecordSetAdapter($d); $val = $d->toArray(); $this->columns = array_keys($val); $this->rows[] = array_values($val); }
/** * Constructor method for the adapter. This constructor implements the setting of the * 3 required properties for the object. * * @param resource $d The datasource resource */ function mysqlfAdapter($d) { $f = $d['filter']; $d = $d['data']; parent::RecordSetAdapter($d); $fieldcount = count($f); $truefieldcount = mysql_num_fields($d); $be = $this->isBigEndian; $isintcache = array(); for ($i = 0; $i < $truefieldcount; $i++) { //mysql_fetch_* usually returns only strings, //hack it into submission $type = mysql_field_type($d, $i); $name = mysql_field_name($d, $i); $isintcache[$name] = in_array($type, array('int', 'real', 'year')); } $isint = array(); for ($i = 0; $i < $fieldcount; $i++) { $this->columnNames[$i] = $this->_charsetHandler->transliterate($f[$i]); $isint[$i] = isset($isintcache[$f[$i]]) && $isintcache[$f[$i]]; } //Start fast serializing $ob = ""; $fc = pack('N', $fieldcount); if (mysql_num_rows($d) > 0) { mysql_data_seek($d, 0); while ($line = mysql_fetch_assoc($d)) { //Write array flag + length $ob .= "\n" . $fc; $i = 0; foreach ($f as $key) { $value = $line[$key]; if (!$isint[$i]) { $os = $this->_directCharsetHandler->transliterate($value); //string flag, string length, and string $len = strlen($os); if ($len < 65536) { $ob .= "" . pack('n', $len) . $os; } else { $ob .= "\f" . pack('N', $len) . $os; } } else { $b = pack('d', $value); // pack the bytes if ($be) { // if we are a big-endian processor $r = strrev($b); } else { // add the bytes to the output $r = $b; } $ob .= "" . $r; } $i++; } } } $this->numRows = mysql_num_rows($d); $this->serializedData = $ob; }
/** * Constructor method for the adapter. This constructor implements the setting of the * 3 required properties for the object. * * @param resource $d The datasource resource */ function arrayfAdapter($d) { $f = $d->filter; $d = $d->data; parent::RecordSetAdapter($d); $fieldcount = count($f); $be = $this->isBigEndian; $this->columnNames = $f; //Start fast serializing $ob = ""; $fc = pack('N', $fieldcount); if (count($d) > 0) { $line = $d[0]; do { //Write array flag + length $ob .= "\n" . $fc; $i = 0; foreach ($f as $key) { $value = $line[$key]; if (is_string($value)) { // type as string $os = $this->_directCharsetHandler->transliterate($value); //string flag, string length, and string $len = strlen($os); if ($len < 65536) { $ob .= "" . pack('n', $len) . $os; } else { $ob .= "\f" . pack('N', $len) . $os; } } elseif (is_double($value) || is_int($value)) { // type as double $b = pack('d', $value); // pack the bytes if ($be) { // if we are a big-endian processor $r = strrev($b); } else { // add the bytes to the output $r = $b; } $ob .= "" . $r; } elseif (is_bool($value)) { //type as bool $ob .= ""; $ob .= pack('c', $value); } elseif (is_null($value)) { // null $ob .= ""; } $i++; } } while ($line = next($d)); } $this->numRows = count($d); $this->serializedData = $ob; }
/** * Constructor method for the adapter. This constructor implements the setting of the * 3 required properties for the object. * * @param resource $d The datasource resource */ function peardbAdapter($d) { parent::RecordSetAdapter($d); $fieldcount = $d->numCols(); //Start fast serializing $ob = ""; $fc = pack('N', $fieldcount); $be = $this->isBigEndian; $isint = array(); $info = $d->dbh->tableInfo($d); for ($i = 0; $i < $fieldcount; $i++) { $this->columnNames[$i] = $this->_charsetHandler->transliterate($info[$i]['name']); $type = $info[$i]['type']; $isint[] = in_array($type, array('int', 'real', 'year')); } $rows = 0; if ($d->numRows() > 0) { $line = $d->fetchRow(DB_FETCHMODE_ORDERED, 0); do { $rows++; //Write array flag + length $ob .= "\n" . $fc; $to = count($line); for ($i = 0; $i < $to; $i++) { $value = $line[$i]; if (!$isint[$i]) { $os = $this->_directCharsetHandler->transliterate($value); //string flag, string length, and string $len = strlen($os); if ($len < 65536) { $ob .= "" . pack('n', $len) . $os; } else { $ob .= "\f" . pack('N', $len) . $os; } } else { $b = pack('d', $value); // pack the bytes if ($be) { // if we are a big-endian processor $r = strrev($b); } else { // add the bytes to the output $r = $b; } $ob .= "" . $r; } } } while ($line = $d->fetchRow(DB_FETCHMODE_ORDERED, $rows)); } $this->numRows = $rows; // just in case the recordset is not capable of returning a record count we will use the if (is_object($this->numRows)) { $this->numRows = $rows; } $this->serializedData = $ob; }
/** * Constructor method for the adapter. This constructor implements the setting of the * 3 required properties for the object. * * @param resource $d The datasource resource */ function mssqlAdapter($d) { parent::RecordSetAdapter($d); $fieldcount = mssql_num_fields($d); // grab the number of fields $ob = ""; $be = $this->isBigEndian; $fc = pack('N', $fieldcount); if (mssql_num_rows($d) > 0) { mssql_data_seek($d, 0); while ($line = mssql_fetch_row($d)) { // write all of the array elements $ob .= "\n" . $fc; foreach ($line as $value) { // write all of the array elements if (is_string($value)) { // type as string $os = $this->_directCharsetHandler->transliterate($value); //string flag, string length, and string $len = strlen($os); if ($len < 65536) { $ob .= "" . pack('n', $len) . $os; } else { $ob .= "\f" . pack('N', $len) . $os; } } elseif (is_float($value) || is_int($value)) { // type as double $b = pack('d', $value); // pack the bytes if ($be) { // if we are a big-endian processor $r = strrev($b); } else { // add the bytes to the output $r = $b; } $ob .= "" . $r; } elseif (is_bool($value)) { //type as bool $ob .= ""; $ob .= pack('c', $value); } elseif (is_null($value)) { // null $ob .= ""; } } } } $this->serializedData = $ob; for ($i = 0; $i < $fieldcount; $i++) { // loop over all of the fields $this->columnNames[] = $this->_directCharsetHandler->transliterate(mssql_field_name($d, $i)); } $this->numRows = mssql_num_rows($d); }
/** * Constructor method for the adapter. This constructor implements the setting of the * 3 required properties for the object. * * @param resource $d The datasource resource */ function oci8Adapter($d) { parent::RecordSetAdapter($d); $fieldcount = ocinumcols($d); for ($j = 0; $j < $fieldcount; $j++) { $this->columnNames[] = ocicolumnname($d, $j + 1); } $i = 0; while (OCIFetchInto($d, $line, OCI_NUM + OCI_RETURN_LOBS + OCI_RETURN_NULLS)) { $this->rows[] = $line; } }
/** * Constructor method for the adapter. This constructor implements the setting of the * 3 required properties for the object. * * @param resource $d The datasource resource */ function informixAdapter($d) { parent::RecordSetAdapter($d); $ob = ""; $fieldcount = ifx_num_fields($d); $be = $this->isBigEndian; $fc = pack('N', $fieldcount); if (ifx_num_rows($d) > 0) { $line = ifx_fetch_row($d, "FIRST"); do { //Write inner inner (data) array $ob .= "\n" . $fc; foreach ($line as $key => $value) { if (is_string($value)) { // string $os = $this->_directCharsetHandler->transliterate($value); $len = strlen($os); if ($len < 65536) { $ob .= "" . pack('n', $len) . $os; } else { $ob .= "\f" . pack('N', $len) . $os; } } elseif (is_float($value) || is_int($value)) { //numberic $b = pack('d', $value); // pack the bytes if ($be) { // if we are a big-endian processor $r = strrev($b); } else { // add the bytes to the output $r = $b; } $ob .= "" . $r; } elseif (is_bool($value)) { //bool $ob .= "" . pack('c', $value); } elseif (is_null($value)) { // null $ob .= ""; } } } while ($line = ifx_fetch_row($d, "NEXT")); } $this->serializedData = $ob; $properties = ifx_fieldproperties($d); for ($i = 0; $i < $fieldcount; $i++) { $this->columnNames[$i] = $this->_directCharsetHandler->transliterate(key($properties)); next($properties); } $this->numRows = ifx_num_rows($d); }
/** * Constructor method for the adapter. This constructor implements the setting of the * 3 required properties for the object. * * @param resource $d The datasource resource */ function oci8Adapter($d) { parent::RecordSetAdapter($d); $fieldcount = ocinumcols($d); $ob = ""; $be = $this->isBigEndian; $fc = pack('N', $fieldcount); $i = 0; while (OCIFetchInto($d, $line, OCI_NUM + OCI_RETURN_LOBS + OCI_RETURN_NULLS)) { // write all of the array elements $ob .= "\n" . $fc; foreach ($line as $value) { // write all of the array elements if (is_string($value)) { // type as string $os = $this->_directCharsetHandler->transliterate($value); //string flag, string length, and string $len = strlen($os); if ($len < 65536) { $ob .= "" . pack('n', $len) . $os; } else { $ob .= "\f" . pack('N', $len) . $os; } } elseif (is_float($value) || is_int($value)) { // type as double $b = pack('d', $value); // pack the bytes if ($be) { // if we are a big-endian processor $r = strrev($b); } else { // add the bytes to the output $r = $b; } $ob .= "" . $r; } elseif (is_bool($value)) { //type as bool $ob .= ""; $ob .= pack('c', $value); } elseif (is_null($value)) { // null $ob .= ""; } } $i++; } $this->serializedData = $ob; for ($j = 0; $j < $fieldcount; $j++) { $this->columnNames[] = $this->_charsetHandler->transliterate(ocicolumnname($d, $j + 1)); } $this->numRows = $i; }
function zendrowsetAdapter($d) { parent::RecordSetAdapter($d); if ($d->count() > 0) { $d->rewind(); $firstRow = $d->current()->toArray(); $this->columns = array_keys($firstRow); //Note: foreach resets array iterator pointer foreach ($d as $row) { $this->rows[] = array_values($row->toArray()); } } }
/** * Constructor method for the adapter. This constructor implements the setting of the * 3 required properties for the object. * * @param resource $d The datasource resource */ function mysqliobjectAdapter($d) { parent::RecordSetAdapter($d); while ($field = $d->fetch_field()) { $this->columns[] = $field->name; } if ($d->num_rows > 0) { $d->data_seek(0); while ($line = $d->fetch_row()) { $this->rows[] = $line; } } }
/** * Constructor method for the adapter. This constructor implements the setting of the * 3 required properties for the object. * * @param resource $d The datasource resource */ function mysqliAdapter($d) { parent::RecordSetAdapter($d); while ($field = mysqli_fetch_field($d)) { $this->columns[] = $field->name; } if (mysqli_num_rows($d) > 0) { mysqli_data_seek($d, 0); while ($line = mysqli_fetch_row($d)) { $this->rows[] = $line; } } }
/** * Constructor method for the adapter. This constructor implements the setting of the * 3 required properties for the object. * * @param resource $d The datasource resource */ function adodbAdapter($d) { parent::RecordSetAdapter($d); $fieldcount = $d->FieldCount(); // grab the number of fields for ($i = 0; $i < $fieldcount; $i++) { // loop over all of the fields $fld = $d->FetchField($i); $this->columns[] = $fld->name; } $d->MoveFirst(); $this->rows = $d->GetArray(); }
function doctrineAdapter($d) { parent::RecordSetAdapter($d); if (count($d) > 0) { $firstRow = true; foreach ($d as $row) { $this->rows[] = array_values($row->toArray()); if ($firstRow) { $this->columns = array_keys($row->toArray()); $firstRow = false; } } } }
/** * Constructor method for the adapter. This constructor implements the setting of the * 3 required properties for the object. * * @param resource $d The datasource resource */ function pgsqlAdapter($d) { parent::RecordSetAdapter($d); $fieldcount = pg_num_fields($d); for ($i = 0; $i < $fieldcount; $i++) { $this->columns[] = pg_field_name($d, $i); } if (pg_num_rows($d) > 0) { pg_result_seek($d, 0); while ($line = pg_fetch_row($d)) { $this->rows[] = $line; } } }
/** * Constructor method for the adapter. This constructor implements the setting of the * 3 required properties for the object. * * @param resource $d The datasource resource */ function fbsqlAdapter($d) { parent::RecordSetAdapter($d); $fieldcount = fbsql_num_fields($d); for ($i = 0; $i < $fieldcount; $i++) { $this->columns[] = fbsql_field_name($d, $i); } if (fbsql_num_rows($d) > 0) { fbsql_data_seek($d, 0); while ($line = fbsql_fetch_row($d)) { $this->rows[] = $line; } } }
/** * Constructor method for the adapter. This constructor implements the setting of the * 3 required properties for the object. * * @param resource $d The datasource resource */ function sqliteobjectAdapter($d) { parent::RecordSetAdapter($d); // grab all of the rows $fieldcount = $d->numFields(); // loop over all of the fields for ($i = 0; $i < $fieldcount; $i++) { // decode each field name ready for encoding when it goes through serialization // and save each field name into the array $this->columns[] = $d->fieldName($i); } if ($d->numRows() > 0) { $this->rows = $d->fetchAll(SQLITE_NUM); } }
/** * Constructor method for the adapter. This constructor implements the setting of the * 3 required properties for the object. * * @param resource $d The datasource resource */ function sqliteAdapter($d) { parent::RecordSetAdapter($d); // grab all of the rows $fieldcount = sqlite_num_fields($d); // loop over all of the fields for ($i = 0; $i < $fieldcount; $i++) { // decode each field name ready for encoding when it goes through serialization // and save each field name into the array $this->columns[] = sqlite_field_name($d, $i); } if (sqlite_num_rows($d) > 0) { $this->rows = sqlite_fetch_all($d, SQLITE_NUM); } }
/** * Constructor method for the adapter. This constructor implements the setting of the * 3 required properties for the object. * * @param resource $d The datasource resource */ function informixAdapter($d) { parent::RecordSetAdapter($d); $fieldcount = ifx_num_fields($d); $properties = ifx_fieldproperties($d); for ($i = 0; $i < $fieldcount; $i++) { $this->columns[$i] = key($properties); next($properties); } if (ifx_num_rows($d) > 0) { $line = ifx_fetch_row($d, "FIRST"); do { $this->rows[] = $line; } while ($line = ifx_fetch_row($d, "NEXT")); } }
/** * Constructor method for the adapter. This constructor implements the setting of the * 3 required properties for the object. * * @param resource $d The datasource resource */ function mssqlAdapter($d) { parent::RecordSetAdapter($d); $fieldcount = mssql_num_fields($d); // grab the number of fields for ($i = 0; $i < $fieldcount; $i++) { // loop over all of the fields $this->columnNames[] = mssql_field_name($d, $i); } if (mssql_num_rows($d) > 0) { mssql_data_seek($d, 0); while ($line = mssql_fetch_row($d)) { $this->rows[] = $line; } } }
/** * Constructor method for the adapter. This constructor implements the setting of the * 3 required properties for the object. * * @param resource $d The datasource resource */ function plainrecordsetAdapter($d) { $d = $d->data; parent::RecordSetAdapter($d); if (count($d) > 0) { $columns = array_keys($d[0]); } $this->columns = $columns; foreach ($d as $key => $val) { $row = array(); foreach ($columns as $key2 => $val2) { $row[] = $val[$val2]; } $this->rows[] = $row; } }
/** * Constructor method for the adapter. This constructor implements the setting of the * 3 required properties for the object. * * @param resource $d The datasource resource */ function arrayftAdapter($d) { $f = $d->filter; $t = $d->types; $d = $d->data; if ($t == NULL) { $t = str_repeat('s', count($f)); } parent::RecordSetAdapter($d); $fieldcount = count($f); $be = $this->isBigEndian; $this->columnNames = $f; //Start fast serializing $ob = ""; $fc = pack('N', $fieldcount); if (count($d) > 0) { $line = $d[0]; do { //Write array flag + length $ob .= "\n" . $fc; $i = 0; foreach ($f as $key) { $value = $line[$key]; if ($t[$i] == 'd') { $b = pack('d', $value); // pack the bytes if ($be) { // if we are a big-endian processor $r = strrev($b); } else { // add the bytes to the output $r = $b; } $ob .= "" . $r; } else { $os = $this->_directCharsetHandler->transliterate($value); //string flag, string length, and string $ob .= "" . pack('n', strlen($os)) . $os; } $i++; } } while ($line = next($d)); } $this->numRows = count($d); $this->serializedData = $ob; }
/** * Constructor method for the adapter. This constructor implements the setting of the * 3 required properties for the object. * * The body of this method was provided by Mario Falomir... Thanks. * * @param resource $d The datasource resource */ function odbcAdapter($d) { parent::RecordSetAdapter($d); // count number of fields $fieldcount = odbc_num_fields($d); // grab the number of fields // loop over all of the fields for ($i = 0; $i < $fieldcount; $i++) { // decode each field name ready for encoding when it goes through serialization // and save each field name into the array $this->columns[] = odbc_field_name($d, $i + 1); } if (odbc_num_rows($d) > 0) { $line = odbc_fetch_row($d, 0); do { $this->rows[] = $line; } while ($line = odbc_fetch_row($d)); } }
/** * Constructor method for the adapter. This constructor implements the setting of the * 3 required properties for the object. * * @param resource $d The datasource resource */ function mysqlAdapter($d) { parent::RecordSetAdapter($d); $fieldcount = mysql_num_fields($d); $intFields = array(); for ($i = 0; $i < $fieldcount; $i++) { $this->columns[] = mysql_field_name($d, $i); $type = mysql_field_type($d, $i); if (in_array($type, array('int', 'real', 'year'))) { $intFields[] = $i; } } while ($row = mysql_fetch_row($d)) { foreach ($intFields as $key => $val) { $row[$val] = (double) $row[$val]; } $this->rows[] = $row; } }
/** * Constructor method for the adapter. This constructor implements the setting of the * 3 required properties for the object. * * @param resource $d The datasource resource */ function CakeMysqlAdapter($d) { parent::RecordSetAdapter($d->results); $fieldcount = count($d->map); $intFields = array(); for ($i = 0; $i < $fieldcount; $i++) { $this->columns[] = $d->map[$i][0] . '_' . $d->map[$i][1]; $type = mysql_field_type($d->results, $i); if (in_array($type, array('int', 'real', 'year'))) { $intFields[] = $i; } } mysql_data_seek($d->results, 0); while ($row = mysql_fetch_row($d->results)) { foreach ($intFields as $key => $val) { $row[$val] = (double) $row[$val]; } $this->rows[] = $row; } }
function pdoAdapter($d) { parent::RecordSetAdapter($d); $ob = ""; $fc = pack('N', $d->columnCount()); $this->numRows = 0; if ($d->rowCount() > 0) { $line = $d->fetch(PDO::FETCH_ASSOC, PDO::FETCH_ORI_ABS, 0); do { if ($this->numRows === 0) { $c_index = 0; } $ob .= "\n" . $fc; foreach ($line as $k => &$v) { if ($this->numRows === 0) { $this->columnNames[$c_index++] = $this->_directCharsetHandler->transliterate($k); } if (is_string($v)) { // actually PDO ( and PDOStatement too ) doesn't have a fieldType method $os = $this->_directCharsetHandler->transliterate($v); $len = strlen($os); if ($len < 65536) { $ob .= "" . pack('n', $len) . $os; } else { $ob .= "\f" . pack('N', $len) . $os; } } else { $b = pack('d', $v); if ($this->isBigEndian) { $r = strrev($b); } else { $r = $b; } $ob .= "" . $r; } } $this->numRows++; } while ($line = $d->fetch(PDO::FETCH_ASSOC, PDO::FETCH_ORI_NEXT)); } $this->serializedData = $ob; }
function pdoAdapter($d) { parent::RecordSetAdapter($d); $line = $d->fetch(PDO::FETCH_ASSOC, PDO::FETCH_ORI_ABS, 0); if ($line != null) { $colNum = 0; $firstLine = array(); foreach ($line as $k => $v) { $this->columns[$colNum] = $k; $firstLine[] = $v; $colNum++; } $lastLines = $d->fetchAll(PDO::FETCH_NUM); if ($lastLines == NULL) { $this->rows = array($firstLine); } else { array_unshift($lastLines, $firstLine); $this->rows = $lastLines; } } }
/** * Constructor method for the adapter. This constructor implements the setting of the * 3 required properties for the object. * * @param resource $d The datasource resource */ function peardbAdapter($d) { parent::RecordSetAdapter($d); $fieldcount = $d->numCols(); $intFields = array(); $info = $d->dbh->tableInfo($d); for ($i = 0; $i < $fieldcount; $i++) { $this->columnNames[$i] = $this->_charsetHandler->transliterate($info[$i]['name']); $type = $info[$i]['type']; if (in_array($type, array('int', 'real', 'year'))) { $intFields[] = $i; } } if ($d->numRows() > 0) { $line = $d->fetchRow(DB_FETCHMODE_ORDERED, 0); do { foreach ($intFields as $key => $val) { $line[$val] = (double) $line[$val]; } $this->rows[] = $line; } while ($line = $d->fetchRow(DB_FETCHMODE_ORDERED, $rows)); } }
/** * Constructor method for the adapter. This constructor implements the setting of the * 3 required properties for the object. * * @param resource $d The datasource resource */ function sqliteAdapter($d) { parent::RecordSetAdapter($d); // grab all of the rows $fieldcount = sqlite_num_fields($d); $ob = ""; $fc = pack('N', $fieldcount); if (sqlite_num_rows($d) > 0) { sqlite_seek($d, 0); while ($line = sqlite_fetch_array($d, SQLITE_NUM)) { //Write array flag + length $ob .= "\n" . $fc; $to = count($line); for ($i = 0; $i < $to; $i++) { //Type everything as a string since this is sqlite $value = $line[$i]; $os = $this->_directCharsetHandler->transliterate($value); //string flag, string length, and string $len = strlen($os); if ($len < 65536) { $ob .= "" . pack('n', $len) . $os; } else { $ob .= "\f" . pack('N', $len) . $os; } } } } // grab the number of fields // loop over all of the fields for ($i = 0; $i < $fieldcount; $i++) { // decode each field name ready for encoding when it goes through serialization // and save each field name into the array $this->columnNames[$i] = $this->_directCharsetHandler->transliterate(sqlite_field_name($d, $i)); } $this->numRows = sqlite_num_rows($d); $this->serializedData = $ob; }
/** * Constructor method for the adapter. This constructor implements the setting of the * 3 required properties for the object. * * @param resource $d The datasource resource */ function adodbAdapter($d) { parent::RecordSetAdapter($d); $fieldcount = $d->FieldCount(); // grab the number of fields $ob = ""; $be = $this->isBigEndian; $fc = pack('N', $fieldcount); if ($d->RecordCount() > 0) { $d->MoveFirst(); while ($line = $d->FetchRow()) { // write all of the array elements $ob .= "\n" . $fc; for ($n = 0; $n < $d->Fieldcount(); $n++) { $value = $line[$n]; $fieldObj = $d->FetchField($n); $fieldtype = $d->MetaType($fieldObj->type); switch ($fieldtype) { case "C": case "X": case "D": case "T": case "B": $type = "string"; break; case "N": case "I": case "R": $type = "number"; break; case "L": $type = "boolean"; break; } // write all of the array elements if ($type == "string") { // type as string $os = $this->_directCharsetHandler->transliterate($value); //string flag, string length, and string $len = strlen($os); if ($len < 65536) { $ob .= "" . pack('n', $len) . $os; } else { $ob .= "\f" . pack('N', $len) . $os; } } elseif ($type == "number") { // type as double $b = pack('d', $value); // pack the bytes if ($be) { // if we are a big-endian processor $r = strrev($b); } else { // add the bytes to the output $r = $b; } $ob .= "" . $r; } elseif ($type == "boolean") { //type as bool $ob .= ""; $ob .= pack('c', $value); } elseif (is_null($value)) { // null $ob .= ""; } } } } $this->serializedData = $ob; for ($i = 0; $i < $fieldcount; $i++) { // loop over all of the fields $fld = $d->FetchField($i); $this->columnNames[] = $this->_directCharsetHandler->transliterate($fld->name); } $this->numRows = $d->RecordCount(); }