コード例 #1
0
function export_sql_data($export, $table)
{
    global $ib_error, $warning, $dbhandle;
    $line_ending = replace_escape_sequences($export['sql']['lineend']);
    $replace_null = $export['general']['replnull'];
    $target_table = export_replace_placeholders($export['sql']['ttable'], $GLOBALS['s_login']['database'], $table);
    $columns_list = '';
    if ($export['sql']['cnames']) {
        $quote = $export['sql']['qnames'] ? '"' : '';
        $columns_list = '(' . $quote . implode($quote . ', ' . $quote, $export['query']['columns']) . $quote . ')';
    }
    $num = fbird_num_fields($export['query']['result']);
    // build one line for the csv file from every result object
    while ($row = @fbird_fetch_row($export['query']['result'], IBASE_TEXT)) {
        $values_list = '';
        for ($idx = 0; $idx < $num; $idx++) {
            if ($row[$idx] === NULL) {
                $value = $replace_null;
            } else {
                $value = prepare_export_value($row[$idx], $export['query']['col_types'][$idx]);
            }
            $values_list .= $export['query']['num_fields'][$idx] || $row[$idx] === NULL ? $value . ', ' : "'" . $value . "', ";
        }
        $values_list = '(' . substr($values_list, 0, -2) . ')';
        echo 'INSERT INTO ' . $target_table . ' ' . $columns_list . ' VALUES ' . $values_list . ';' . $line_ending;
    }
    echo $line_ending;
}
コード例 #2
0
 function _initrs()
 {
     $this->_numOfRows = -1;
     $this->_numOfFields = @fbird_num_fields($this->_queryID);
     // cache types for blob decode check
     for ($i = 0, $max = $this->_numOfFields; $i < $max; $i++) {
         $f1 = $this->FetchField($i);
         $this->_cacheType[] = $f1->type;
     }
 }
コード例 #3
0
ファイル: sql.php プロジェクト: silvadelphi/firebirdwebadmin
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;
}