mirror of
https://github.com/dimitri/pgloader.git
synced 2025-08-07 23:07:00 +02:00
Implement support for MySQL useSSL=true|false option.
The MySQL connection string parameter for SSL usage is useSSL, so map an option name to our expected values for sslmode in database connection strings. See #748.
This commit is contained in:
parent
a7fd776ecd
commit
e4dca1a086
@ -73,7 +73,24 @@ See the `SOURCE CONNECTION STRING` section above for details on how to write
|
||||
the connection string. The MySQL connection string accepts the same
|
||||
parameter *sslmode* as the PostgreSQL connection string, but the *verify*
|
||||
mode is not implemented (yet).
|
||||
|
||||
::
|
||||
|
||||
mysql://[user[:password]@][netloc][:port][/dbname][?option=value&...]
|
||||
|
||||
|
||||
- *options*
|
||||
|
||||
The same notation rules as found in the *Connection String* parts of the
|
||||
documentation apply, and we have a specific MySQL option: `useSSL`. The
|
||||
value for `useSSL` can be either `false` or `true`.
|
||||
|
||||
If both `sslmode` and `useSSL` are used in the same connection string,
|
||||
pgloader behavior is undefined.
|
||||
|
||||
The MySQL connection string also accepts the *useSSL* parameter with values
|
||||
being either *false* or *true*.
|
||||
|
||||
Environment variables described in
|
||||
<http://dev.mysql.com/doc/refman/5.0/en/environment-variables.html> can be
|
||||
used as default values too. If the user is not provided, then it defaults to
|
||||
|
@ -98,11 +98,33 @@
|
||||
(defrule mysql-dsn-dbname (and "/" maybe-quoted-namestring)
|
||||
(:lambda (m-d-d) (list :dbname (text (second m-d-d)))))
|
||||
|
||||
(defrule mysql-dsn-option-usessl-true "true" (:constant :yes))
|
||||
(defrule mysql-dsn-option-usessl-false "false" (:constant :no))
|
||||
|
||||
(defrule mysql-dsn-option-usessl (and "useSSL" "="
|
||||
(or mysql-dsn-option-usessl-true
|
||||
mysql-dsn-option-usessl-false))
|
||||
(:lambda (ssl)
|
||||
(cons :use-ssl (third ssl))))
|
||||
|
||||
(defrule mysql-dsn-option (or dsn-option-ssl
|
||||
mysql-dsn-option-usessl
|
||||
dsn-option-host
|
||||
dsn-option-port
|
||||
dsn-option-dbname
|
||||
dsn-option-user
|
||||
dsn-option-pass
|
||||
dsn-option-table-name))
|
||||
|
||||
(defrule mysql-dsn-options (and "?" (and mysql-dsn-option
|
||||
(* (and "&" mysql-dsn-option))))
|
||||
(:lambda (opts) (cdr (flatten-option-list opts))))
|
||||
|
||||
(defrule mysql-uri (and mysql-prefix
|
||||
(? dsn-user-password)
|
||||
(? dsn-hostname)
|
||||
mysql-dsn-dbname
|
||||
(? dsn-options))
|
||||
(? mysql-dsn-options))
|
||||
(:lambda (uri)
|
||||
(destructuring-bind (&key type
|
||||
user
|
||||
|
@ -6,7 +6,7 @@
|
||||
(defparameter *separators* '(#\Tab #\, #\; #\| #\% #\^ #\! #\$)
|
||||
"Common CSV separators to try when guessing file parameters.")
|
||||
|
||||
(defparameter *escape-quotes* '("\\\"" "\"\"")
|
||||
(defparameter *escape-quotes* '("\"\"" "\\\"")
|
||||
"Common CSV quotes to try when guessing file parameters.")
|
||||
|
||||
(defun get-file-sample (filename &key (sample-size 10))
|
||||
|
@ -1,3 +1,3 @@
|
||||
load database
|
||||
from mysql://root@localhost/f1db
|
||||
from mysql://root@localhost/f1db?useSSL=false
|
||||
into pgsql:///plop;
|
||||
|
Loading…
Reference in New Issue
Block a user