Menu

#439 (ok 3.1.3) Multi row change with "]"

closed-accepted
1
2009-02-28
2009-01-09
Virsacer
No

On multi row change PMA gets the SQL error "Unclosed quote" if $unique_condition contains "]"

Example:
CREATE TABLE test (name varchar(255) NOT NULL);
INSERT INTO test VALUES(']');

View the table and click "Check All" then click "With selected: Change"

Discussion

  • Virsacer

    Virsacer - 2009-01-09
     
  • Marc Delisle

    Marc Delisle - 2009-01-11
    • assigned_to: nobody --> lem9
     
  • Marc Delisle

    Marc Delisle - 2009-01-11

    I think that this would be better, please give me your feedback:

    Index: tbl_change.php

    --- tbl_change.php (revision 12166)
    +++ tbl_change.php (copie de travail)
    @@ -165,7 +165,7 @@
    $result = array();
    $found_unique_key = false;
    foreach ($primary_key_array as $key_id => $primary_key) {
    - $local_query = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' WHERE ' . $primary_key . ';';
    + $local_query = 'SELECT * FROM ' . PMA_backquote($db) . '.' . PMA_backquote($table) . ' WHERE ' . urldecode($primary_key) . ';';
    $result[$key_id] = PMA_DBI_query($local_query, null, PMA_DBI_QUERY_STORE);
    $rows[$key_id] = PMA_DBI_fetch_assoc($result[$key_id]);
    $primary_keys[$key_id] = str_replace('\\', '\\\\', $primary_key);
    Index: libraries/display_tbl.lib.php
    ===================================================================
    --- libraries/display_tbl.lib.php (revision 12166)
    +++ libraries/display_tbl.lib.php (copie de travail)
    @@ -1047,7 +1047,7 @@
    * avoid to display the delete and edit links
    */
    $unique_condition = PMA_getUniqueCondition($dt_result, $fields_cnt, $fields_meta, $row);
    - $unique_condition_html = htmlspecialchars($unique_condition);
    + $unique_condition_html = urlencode($unique_condition);

    // 1.2 Defines the URLs for the modify/delete link(s)

     
  • Virsacer

    Virsacer - 2009-01-11

    Yes, this is better...

     
  • Marc Delisle

    Marc Delisle - 2009-01-12

    Hmm, my patch is not good for multi-row change.

     
  • Virsacer

    Virsacer - 2009-01-12

    Why not?

    Are other values not working instead?

     
  • Marc Delisle

    Marc Delisle - 2009-01-13

    My patch would produce an invalid WHERE clause containing urlencoded values. But I just tested your patch and it does not work. Well, it eliminates the "Unclosed quote" message, but on the change panel, changing the value for something else does not work as the following query is generated:
    UPDATE `base2_bug2496403`.`test` SET `name` = ']X' WHERE `test`.`name` = ']' LIMIT 1 ;

     
  • Marc Delisle

    Marc Delisle - 2009-01-13
    • status: open --> pending-rejected
     
  • Virsacer

    Virsacer - 2009-01-13

    Ok, I will look into it again if I have some time...

     
  • Virsacer

    Virsacer - 2009-01-13
     
  • Virsacer

    Virsacer - 2009-01-13

    Simple solution - just in another file...
    see patch.diff

     
  • Marc Delisle

    Marc Delisle - 2009-01-13
    • status: pending-rejected --> open
     
  • Marc Delisle

    Marc Delisle - 2009-01-13

    Merged in subversion, thanks.

     
  • Marc Delisle

    Marc Delisle - 2009-01-13
    • priority: 5 --> 1
    • summary: Multi row change with "]" --> (ok 3.1.3) Multi row change with "]"
    • status: open --> open-accepted
     
  • Marc Delisle

    Marc Delisle - 2009-02-28
    • status: open-accepted --> closed-accepted
     
MongoDB Logo MongoDB