while ($data = fgetcsv($ihandle, MAX_CSV_LINE)) { // handle NULL values if (!empty($null_fields)) { foreach ($null_fields as $idx) { if ($data[$idx] == '') { $data[$idx] = NULL; } } } // handle blobs if (!empty($blob_fields)) { foreach ($blob_fields as $idx) { if (empty($data[$idx])) { $data[$idx] = NULL; } else { $blob_handle = fbird_blob_create($dbhandle) or ib_error(__FILE__, __LINE__); fbird_blob_add($blob_handle, $data[$idx]); $data[$idx] = fbird_blob_close($blob_handle) or ib_error(__FILE__, __LINE__); } } } call_user_func_array('fbird_execute', array_merge(array($query), $data)) or $ib_error = ib_error(__FILE__, __LINE__, $query); // an error occurs during the import if (!empty($ib_error)) { break; } $csv_cnt++; } fclose($ihandle); $sql = ''; // cleanup the watchtable output buffer
function OldUpdateBlob($table, $column, $val, $where, $blobtype = 'BLOB') { $blob_id = fbird_blob_create($this->_connectionID); fbird_blob_add($blob_id, $val); $blob_id_str = fbird_blob_close($blob_id); return $this->Execute("UPDATE {$table} SET {$column}=(?) WHERE {$where}", array($blob_id_str)) != false; }
case 'TIME': case 'TIMESTAMP': $bindargs[] = empty($field['notnull']) && empty($value) ? NULL : $value; break; case 'BLOB': // blob from file-upload if (is_array($value) && strlen(trim($value['name'])) > 0) { $bfname = $value['tmp_name']; $bfhandle = fopen($bfname, 'r') or die('cannot open file ' . $bfname); $bstr = fbird_blob_import($dbhandle, $bfhandle); fclose($bfhandle); $bindargs[] = $bstr; } elseif (isset($_POST['dt_edit_drop_blob_' . $instance . '_' . $k]) && empty($field['notnull'])) { $bindargs[] = NULL; } elseif (!empty($value)) { $bhandle = fbird_blob_create($dbhandle) or die('cannot create blob: ' . __FILE__ . ', ' . __LINE__); fbird_blob_add($bhandle, $value); $bstr = fbird_blob_close($bhandle); $bindargs[] = $bstr; } else { $bindargs[] = NULL; } break; default: if ($value == '') { $value = NULL; } $bindargs[] = empty($field['notnull']) && strlen($value) == 0 ? NULL : $value; } $cols[] = $field['name']; $k++;