Mysql load dump

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Mysql load dump

Bob Sneidar via use-livecode
Hello,

I want to load a dump from an livecode app but i don’t know how to do it.

I’ve tried :

answer file  « Your dump :"

put "source " & quote & it & quote into tSQL

revExecuteSQL tDatabaseID, tSQL


Without success.

Any ideas ?

Thanks
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Mysql load dump

Bob Sneidar via use-livecode
If this is sqlite, you might be able to use the .read dot command.. (note
the nearly invisible period that begins .read)

Untested, but this might work.

put "path/to/dump.sql" into tPath
put merge(".dump [[tpath]]") into tSql
revexecutesql tDatabaseId, tsql

If the dump is IN to sqlite, but is from another db (mySQL or whatever) it
might not work.

Oh, if its sqlite and you still have access to the first database file, it
should be possible to a) open the new database, b) attach the old database
and c) copy the tables you need from one to the other, then d) detach the
old database and you should be good to go.

On Wed, Feb 14, 2018 at 8:31 AM, Ludovic THEBAULT via use-livecode <
[hidden email]> wrote:

> Hello,
>
> I want to load a dump from an livecode app but i don’t know how to do it.
>
> I’ve tried :
>
> answer file  « Your dump :"
>
> put "source " & quote & it & quote into tSQL
>
> revExecuteSQL tDatabaseID, tSQL
>
>
> Without success.
>
> Any ideas ?
>
> Thanks
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Mysql load dump

Bob Sneidar via use-livecode

> Le 14 févr. 2018 à 17:12, Mike Bonner via use-livecode <[hidden email]> a écrit :
>
> If this is sqlite, you might be able to use the .read dot command.. (note
> the nearly invisible period that begins .read)
>
> Untested, but this might work.
>
> put "path/to/dump.sql" into tPath
> put merge(".dump [[tpath]]") into tSql
> revexecutesql tDatabaseId, tsql
>
> If the dump is IN to sqlite, but is from another db (mySQL or whatever) it
> might not work.
>
> Oh, if its sqlite and you still have access to the first database file, it
> should be possible to a) open the new database, b) attach the old database
> and c) copy the tables you need from one to the other, then d) detach the
> old database and you should be good to go.

Thanks, but it’s for Mysql.


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Mysql load dump

Bob Sneidar via use-livecode
DOH, I see it in the subject now.

If you can get to a command line where the db server resides, you can use
the mysql client to do the import, or if phpmyadmin is available, you can
use its interface to import the dump.  IIRC livecode doesn't like sending
multi-line sql to mysql (though it works in sqlite) so it might be possible
to parse the file line by line and send each line in sequence.  (No clue
what other hoops you might need to jump through to do this though. )

On Wed, Feb 14, 2018 at 9:46 AM, Ludovic THEBAULT via use-livecode <
[hidden email]> wrote:

>
> > Le 14 févr. 2018 à 17:12, Mike Bonner via use-livecode <
> [hidden email]> a écrit :
> >
> > If this is sqlite, you might be able to use the .read dot command.. (note
> > the nearly invisible period that begins .read)
> >
> > Untested, but this might work.
> >
> > put "path/to/dump.sql" into tPath
> > put merge(".dump [[tpath]]") into tSql
> > revexecutesql tDatabaseId, tsql
> >
> > If the dump is IN to sqlite, but is from another db (mySQL or whatever)
> it
> > might not work.
> >
> > Oh, if its sqlite and you still have access to the first database file,
> it
> > should be possible to a) open the new database, b) attach the old
> database
> > and c) copy the tables you need from one to the other, then d) detach the
> > old database and you should be good to go.
>
> Thanks, but it’s for Mysql.
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Mysql load dump

Bob Sneidar via use-livecode
mySQLWorkbench has an import/export feature you may be able to use. It's free. If you are trying to build this feature into LC, I would attempt the sql syntax in an editor on a test database first and see if it generates any errors.

Bob S


> On Feb 14, 2018, at 09:18 , Mike Bonner via use-livecode <[hidden email]> wrote:
>
> DOH, I see it in the subject now.
>
> If you can get to a command line where the db server resides, you can use
> the mysql client to do the import, or if phpmyadmin is available, you can
> use its interface to import the dump.  IIRC livecode doesn't like sending
> multi-line sql to mysql (though it works in sqlite) so it might be possible
> to parse the file line by line and send each line in sequence.  (No clue
> what other hoops you might need to jump through to do this though. )


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: Mysql load dump

Bob Sneidar via use-livecode
In reply to this post by Bob Sneidar via use-livecode

> Le 14 févr. 2018 à 18:18, Mike Bonner via use-livecode <[hidden email]> a écrit :
>
> DOH, I see it in the subject now.
>
> If you can get to a command line where the db server resides, you can use
> the mysql client to do the import, or if phpmyadmin is available, you can
> use its interface to import the dump.  IIRC livecode doesn't like sending
> multi-line sql to mysql (though it works in sqlite) so it might be possible
> to parse the file line by line and send each line in sequence.  (No clue
> what other hoops you might need to jump through to do this though. )


I wanted to use my favorite tool, Livecode, to create a script to automate this but making a query for each dump line is not the cleanest.


Thanks anyway

Ludovic
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode