Skip to content

Commit

Permalink
Rename links-mysql8 driver to links-mysql (#1189)
Browse files Browse the repository at this point in the history
  • Loading branch information
frank-emrich authored Nov 15, 2023
1 parent 5bc1d4f commit 0651c5f
Show file tree
Hide file tree
Showing 16 changed files with 43 additions and 69 deletions.
28 changes: 14 additions & 14 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:
./run-tests nodb-unit-tests
shell: bash

postgres-mysql8-sqlite3:
postgres-mysql-sqlite3:
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -249,7 +249,7 @@ jobs:
run: >-
opam install
./links.opam
./links-mysql8.opam
./links-mysql.opam
--deps-only
--ignore-constraints-on=links
Expand All @@ -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


Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 12 additions & 0 deletions database/mysql-driver/dune
Original file line number Diff line number Diff line change
@@ -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))
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))
12 changes: 0 additions & 12 deletions database/mysql8-driver/dune

This file was deleted.

6 changes: 3 additions & 3 deletions lens/database.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions links-mysql8.opam → links-mysql.opam
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
opam-version: "2.0"
maintainer: "James Cheney <[email protected]>"
authors: "The Links Team <[email protected]>"
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"
Expand Down
6 changes: 3 additions & 3 deletions run-database-tests
Original file line number Diff line number Diff line change
Expand Up @@ -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 (<working_dir>/config) if present; otherwise, the database(s) specified by the --database parameter are tested.",
Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions tests/database/config.mysql
Original file line number Diff line number Diff line change
@@ -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
4 changes: 0 additions & 4 deletions tests/database/config.mysql8

This file was deleted.

7 changes: 0 additions & 7 deletions tests/database/factorials.mysql8

This file was deleted.

2 changes: 1 addition & 1 deletion tests/database/testsuite.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{"databases" :
[ "pgsql",
"sqlite3",
"mysql8" ],
"mysql" ],
"setups" :
[ "factorials",
"null",
Expand Down
4 changes: 0 additions & 4 deletions tests/relational-lenses/config.mysql8

This file was deleted.

15 changes: 0 additions & 15 deletions tests/relational-lenses/serial.mysql8

This file was deleted.

2 changes: 1 addition & 1 deletion tests/relational-lenses/testsuite.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{"databases" :
[ "pgsql", "sqlite3", "mysql8" ],
[ "pgsql", "sqlite3", "mysql" ],
"setups" :
[ "music_example", "serial" ],
"tests" :
Expand Down

0 comments on commit 0651c5f

Please sign in to comment.