Skip to content

Commit

Permalink
insert a row if BLOB is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
lem9 committed Mar 31, 2007
1 parent 120f91f commit b2bdcbc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion libraries/tbl_replace_fields.inc.php
Original file line number Diff line number Diff line change
@@ -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
Expand Down
9 changes: 4 additions & 5 deletions tbl_replace.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,10 @@
// i n s e r t
if ($is_insert) {
// no need to add column into the valuelist
$query_values[] = $cur_value;
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])
Expand Down Expand Up @@ -265,10 +268,6 @@

// 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) . ')';

Expand Down

0 comments on commit b2bdcbc

Please sign in to comment.