SyuTingSong / phpliteadmin

Automatically exported from code.google.com/p/phpliteadmin
0 stars 0 forks source link

Cant import SQL that was exported from MySQL #31

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
It is me, again :-)

Dane, do you want me to crash your script again? :-)

Here is what happens when I try to import SQL code exported from MySQL

http://www.imagepost.ru/images/2/01/2011-06-01-020115_851x669_scro.png

Original issue reported on code.google.com by owl.brai...@gmail.com on 31 May 2011 at 10:03

GoogleCodeExporter commented 9 years ago
http://www.imagepost.ru/?v=2011-06-01-020115_851x669_scro.png

Original comment by owl.brai...@gmail.com on 31 May 2011 at 10:05

GoogleCodeExporter commented 9 years ago
Can you show me the contents of the .sql file you are trying to import? 

Original comment by daneirac...@gmail.com on 1 Jun 2011 at 12:03

GoogleCodeExporter commented 9 years ago
To be honest, the import and export are the most untested features of 
phpLiteAdmin. I am sure that trying to import MySQL data into an SQLite 
database will cause problems. I have never tried to do it, and something that 
has never been done will definitely not work the first time.

Original comment by daneirac...@gmail.com on 1 Jun 2011 at 5:37

GoogleCodeExporter commented 9 years ago
I try to import only part of the SQL file I tried to import yesterday. And now 
no errors were printed but also no actions were executed printing happy caption 
"Import was successful." :-)

If script cannot understand sql code, it must type this. It must not crash with 
PHP warnings and errors. On every action there must be adequate answer.

Here is file. It is small example but full of mysql-specific instructions.

Original comment by owl.brai...@gmail.com on 1 Jun 2011 at 12:16

Attachments:

GoogleCodeExporter commented 9 years ago
I agree. The tool should be able to handle any sql code... unfortunately, it is 
not developed enough in this area to do that. I would love for bugs to just not 
exist and for everything to work they way it should, but that's not the nature 
of software. If something isn't specified, it's going to have unpredictable 
behavior. 

I'll take a look at your sql file after my classes today.

Original comment by daneirac...@gmail.com on 1 Jun 2011 at 4:31

GoogleCodeExporter commented 9 years ago
This is not going to fix easily. I am giving up for now. Someone else can try 
to fix it if they have the patience.

Original comment by daneirac...@gmail.com on 7 Jun 2011 at 4:58

GoogleCodeExporter commented 9 years ago
Well, I do not quite agree that phpLiteAdmin should be able to handle any sql 
code. It should be able to handle any SQL code supported by SQLite. Anything 
else would be just impossible. First of all, it would be impossible to even 
handle the latest SQL standard, SQL-2011. We cannot handle object-relational 
features in phpLiteAdmin if SQLiteAdmin doesn't. SQLiteAdmin does not even 
completely implement SQL92 (although nearly complete). And on top of any SQL 
standard, there are hundreds of SQL dialects like MySQL's, db2's, oracle's, 
postreSQL's, MSSQL's just to name a few important ones. There is no way to 
handle all this SQL.

Maybe transforming MySQL to SQLite SQL would be an interesting feature, though, 
as lots of projects might migrate this way. But in case we want to support 
this, we should use some existing code that does the job.
I found some intersting things, but I guess most of them are incomplete, as 
MySQL supports lots of things SQLite doesn't.

Things I found:
https://gist.github.com/803375
  PHP-script. Does _not_ convert MySQL dumps but rather fetches the schema out of a MySQL DB and creates it in a SQLite DB. Different approach, but interestung, though.

https://gist.github.com/943776
  awk/Shell-script. Looks good, but I guess incomplete. But there is no simple way to integrate this into phpLiteAdmin other than shell_exec which would not work on lots of systems (security meassures blocking, awk not being installed, ...). Maybe this could be "ported" to PHP (based on regex or similar), but I consider this quite hard and a lot of rewriting.

http://forums.mysql.com/read.php?145,68269,92627
  Shell script (grep/perl-based). Looks very small but I guess very incomplete as well. Would be more easy to be ported using preg-functions in php.

But any way, adding this feature would add quite a lot of code to phpLiteAdmin 
compared to its size. So I am not sure, if we really want to go this way. Maybe 
we could offer some "add-on" which you just drop in the same folder?

Original comment by crazy4ch...@gmail.com on 2 Jun 2012 at 9:55

GoogleCodeExporter commented 9 years ago
This would be an interesting feature, and I do think it should be an add-on 
dropped in the same directory. I don't think I've seen another SQLite admin 
tool that can do this.

If we implement a MySQL to SQLite porting tool, it should simply take a MySQL 
dump and convert it to a SQLite dump. In turn, we can feed that SQLite dump 
into the already existing SQL importer in phpLiteAdmin. It would just be string 
copying and manipulation. 

For that matter, we could create an entire series of ports for various other 
database systems, all separate add-ons that can be installed on a per-use basis.

Original comment by daneirac...@gmail.com on 2 Jun 2012 at 10:27