diff --git a/.github/workflows/default.yml b/.github/workflows/default.yml index e0a9ab0f0..d6a9c0609 100644 --- a/.github/workflows/default.yml +++ b/.github/workflows/default.yml @@ -106,7 +106,7 @@ jobs: ./run-tests nodb-unit-tests shell: bash - postgres-mysql8-sqlite3: + postgres-mysql-sqlite3: strategy: fail-fast: false matrix: @@ -163,7 +163,7 @@ jobs: opam install ./links.opam ./links-postgresql.opam - ./links-mysql8.opam + ./links-mysql.opam ./links-sqlite3.opam --deps-only --ignore-constraints-on=links @@ -189,13 +189,13 @@ jobs: LINKS_POSTGRES_USER: links LINKS_POSTGRES_PASSWORD: links LINKS_POSTGRES_PORT: ${{ job.services.postgres.ports[5432] }} - LINKS_MYSQL8_HOST: 127.0.0.1 - LINKS_MYSQL8_USER: links - LINKS_MYSQL8_PASSWORD: links - LINKS_MYSQL8_PORT: ${{ job.services.mysql.ports[3306] }} + LINKS_MYSQL_HOST: 127.0.0.1 + LINKS_MYSQL_USER: links + LINKS_MYSQL_PASSWORD: links + LINKS_MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} shell: bash - links-mysql8_mysql57: + links-mysql_mysql57: strategy: fail-fast: false matrix: @@ -249,7 +249,7 @@ jobs: run: >- opam install ./links.opam - ./links-mysql8.opam + ./links-mysql.opam --deps-only --ignore-constraints-on=links @@ -262,16 +262,16 @@ jobs: - name: Run database testsuite run: | eval $(opam env) - ./run-database-tests tests/database -d mysql8 - ./run-database-tests tests/relational-lenses -d mysql8 + ./run-database-tests tests/database -d mysql + ./run-database-tests tests/relational-lenses -d mysql env: # TODO(dhil): I do not know how to index into the # environments of either service. Until we figure out how to # do it, we will just duplicate information here. - LINKS_MYSQL8_HOST: 127.0.0.1 - LINKS_MYSQL8_USER: links - LINKS_MYSQL8_PASSWORD: links - LINKS_MYSQL8_PORT: ${{ job.services.mysql.ports[3306] }} + LINKS_MYSQL_HOST: 127.0.0.1 + LINKS_MYSQL_USER: links + LINKS_MYSQL_PASSWORD: links + LINKS_MYSQL_PORT: ${{ job.services.mysql.ports[3306] }} shell: bash diff --git a/Makefile b/Makefile index af7317e77..d79bdf5b2 100644 --- a/Makefile +++ b/Makefile @@ -46,7 +46,7 @@ BUILD_DIR:=$(ROOT)/_build BUILD=opam exec dune -- build MAIN=links SOURCES=$(MAIN) -DB_STABLE=links-postgresql,links-sqlite3,links-mysql8 +DB_STABLE=links-postgresql,links-sqlite3,links-mysql DB_SOURCES=$(DB_STABLE) # Note: this relies on lazy expansion of `SOURCES'. COMMON_FLAGS=--only-packages $(SOURCES) --build-dir=$(BUILD_DIR) diff --git a/database/mysql-driver/dune b/database/mysql-driver/dune new file mode 100644 index 000000000..1416b16d5 --- /dev/null +++ b/database/mysql-driver/dune @@ -0,0 +1,12 @@ +(library + (name links_mysql) + (public_name links-mysql) + (synopsis "MySQL database backend for Links") + (optional) + (libraries str unix mysql8 links.core)) + + +(install + (section share) + (files links_mysql_dependencies.json) + (package links-mysql)) diff --git a/database/mysql8-driver/links_mysql8_dependencies.json b/database/mysql-driver/links_mysql_dependencies.json similarity index 100% rename from database/mysql8-driver/links_mysql8_dependencies.json rename to database/mysql-driver/links_mysql_dependencies.json diff --git a/database/mysql8-driver/mysql8_database.ml b/database/mysql-driver/mysql_database.ml similarity index 99% rename from database/mysql8-driver/mysql8_database.ml rename to database/mysql-driver/mysql_database.ml index 0a301d209..bf964c7f8 100644 --- a/database/mysql8-driver/mysql8_database.ml +++ b/database/mysql-driver/mysql_database.ml @@ -262,7 +262,7 @@ end class mysql_database spec = object(self) inherit Value.database mysql_printer val connection = connect spec - method driver_name () = "mysql8" + method driver_name () = "mysql" method exec query : Value.dbvalue = try new mysql_result (exec connection query) connection @@ -305,5 +305,5 @@ let parse_args (args : string) : db = failwith ("[" ^ msg ^ "] Couldn't parse mysql port number : " ^ port)) | _ -> failwith "Insufficient arguments when establishing mysql connection" -let driver_name = "mysql8" +let driver_name = "mysql" let _ = Value.register_driver (driver_name, fun args -> new mysql_database (parse_args args), Value.reconstruct_db_string (driver_name, args)) diff --git a/database/mysql8-driver/dune b/database/mysql8-driver/dune deleted file mode 100644 index 848eb383a..000000000 --- a/database/mysql8-driver/dune +++ /dev/null @@ -1,12 +0,0 @@ -(library - (name links_mysql8) - (public_name links-mysql8) - (synopsis "MySQL8 database backend for Links") - (optional) - (libraries str unix mysql8 links.core)) - - -(install - (section share) - (files links_mysql8_dependencies.json) - (package links-mysql8)) diff --git a/lens/database.ml b/lens/database.ml index 1fb7f26d3..c54236627 100644 --- a/lens/database.ml +++ b/lens/database.ml @@ -357,7 +357,7 @@ module Insert = struct let last_id_fun = let driver = db.driver_name () in match driver with - | "mysql8" -> "last_insert_id()" + | "mysql" -> "last_insert_id()" | "sqlite3" -> "last_insert_rowid()" | _ -> let fn = "exec_insert_returning_hack" in @@ -377,7 +377,7 @@ module Insert = struct let exec_insert_returning ~db ~field_types data = match db.driver_name () with | "sqlite3" - |"mysql8" -> + |"mysql" -> exec_insert_returning_hack ~db data | _ -> let cmd = Format.asprintf "%a" (fmt ~db) data in @@ -411,7 +411,7 @@ module Change = struct let exec_multi ~db data = match db.driver_name () with - | "mysql8" -> exec_multi_slow ~db data + | "mysql" -> exec_multi_slow ~db data | _ -> let fmt_cmd_sep f () = Format.pp_print_string f ";\n" in let fmt_cmd_list = Format.pp_print_list ~pp_sep:fmt_cmd_sep (fmt ~db) in diff --git a/links-mysql8.opam b/links-mysql.opam similarity index 77% rename from links-mysql8.opam rename to links-mysql.opam index 3e386006f..2e6db47d5 100644 --- a/links-mysql8.opam +++ b/links-mysql.opam @@ -1,8 +1,8 @@ opam-version: "2.0" maintainer: "James Cheney " authors: "The Links Team " -synopsis: "MySQL8 database driver for the Links Programming Language" -description: "MySQL8 database driver for the Links Programming Language" +synopsis: "MySQL database driver for the Links Programming Language" +description: "MySQL database driver for the Links Programming Language" homepage: "https://github.com/links-lang/links" dev-repo: "git+https://github.com/links-lang/links.git" bug-reports: "https://github.com/links-lang/links/issues" diff --git a/run-database-tests b/run-database-tests index 1c024ac9e..f3c8741fa 100755 --- a/run-database-tests +++ b/run-database-tests @@ -14,8 +14,8 @@ parser.add_argument("working_dir", type=str, parser.add_argument("-c","--config_file", type=str, help="Test configuration file (default: testsuite.json)", default="testsuite.json") -parser.add_argument("-d", "--database", type=str,choices=["all","mysql8","pgsql","sqlite3"], - help="Run tests for specific database (all, mysql8, pgsql, sqlite3). \"all\" selects all databases listed in the testsuite configuration file. Default: \"pgsql\"", +parser.add_argument("-d", "--database", type=str,choices=["all","mysql","pgsql","sqlite3"], + help="Run tests for specific database (all, mysql, pgsql, sqlite3). \"all\" selects all databases listed in the testsuite configuration file. Default: \"pgsql\"", default="pgsql") parser.add_argument("-l", "--local", action="store_true", help="Test local database configuration (/config) if present; otherwise, the database(s) specified by the --database parameter are tested.", @@ -85,7 +85,7 @@ def main(): debug("setting up %s with %s" % (db,sql_file)) if db == 'pgsql': cmnd = "PGPASSWORD=%s psql -h %s -p %s %s -v ON_ERROR_STOP=1 -q -d links -f %s" % (passwd, host, port, user, sql_file) - elif db == 'mysql8': + elif db == 'mysql': cmnd = "mysql links -h %s -P %s -u %s -p%s < %s" % (host, port, user, passwd, sql_file) elif db == 'sqlite3': cmnd = "sqlite3 links < %s" % sql_file diff --git a/tests/database/config.mysql b/tests/database/config.mysql new file mode 100644 index 000000000..fe28d89b6 --- /dev/null +++ b/tests/database/config.mysql @@ -0,0 +1,4 @@ +database_driver=mysql +database_args=$LINKS_MYSQL_HOST:$LINKS_MYSQL_PORT:$LINKS_MYSQL_USER:$LINKS_MYSQL_PASSWORD +coerce_null_integers=on +null_integer=-1 diff --git a/tests/database/config.mysql8 b/tests/database/config.mysql8 deleted file mode 100644 index f71a87bda..000000000 --- a/tests/database/config.mysql8 +++ /dev/null @@ -1,4 +0,0 @@ -database_driver=mysql8 -database_args=$LINKS_MYSQL8_HOST:$LINKS_MYSQL8_PORT:$LINKS_MYSQL8_USER:$LINKS_MYSQL8_PASSWORD -coerce_null_integers=on -null_integer=-1 diff --git a/tests/database/factorials.mysql8 b/tests/database/factorials.mysql8 deleted file mode 100644 index 2ce8de83c..000000000 --- a/tests/database/factorials.mysql8 +++ /dev/null @@ -1,7 +0,0 @@ -DROP TABLE IF EXISTS factorials; - -CREATE TABLE factorials ( - rowid integer PRIMARY KEY AUTO_INCREMENT, - i integer, - f bigint -); diff --git a/tests/database/testsuite.json b/tests/database/testsuite.json index 4c2ad642d..b5b3aaeaf 100644 --- a/tests/database/testsuite.json +++ b/tests/database/testsuite.json @@ -1,7 +1,7 @@ {"databases" : [ "pgsql", "sqlite3", - "mysql8" ], + "mysql" ], "setups" : [ "factorials", "null", diff --git a/tests/relational-lenses/config.mysql8 b/tests/relational-lenses/config.mysql8 deleted file mode 100644 index f71a87bda..000000000 --- a/tests/relational-lenses/config.mysql8 +++ /dev/null @@ -1,4 +0,0 @@ -database_driver=mysql8 -database_args=$LINKS_MYSQL8_HOST:$LINKS_MYSQL8_PORT:$LINKS_MYSQL8_USER:$LINKS_MYSQL8_PASSWORD -coerce_null_integers=on -null_integer=-1 diff --git a/tests/relational-lenses/serial.mysql8 b/tests/relational-lenses/serial.mysql8 deleted file mode 100644 index 6969e2361..000000000 --- a/tests/relational-lenses/serial.mysql8 +++ /dev/null @@ -1,15 +0,0 @@ -DROP TABLE IF EXISTS t1; - -CREATE TABLE t1 ( - id1 INT NOT NULL AUTO_INCREMENT, - id2 INT NOT NULL, - PRIMARY KEY (id1) -); - -DROP TABLE IF EXISTS t2; - -CREATE TABLE t2 ( - id2 INT NOT NULL AUTO_INCREMENT, - val VARCHAR(50) NOT NULL, - PRIMARY KEY (id2) -); diff --git a/tests/relational-lenses/testsuite.json b/tests/relational-lenses/testsuite.json index cc7d7801e..dc3b147a8 100644 --- a/tests/relational-lenses/testsuite.json +++ b/tests/relational-lenses/testsuite.json @@ -1,5 +1,5 @@ {"databases" : - [ "pgsql", "sqlite3", "mysql8" ], + [ "pgsql", "sqlite3", "mysql" ], "setups" : [ "music_example", "serial" ], "tests" :