The branch, master has been updated
       via  ef43e2fce8ff8aa5aaf455fd03fb27531ce60ccb (commit)
       via  d2276d5ddab9f3f0bc6a47cf0a713f7c5a08e417 (commit)
      from  20ca1e471c61f8c3c0497f71ab182a3f7b83fc15 (commit)


- Log -----------------------------------------------------------------
commit ef43e2fce8ff8aa5aaf455fd03fb27531ce60ccb
Author: Madhura Jayaratne <[email protected]>
Date:   Sun Sep 18 14:47:26 2011 +0530

    Proper handling of set type columns in zoom editor

commit d2276d5ddab9f3f0bc6a47cf0a713f7c5a08e417
Author: Madhura Jayaratne <[email protected]>
Date:   Sun Sep 18 12:10:46 2011 +0530

    Avoid b'null' and b'' for bit fields. No space before comma and single 
space after comma in SQL query

-----------------------------------------------------------------------

Summary of changes:
 js/tbl_zoom_plot.js |   33 +++++++++++++++++++++++----------
 1 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/js/tbl_zoom_plot.js b/js/tbl_zoom_plot.js
index 3e760df..3f8d00b 100644
--- a/js/tbl_zoom_plot.js
+++ b/js/tbl_zoom_plot.js
@@ -273,6 +273,11 @@ $(document).ready(function() {
             if (key != 'where_clause') {
                 var oldVal = selectedRow[key];
                 var newVal = ($('#fields_null_id_' + it).attr('checked')) ? 
null : $('#fieldID_' + it).val();
+                if (newVal instanceof Array) { // when the column is of type 
SET
+                    newVal =  $('#fieldID_' + it).map(function(){
+                        return $(this).val();
+                    }).get().join(",");
+                }
                 if (oldVal != newVal) {
                     selectedRow[key] = newVal;
                     newValues[key] = newVal;
@@ -383,18 +388,20 @@ $(document).ready(function() {
                 if (key != 'where_clause') {
                     sql_query += '`' + key + '`=' ;
                     var value = newValues[key];
-                    if (sqlTypes[key] != null) {
-                        if (sqlTypes[key] == 'bit') {
-                            sql_query += 'b\'' + value + '\' ,';
+                    if (sqlTypes[key] != null && value != null) {
+                        if (sqlTypes[key] == 'bit' && value != '') {
+                            sql_query += 'b\'' + value + '\', ';
+                        } else {
+                            sql_query += '\'\', ';
                         }
                     } else if (!isNumeric(value) && value != null) {
-                        sql_query += '\'' + value + '\' ,';
+                        sql_query += '\'' + value + '\', ';
                     } else {
-                        sql_query += value + ' ,';
+                        sql_query += value + ', ';
                     }
                 }
             }
-            sql_query = sql_query.substring(0, sql_query.length - 1);
+            sql_query = sql_query.substring(0, sql_query.length - 2);
             sql_query += ' WHERE ' + 
PMA_urldecode(data[currentData]['where_clause']);
 
             //Post SQL query to sql.php
@@ -479,12 +486,18 @@ $(document).ready(function() {
                                 $.post('tbl_zoom_select.php', post_params, 
function(data) {
                                     // Row is contained in data.row_info, now 
fill the displayResultForm with row values
                                     for (key in data.row_info) {
+                                        $field = $('#fieldID_' + fid);
+                                        $field_null = $('#fields_null_id_' + 
fid);
                                         if (data.row_info[key] == null) {
-                                            $('#fields_null_id_' + 
fid).attr('checked', true);
-                                            $('#fieldID_' + fid).val('');
+                                            $field_null.attr('checked', true);
+                                            $field.val('');
                                         } else {
-                                            $('#fields_null_id_' + 
fid).attr('checked', false);
-                                            $('#fieldID_' + 
fid).val(data.row_info[key]);
+                                            $field_null.attr('checked', false);
+                                            if ($field.attr('multiple')) { // 
when the column is of type SET
+                                                
$field.val(data.row_info[key].split(','));
+                                            } else {
+                                                $field.val(data.row_info[key]);
+                                            }
                                         }
                                         fid++;
                                     }


hooks/post-receive
-- 
phpMyAdmin

------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
_______________________________________________
Phpmyadmin-git mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/phpmyadmin-git

Reply via email to