[Phpmyadmin-devel] split_sql_file produces sometimes wrong pieces

webmaster at trafficg.com webmaster at trafficg.com
Thu Aug 2 21:55:18 CEST 2001


Hi

Re:
**********************

1480:           if ($last_char == $in_string && $char == ')') {
1481:                $in_string = FALSE;
1482:            }
if you remove the parenthesis in the second row, readdump has no problems.
Yes, that's the question I was asking to pete kelly about split_sql().

***********************

Yes I added that line and it was to fix an error involving round brackets.

To be completely honest there is no real fix to this and other smaller bugs
using the current system and layout. The problem is that readdump.php is
set-up to try and handle too many different types of queries. On one hand it
has to be able to accept backups from files, on the other it has to be able
to accept single or multiple, escaped and non-escaped queries.


> Actually, there is another big bug in this function that is here
> since the very begining of phpMyAdmin. Try that kind of manual SQL
> insert and it won't work:
> insert into table values ('\\');insert into table values ('\\');


This problem can be fixed with some quite complex code, but is will make the
code so slow it will be absolutely useless for database/table restoration.

The only solution I can think of is to split the database restore code from
the normal queries text box and to limit the queries text box to just one
query at a time. Also include a tick box to let the code know if the data is
pre-escaped or not.

So the choice is to either live with the current small bugs or rethink and
redesign the whole section.

I have included a small test table containing lots of different symbols,
this was the test data used to verify the current system.


Pete Kelly




----- Original Message -----
From: "Benjamin Gandon" <gandon at isia.cma.fr>
To: <phpmyadmin-devel at lists.sourceforge.net>
Sent: Friday, August 03, 2001 2:06 AM
Subject: Re: [Phpmyadmin-devel] split_sql_file produces sometimes wrong
pieces


>
> > (210,20010731131330,'Matrix','dadad' in Zeile 1.
> >                           ^ here is the problem.
>
> Not exactly. :)
> It's in fact there:
> (209,20010731131330,'Matrix','(\'dadada\')',1);
>                                          ^
> because of that line of code in lib.inc.php3:
>
> 1480:           if ($last_char == $in_string && $char == ')') {
> 1481:                $in_string = FALSE;
> 1482:            }
>
>
> > if you remove the parenthesis in the second row, readdump has
> > no problems.
>
> Yes, that's the question I was asking to pete kelly about split_sql().
>
> Actually, there is another big bug in this function that is here
> since the very begining of phpMyAdmin. Try that kind of manual SQL
> insert and it won't work:
> insert into table values ('\\');insert into table values ('\\');
>
> The thing is that you have to know if there is an odd number of
> backslashes before a quote to know if it is escaped or not.
> Previously, split_sql_file() only checked if there was a backslash
> before a quote. But that backslash could be escaped by another
> backslash.
> The new alorithm I coded should be ok in that matter.
>
> I've already recoded the function and I just managed to commit my
> changes (curiously I had to try to connect to cvs.sf.net with ssh
> to create my home directory there and then be able to connect to
> cvs via ssh...)
>
>
> > The problem in split_sql_file is row 1480 which try to detect the last
> > ')' char.
>
> Exactly. And that's a quick hack (Pete didn't answer my question about
> it in my message "a bit of story about split_string()").
>
>
> Benjamin
>
> _______________________________________________
> Phpmyadmin-devel mailing list
> Phpmyadmin-devel at lists.sourceforge.net
> http://lists.sourceforge.net/lists/listinfo/phpmyadmin-devel
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: testdata.sql
Type: application/octet-stream
Size: 2914 bytes
Desc: not available
URL: <http://lists.phpmyadmin.net/pipermail/developers/attachments/20010802/dc3549f6/attachment.obj>


More information about the Developers mailing list