fix dumping clustering info
Need to fix:
+* After changing password need to update data structures to avoid logouts
* The getType function needs to be ported to 7.2 and 7.3 classes to add
pretty type name and schema support
* Report login errors
/**
* Does an import to a particular table from a text file
*
- * $Id: dataimport.php,v 1.8 2005/03/04 02:27:38 chriskl Exp $
+ * $Id: dataimport.php,v 1.9 2005/10/05 13:05:32 chriskl Exp $
*/
// Prevent timeouts on large exports (non-safe mode only)
}
}
+ function LoadNULLArray(&$Array) {
+ $Success = true;
+ $AllowedNulls = $_POST['AllowedNulls'];
+ if (!is_null($AllowedNulls)) {
+ $Array = array();
+ foreach($AllowedNulls as $NullChar) {
+ if ($NullChar == 'Default') {
+ $Array[2] = "\\N";
+ } else if ($NullChar == 'NULL') {
+ $Array[0] = "NULL";
+ } else if ($NullChar == 'EmptyString') {
+ $Array[1] = null;
+ } else {
+ $misc->printMsg(sprintf($lang['strimporter-badnull'], $NullChar));
+ exit;
+ }
+ }
+ }
+ }
+
+ function DetermineNull($field, $NullArray) {
+ $FoundANull = false;
+ while((list($Ignored, $Nulls) = each($NullArray)) && ($FoundANull == false)) {
+ if ($Nulls == $field) {
+ $FoundANull = true;
+ }
+ }
+ reset($NullArray);
+ return $FoundANull;
+ }
+
$misc->printHeader($lang['strimport']);
$misc->printTrail('table');
$fd = fopen($_FILES['source']['tmp_name'], 'r');
// Check that file was opened successfully
if ($fd !== false) {
+ $NullArray = null;
+ LoadNULLArray($NullArray);
$status = $data->beginTransaction();
if ($status != 0) {
- $misc->printMsg($lang['strimporterror']);
+ $misc->printMsg($lang['strimporterror-badtransaction']);
exit;
}
break;
default:
$data->rollbackTransaction();
- $misc->printMsg($lang['strimporterror']);
+ $misc->printMsg($lang['strimporterror-fileformat']);
exit;
}
}
else $csv_delimiter = "\t";
// Get first line of field names
$fields = fgetcsv($fd, $csv_max_line, $csv_delimiter);
- $row = 1;
+ $row = 2; //We start on the line AFTER the field names
while ($line = fgetcsv($fd, $csv_max_line, $csv_delimiter)) {
// Build value map
$vars = array();
foreach ($fields as $f) {
// Check that there is a column
if (!isset($line[$i])) {
- $misc->printMsg(sprintf($lang['strimporterrorline'], $row));
+ $misc->printMsg(sprintf($lang['strimporterrorline-badcolumnnum'], $row));
exit;
}
// Check for nulls
- if ($line[$i] == '\\N') $nulls[$f] = 'on';
+ if (DetermineNull($line[$i], $NullArray)) {
+ $nulls[$f] = 'on';
+ }
// Add to value array
$vars[$f] = $line[$i];
// Format is always VALUE
$status = $data->insertRow($_REQUEST['table'], $vars, $nulls, $format, $types);
if ($status != 0) {
$data->rollbackTransaction();
- $misc->printMsg(sprintf($lang['strimporterrorline'], $row));
+ $misc->printMsg(sprintf($lang['strimporterrorline-dberror'], $row));
exit;
}
$row++;
$status = $data->endTransaction();
if ($status != 0) {
- $misc->printMsg($lang['strimporterror']);
+ $misc->printMsg($lang['strimporterror-badtransaction']);
exit;
}
fclose($fd);
}
else {
// File could not be opened
- $misc->printMsg($lang['strimporterror']);
+ $misc->printMsg($lang['strimporterror-unopenedfile']);
}
}
else {
// Upload went wrong
- $misc->printMsg($lang['strimporterror']);
+ $misc->printMsg($lang['strimporterror-uploadedfile']);
}
$misc->printFooter();
* English language file for phpPgAdmin. Use this as a basis
* for new translations.
*
- * $Id: english.php,v 1.181 2005/08/11 23:01:44 soranzo Exp $
+ * $Id: english.php,v 1.182 2005/10/05 13:05:32 chriskl Exp $
*/
// Language and character set
$lang['strprimary'] = 'Primary';
$lang['strexport'] = 'Export';
$lang['strimport'] = 'Import';
+ $lang['strAllowedNulls'] = 'Allowed Null Characters';
+ $lang['strNULL'] = 'NULL (The word)';
+ $lang['strEmptyString'] = 'Empty String/Field';
+ $lang['strBackslashN'] = '\N (Export Default)';
$lang['strsql'] = 'SQL';
$lang['stradmin'] = 'Admin';
$lang['strvacuum'] = 'Vacuum';
$lang['strnoreportsdb'] = 'You have not created the reports database. Read the INSTALL file for directions.';
$lang['strnouploads'] = 'File uploads are disabled.';
$lang['strimporterror'] = 'Import error.';
+ $lang['strimporter-badnull'] = 'The NULL character you have supplied [%s], has not been configured for use yet.';
+ $lang['strimporterror-badtransaction'] = 'Import error (There was a problem starting/ending the transaction).';
+ $lang['strimporterror-fileformat'] = 'Import error (Failed to determine which file format was given).';
$lang['strimporterrorline'] = 'Import error on line %s.';
+ $lang['strimporterrorline-badcolumnnum'] = 'Import error on line %s. (This line does not possess the correct number of columns)';
+ $lang['strimporterrorline-dberror'] = 'Import error on line %s. (This line could not be inserted into the database)';
+ $lang['strimporterror-unopenedfile'] = 'Import error (Uploaded file could not be opened by the import engine)';
+ $lang['strimporterror-uploadedfile'] = 'Import error: (File could not be uploaded to the server)';
$lang['strcannotdumponwindows'] = 'Dumping of complex table and schema names on Windows is not supported.';
// Tables
* English language file for phpPgAdmin. Use this as a basis
* for new translations.
*
- * $Id: english.php,v 1.133 2005/08/11 23:01:45 soranzo Exp $
+ * $Id: english.php,v 1.134 2005/10/05 13:05:32 chriskl Exp $
*/
// Language and character set
$lang['strprimary'] = 'Primary';
$lang['strexport'] = 'Export';
$lang['strimport'] = 'Import';
+ $lang['strAllowedNulls'] = 'Allowed Null Characters';
+ $lang['strNULL'] = 'NULL (The word)';
+ $lang['strEmptyString'] = 'Empty String/Field';
+ $lang['strBackslashN'] = '\N (Export Default)';
$lang['strsql'] = 'SQL';
$lang['stradmin'] = 'Admin';
$lang['strvacuum'] = 'Vacuum';
$lang['strnoreportsdb'] = 'You have not created the reports database. Read the INSTALL file for directions.';
$lang['strnouploads'] = 'File uploads are disabled.';
$lang['strimporterror'] = 'Import error.';
+ $lang['strimporter-badnull'] = 'The NULL character you have supplied [%s], has not been configured for use yet.';
+ $lang['strimporterror-badtransaction'] = 'Import error (There was a problem starting/ending the transaction).';
+ $lang['strimporterror-fileformat'] = 'Import error (Failed to determine which file format was given).';
$lang['strimporterrorline'] = 'Import error on line %s.';
+ $lang['strimporterrorline-badcolumnnum'] = 'Import error on line %s. (This line does not possess the correct number of columns)';
+ $lang['strimporterrorline-dberror'] = 'Import error on line %s. (This line could not be inserted into the database)';
+ $lang['strimporterror-unopenedfile'] = 'Import error (Uploaded file could not be opened by the import engine)';
+ $lang['strimporterror-uploadedfile'] = 'Import error: (File could not be uploaded to the server)';
$lang['strcannotdumponwindows'] = 'Dumping of complex table and schema names on Windows is not supported.';
// Tables
/**
* List tables in a database
*
- * $Id: tblproperties.php,v 1.63 2005/05/02 15:47:24 chriskl Exp $
+ * $Id: tblproperties.php,v 1.64 2005/10/05 13:05:32 chriskl Exp $
*/
// Include application functions
echo "<option value=\"xml\">XML</option>\n";
}
echo "</select>\n</td>\n</tr>\n";
+ echo "<tr><th class=\"data left required\">{$lang['strAllowedNulls']}</th>";
+ echo "<td><select multiple size=\"3\" name=\"AllowedNulls[]\">\n";
+ echo "<option value=\"Default\">{$lang['strBackslashN']}</option>\n";
+ echo "<option value=\"NULL\">{$lang['strNULL']}</option>\n";
+ echo "<option value=\"EmptyString\">{$lang['strEmptyString'] }</option>\n";
+ echo "</select>\n</td>\n</tr>\n";
echo "<tr><th class=\"data left required\">{$lang['strfile']}</th>";
echo "<td><input type=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"{$max_size}\" />\n";
echo "<input type=\"file\" name=\"source\" />\n";