[Phpmyadmin-git] [SCM] phpMyAdmin branch, master, updated. RELEASE_3_4_0BETA4-1797-gf6fb9b4

Marc Delisle lem9 at users.sourceforge.net
Thu Apr 7 19:02:16 CEST 2011


The branch, master has been updated
       via  f6fb9b46785dde20c09524a77fd200f44458e94c (commit)
      from  9433f4e78fdc847554d900ea440e642685d8dd75 (commit)


- Log -----------------------------------------------------------------
commit f6fb9b46785dde20c09524a77fd200f44458e94c
Author: onebighack <onebighack at users.sourceforge.net>
Date:   Thu Apr 7 13:01:57 2011 -0400

    Patch #3249406 Error in updating using inline edit

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

Summary of changes:
 js/sql.js |   24 ++++++++++++++++++++++--
 1 files changed, 22 insertions(+), 2 deletions(-)

diff --git a/js/sql.js b/js/sql.js
index 078f3a2..4e34126 100644
--- a/js/sql.js
+++ b/js/sql.js
@@ -18,6 +18,10 @@ function PMA_urldecode(str) {
     return decodeURIComponent(str.replace(/\+/g, '%20'));
 }
 
+function PMA_urlencode(str) {
+    return encodeURIComponent(str.replace(/\%20/g, '+'));
+}
+
 /**
  * Get the field name for the current field.  Required to construct the query
  * for inline editing
@@ -683,7 +687,6 @@ $(document).ready(function() {
                         'token' : window.parent.token,
                         'curr_value' : curr_value
                 }
-
                 $.post('sql.php', post_params, function(data) {
                     $this_field.append(data.dropdown);
                     $this_field.data('original_data', data_value);
@@ -791,6 +794,9 @@ $(document).ready(function() {
         var sql_query = 'UPDATE `' + window.parent.table + '` SET ';
 
         var need_to_post = false;
+        
+        var new_clause='';
+        var prev_index=-1;
 
         $input_siblings.each(function() {
             /** @lends jQuery */
@@ -849,6 +855,9 @@ $(document).ready(function() {
                         $.extend(relation_fields, this_field_params);
                     }
                 }
+                    if(where_clause.indexOf(field_name) > prev_index){
+                        new_clause += '`'+window.parent.table+'`.'+'`' + field_name + "` = '"+this_field_params[field_name].replace(/'/g,"''")+"'"+' AND ';
+                    }
                 if (this_field_params[field_name] != $this_field.data('original_data')) {
                     sql_query += ' `' + field_name + "`='" + this_field_params[field_name].replace(/'/g, "''") + "' , ";
                     need_to_post = true;
@@ -856,10 +865,15 @@ $(document).ready(function() {
             }
         })
 
+        /*  
+         * update the where_clause, remove the last appended ' AND '
+         * */
+
         //Remove the last ',' appended in the above loop
         sql_query = sql_query.replace(/,\s$/, '');
+        new_clause=new_clause.substring(0,new_clause.length-5);
+        new_clause=PMA_urlencode(new_clause);
         sql_query += ' WHERE ' + PMA_urldecode(where_clause);
-
         /**
          * @var rel_fields_list  String, url encoded representation of {@link relations_fields}
          */
@@ -897,6 +911,12 @@ $(document).ready(function() {
             $.post('tbl_replace.php', post_params, function(data) {
                 if(data.success == true) {
                     PMA_ajaxShowMessage(data.message);
+                    if(disp_mode == 'vertical') {
+                        $this_td.parents('tbody').find('tr').find('.where_clause:nth('+this_td_index+')').attr('value',new_clause);
+                    }
+                    else {
+                        $this_td.parent('tr').find('.where_clause').attr('value',new_clause);
+                    }
                     // remove possible previous feedback message
                     $('#result_query').remove();
                     if (typeof data.result_query != 'undefined') {


hooks/post-receive
-- 
phpMyAdmin




More information about the Git mailing list