From bf62e06ff699fae805554792d40eecf052429153 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Tue, 12 May 2015 10:20:58 +0200 Subject: [PATCH] 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 --- src/parsers/command-mysql.lisp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/parsers/command-mysql.lisp b/src/parsers/command-mysql.lisp index 823cee7..a545676 100644 --- a/src/parsers/command-mysql.lisp +++ b/src/parsers/command-mysql.lisp @@ -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