Cant import SQL that was exported from MySQL

Issue #31 open
Former user created an issue

Originally reported on Google Code with ID 31 ``` 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 ```

Reported by `owl.brainworker` on 2011-05-31 22:03:44

Comments (8)

  1. Dane Iracleous

    ``` Can you show me the contents of the .sql file you are trying to import? ```

    Reported by `diracleo` on 2011-06-01 00:03:32

  2. Dane Iracleous

    ``` 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. ```

    Reported by `diracleo` on 2011-06-01 05:37:24

  3. Former user Account Deleted

    ``` 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. ```

    Reported by `owl.brainworker` on 2011-06-01 12:16:03


  4. Dane Iracleous

    ``` 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. ```

    Reported by `diracleo` on 2011-06-01 16:31:48

  5. Dane Iracleous

    ``` 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. ```

    Reported by `diracleo` on 2011-06-07 04:58:22

  6. Christopher Kramer

    ``` 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: 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. 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.,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? ```

    Reported by `crazy4chrissi` on 2012-06-02 09:55:35 - Labels added: Type-Enhancement, Priority-Low - Labels removed: Type-Defect, Priority-Medium

  7. Dane Iracleous

    ``` 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. ```

    Reported by `diracleo` on 2012-06-02 10:27:37

  8. Log in to comment