Skip to content

Commit d69ec08

Browse files
committed
add experimental support for Microsoft SQL Server
1 parent a39f9d0 commit d69ec08

File tree

8 files changed

+36
-21
lines changed

8 files changed

+36
-21
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# CHANGELOG.md
22

3-
## unreleased
3+
## 0.9.0 (2023-07-30)
44

55
- Added a new `json` component, which allows building a JSON API entirely in SQL with SQLPage !
66
Now creating an api over your database is as simple as `SELECT 'json' AS component, JSON_OBJECT('hello', 'world') AS contents`.
@@ -9,6 +9,7 @@
99
- Update the database drivers to the latest version, and switch to a fork of `sqlx` that opens the door to supporting Microsoft SQL Server in the future. This also updates the embedded version of SQLite to 3.41.2, with [many cool new features](https://www.sqlite.org/changes.html) such as:
1010
- better json support
1111
- better performance
12+
- Add experimental support for *Microsoft SQL Server*. If you have a SQL Server database lying around, please test it and report any issue you might encounter !
1213

1314
## 0.8.0 (2023-07-17)
1415

Cargo.lock

Lines changed: 28 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ panic = "abort"
1717
codegen-units = 2
1818

1919
[dependencies]
20-
sqlx = { package = "sqlx-oldapi", version = "0.6.5", features = ["any", "runtime-actix-rustls", "sqlite", "postgres", "mysql", "chrono"] }
20+
sqlx = { package = "sqlx-oldapi", version = "0.6.7", features = ["any", "runtime-actix-rustls", "sqlite", "postgres", "mysql", "mssql", "chrono"] }
2121
chrono = "0.4.23"
2222
actix-web = { version = "4", features = ["rustls", "cookies"] }
2323
percent-encoding = "2.2.0"

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ WHERE $first_name IS NOT NULL;
8585
- [sqlite](https://www.sqlite.org/index.html)
8686
- [PostgreSQL](https://www.postgresql.org/), and other compatible databases such as *YugabyteDB*, *CockroachDB* and *Aurora*.
8787
- [MySQL](https://www.mysql.com/), and other compatible databases such as *MariaDB* and *TiDB*.
88+
- [Microsoft SQL Server](https://www.microsoft.com/en-us/sql-server), and all compatible databases and providers such as *Azure SQL* and *Amazon RDS*.
8889

8990
## How it works
9091

examples/official-site/sqlpage/migrations/01_documentation.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ using a function to convert the rows into a json array like
275275
- `json_group_array()` in SQLite,
276276
- `json_agg()` in Postgres, or
277277
- `JSON_ARRAYAGG()` in MySQL.
278+
- `FOR JSON PATH` in Microsoft SQL Server.
278279
279280
280281
In SQLite, the query would look like

examples/official-site/sqlpage/migrations/11_json.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ To build a json array out of rows from the database, you can use:
3636
- `json_group_array()` in SQLite,
3737
- `json_agg()` in Postgres, or
3838
- `JSON_ARRAYAGG()` in MySQL.
39+
- `FOR JSON PATH` in SQL Server.
3940
4041
4142
```sql

examples/official-site/your-first-sql-website/index.sql

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ Later, when you want to deploy your website online, you can switch back to a per
9898
- a SQLite file with `sqlite://your-database-file.db` ([see options](https://docs.rs/sqlx/0.6.3/sqlx/sqlite/struct.SqliteConnectOptions.html#main-content)),
9999
- a PostgreSQL-compatible server with `postgres://user:password@host/database` ([see options](https://www.postgresql.org/docs/15/libpq-connect.html#id-1.7.3.8.3.6)),
100100
- a MySQL-compatible server with `mysql://user:password@host/database` ([see options](https://dev.mysql.com/doc/refman/8.0/en/connecting-using-uri-or-key-value-pairs.html)),
101+
- a Microsoft SQL Server with `mssql://user:password@host/database`,
101102
102103
For more information about the properties that can be set in sqlpage.json, see [SQLPage''s configuration documentation](https://github.com/lovasoa/SQLpage/blob/main/configuration.md#configuring-sqlpage)
103104

src/webserver/database/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ impl Database {
289289
AnyKind::Postgres => 50,
290290
AnyKind::MySql => 75,
291291
AnyKind::Sqlite => 16,
292+
AnyKind::Mssql => 100,
292293
#[allow(unreachable_patterns)]
293294
_ => unreachable!("unsupported database"),
294295
}

0 commit comments

Comments
 (0)