mirror of
https://github.com/dimitri/pgloader.git
synced 2026-01-29 11:01:06 +01:00
Implement MySQL local (socket) connection. Fix #39.
The parser was happily parsing such a connection string as the following, but the rest of the code didn't really know what to do about it: mysql://unix:/var/run/mysqld/mysqld.sock:/main In passing, fix bugs where the PostgreSQL unix domain socket connection was still shy of a brick load, omitting to consider the case where the connection host is actually a list of '(:unix . "path/to/socket").
This commit is contained in:
parent
bce75fc4e5
commit
ee498111bc
@ -924,12 +924,12 @@
|
||||
(state-idx (pgloader.utils:make-pgstate))
|
||||
(state-after (pgloader.utils:make-pgstate))
|
||||
(pgloader.mysql:*cast-rules* ',casts)
|
||||
(*myconn-host* ,myhost)
|
||||
(*myconn-host* ',myhost)
|
||||
(*myconn-port* ,myport)
|
||||
(*myconn-user* ,myuser)
|
||||
(*myconn-pass* ,mypass)
|
||||
(*my-dbname* ,mydb)
|
||||
(*pgconn-host* ,pghost)
|
||||
(*pgconn-host* ',pghost)
|
||||
(*pgconn-port* ,pgport)
|
||||
(*pgconn-user* ,pguser)
|
||||
(*pgconn-pass* ,pgpass)
|
||||
@ -1032,7 +1032,7 @@ load database
|
||||
`(lambda ()
|
||||
(let* ((state-before (pgloader.utils:make-pgstate))
|
||||
(*state* (pgloader.utils:make-pgstate))
|
||||
(*pgconn-host* ,host)
|
||||
(*pgconn-host* ',host)
|
||||
(*pgconn-port* ,port)
|
||||
(*pgconn-user* ,user)
|
||||
(*pgconn-pass* ,password)
|
||||
@ -1263,7 +1263,7 @@ load database
|
||||
`(lambda ()
|
||||
(let* ((state-before (pgloader.utils:make-pgstate))
|
||||
(*state* (pgloader.utils:make-pgstate))
|
||||
(*pgconn-host* ,host)
|
||||
(*pgconn-host* ',host)
|
||||
(*pgconn-port* ,port)
|
||||
(*pgconn-user* ,user)
|
||||
(*pgconn-pass* ,password)
|
||||
@ -1808,7 +1808,7 @@ load database
|
||||
(summary (null *state*))
|
||||
(*state* (or *state* (pgloader.utils:make-pgstate)))
|
||||
(state-after ,(when after `(pgloader.utils:make-pgstate)))
|
||||
(*pgconn-host* ,host)
|
||||
(*pgconn-host* ',host)
|
||||
(*pgconn-port* ,port)
|
||||
(*pgconn-user* ,user)
|
||||
(*pgconn-pass* ,password)
|
||||
@ -1880,7 +1880,7 @@ load database
|
||||
`(lambda ()
|
||||
(let* ((state-before (pgloader.utils:make-pgstate))
|
||||
(*state* (pgloader.utils:make-pgstate))
|
||||
(*pgconn-host* ,host)
|
||||
(*pgconn-host* ',host)
|
||||
(*pgconn-port* ,port)
|
||||
(*pgconn-user* ,user)
|
||||
(*pgconn-pass* ,password)
|
||||
@ -2051,7 +2051,7 @@ load database
|
||||
(parse 'db-connection-uri database-uri)
|
||||
(ecase type
|
||||
(:mysql
|
||||
`(let* ((*myconn-host* ,host)
|
||||
`(let* ((*myconn-host* ,(if (consp host) (list 'quote host) host))
|
||||
(*myconn-port* ,port)
|
||||
(*myconn-user* ,user)
|
||||
(*myconn-pass* ,password)
|
||||
|
||||
@ -67,11 +67,16 @@
|
||||
*myconn-pass*."
|
||||
`(let* ((dbname (or ,dbname *my-dbname*))
|
||||
(*connection*
|
||||
(qmynd:mysql-connect :host *myconn-host*
|
||||
:port *myconn-port*
|
||||
:username *myconn-user*
|
||||
:password *myconn-pass*
|
||||
:database dbname)))
|
||||
(if (and (consp *myconn-host*) (eq :unix (car *myconn-host*)))
|
||||
(qmynd:mysql-local-connect :path (cdr *myconn-host*)
|
||||
:username *myconn-user*
|
||||
:password *myconn-pass*
|
||||
:database dbname)
|
||||
(qmynd:mysql-connect :host *myconn-host*
|
||||
:port *myconn-port*
|
||||
:username *myconn-user*
|
||||
:password *myconn-pass*
|
||||
:database dbname))))
|
||||
(unwind-protect
|
||||
(progn ,@forms)
|
||||
(qmynd:mysql-disconnect *connection*))))
|
||||
|
||||
@ -328,7 +328,7 @@
|
||||
(*pgconn-user* . ,*pgconn-user*)
|
||||
(*pgconn-pass* . ,*pgconn-pass*)
|
||||
(*pg-settings* . ',*pg-settings*)
|
||||
(*myconn-host* . ,*myconn-host*)
|
||||
(*myconn-host* . ',*myconn-host*)
|
||||
(*myconn-port* . ,*myconn-port*)
|
||||
(*myconn-user* . ,*myconn-user*)
|
||||
(*myconn-pass* . ,*myconn-pass*)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
LOAD DATABASE
|
||||
FROM mysql://root@localhost:3306/goeuro
|
||||
INTO postgresql://dim@localhost:54393/godollar
|
||||
FROM mysql://root@unix:/tmp/mysql.sock:/goeuro
|
||||
INTO postgresql://dim@unix:/tmp:/godollar
|
||||
|
||||
WITH include drop, create tables, create indexes, reset sequences
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user