function export_data($export) { global $s_fields, $warning; ini_set('ibase.dateformat', $export['general']['date']); ini_set('ibase.timeformat', $export['general']['time']); ini_set('ibase.timestampformat', $export['general']['date'] . ' ' . $export['general']['time']); if ($export['format'] == 'sql' && $export['sql']['info']) { echo sql_export_info($export, replace_escape_sequences($export['sql']['lineend'])); } foreach (export_queries($export) as $query) { if (DEBUG) { add_debug($query, __FILE__, __LINE__); } $trans = fbird_trans(TRANS_READ, $dbhandle); $res = @fbird_query($trans, $query); if ($res === FALSE) { $ib_error = fbird_errmsg(); $warning = ''; return FALSE; } $columns = $col_types = $num_fields = array(); $num = fbird_num_fields($res); for ($idx = 0; $idx < $num; $idx++) { $info = fbird_field_info($res, $idx); $columns[] = $info['name']; $col_types[] = $info['type']; $num_fields[] = is_number_type(substr($info['type'], 0, strcspn($info['type'], '('))); } $tablename = $info['relation']; $export['query'] = array('source' => $query, 'columns' => $columns, 'col_types' => $col_types, 'num_fields' => $num_fields, 'result' => $res); switch ($export['format']) { case 'csv': export_csv_data($export); break; case 'sql': export_sql_data($export, $tablename); break; case 'ext': printf('Export data to %s is still not implemented!', $export['format']); break; default: echo 'Unsupported export format!'; } fbird_free_result($res); fbird_commit($trans); } }
function FetchField($fieldOffset = -1) { $fld = new ADOFieldObject(); $ibf = fbird_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; }
function get_field_info($res) { $info = array(); $num = fbird_num_fields($res); for ($i = 0; $i < $num; $i++) { $info[] = fbird_field_info($res, $i); } return $info; }