insert a row if BLOB is empty

This commit is contained in:
Marc Delisle
2007-03-31 12:18:40 +00:00
parent 120f91ff6f
commit b2bdcbc35a
2 changed files with 5 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
<?php
/**
* f i e l d u p l o a d e d f r o m a f i l e
* handle field values (possibly uploaded from a file)
*
* garvin: original if-clause checked, whether input was stored in a possible
* fields_upload_XX var. Now check, if the field is set. If it is empty or a

View File

@@ -223,7 +223,10 @@ foreach ($loop_array as $primary_key) {
// i n s e r t
if ($is_insert) {
// no need to add column into the valuelist
if (strlen($cur_value)) {
$query_values[] = $cur_value;
$query_fields[] = PMA_backquote($key);
}
// u p d a t e
} elseif (!empty($me_fields_null_prev[$key])
@@ -265,10 +268,6 @@ unset($me_fields_prev, $me_funcs, $me_fields_type, $me_fields_null, $me_fields_n
// Builds the sql query
if ($is_insert && count($value_sets) > 0) {
// first inserted row -> prepare template
foreach ($me_fields as $key => $val) {
$query_fields[] = PMA_backquote($key);
}
$query[] = 'INSERT INTO ' . PMA_backquote($GLOBALS['db']) . '.' . PMA_backquote($GLOBALS['table'])
. ' (' . implode(', ', $query_fields) . ') VALUES (' . implode('), (', $value_sets) . ')';