Accept MySQL dbname beginning with digits, fix #230.

pgloader used to have a single database name parsing rule that is
supposed to be compliant with PostgreSQL identifier rules. Of course it
turns out that MySQL naming rules are different, so adjust the parser so
that the following connection string is accepted:

  mysql://root@localhost/3scale_system_development
This commit is contained in:
Dimitri Fontaine 2015-05-12 10:20:58 +02:00
parent 8e6e67f056
commit bf62e06ff6

View File

@ -101,10 +101,17 @@
(defrule mysql-prefix "mysql://" (:constant (list :type :mysql)))
(defrule mysql-dsn-dbname (and "/" (* (or (alpha-char-p character)
(digit-char-p character)
punct)))
(:destructure (slash dbname)
(declare (ignore slash))
(list :dbname (text dbname))))
(defrule mysql-uri (and mysql-prefix
(? dsn-user-password)
(? dsn-hostname)
dsn-dbname)
mysql-dsn-dbname)
(:lambda (uri)
(destructuring-bind (&key type
user