} else {
     $ifile = $_FILES['dt_import_file']['tmp_name'];
     $itable = $_POST['dt_import_table'];
     $ihandle = fopen($ifile, 'r') or die('Error opening ' . $ifile);
     // fill $columns[] with the $s_fields[] elements for $itable
     // but ignore blob fields and computed fields
     foreach ($s_fields[$itable] as $field) {
         if ($field['type'] == 'BLOB' && $field['stype'] != 1 || isset($field['comp']) && $field['comp'] == 'Yes') {
             // no computed columns please
             continue;
         }
         $col_names[] = $field['name'];
         $columns[] = $field;
     }
     $sql = 'INSERT INTO ' . $itable . '(' . implode(', ', $col_names) . ')' . ' VALUES (' . implode(', ', array_fill(0, count($col_names), '?')) . ')';
     $query = fbird_prepare($sql) or ib_error(__FILE__, __LINE__, $sql);
     // string of variablenames needed for fbird_execute()
     $var_string = '';
     foreach (array_keys($col_names) as $idx) {
         $var_string .= '$data[' . $idx . '],';
     }
     $var_string = substr($var_string, 0, -1);
     // find indexes of blob fields and NULL-able fields
     $blob_fields = array();
     $null_fields = array();
     $idx = 0;
     foreach ($s_fields[$itable] as $field) {
         if ($field['type'] == 'BLOB') {
             $blob_fields[] = $idx;
         }
         if ($s_csv['import_null'] == TRUE && (!isset($field['notnull']) || empty($field['notnull']))) {
 function Prepare($sql)
 {
     $stmt = fbird_prepare($this->_connectionID, $sql);
     if (!$stmt) {
         return false;
     }
     return array($sql, $stmt);
 }
function insert_row($table, $cols, $values)
{
    $quote = identifier_quote($GLOBALS['s_login']['dialect']);
    $sql = 'INSERT INTO ' . $quote . $table . $quote . ' (' . $quote . implode($quote . ', ' . $quote, $cols) . $quote . ')' . ' VALUES (' . substr(str_repeat('?, ', count($values)), 0, -2) . ')';
    if (DEBUG) {
        add_debug('$sql: ' . $sql, __FILE__, __LINE__);
    }
    $query = fbird_prepare($GLOBALS['dbhandle'], $sql) or ib_error(__FILE__, __LINE__, $sql);
    $ib_error = '';
    call_user_func_array('fbird_execute', array_merge(array($query), $values)) or $ib_error = fbird_errmsg();
    fbird_free_query($query);
    return $ib_error;
}