Skip to content

Commit ec32e9f

Browse files
author
Pierre-Luc Gagné
committed
Rename raw_sql to sql_raw; add execute(sql_raw)
- Rename raw_sql class to sql_raw throughout (database.hpp, tests) - Add execute(sql_raw) overload returning std::expected<void, std::string> - Remove sql.hpp (split into sql_ddl.hpp, sql_dml.hpp, sql_dql.hpp) - Update ds_mysql.hpp umbrella header and docs to reflect the split
1 parent dfdeeba commit ec32e9f

6 files changed

Lines changed: 37 additions & 6399 deletions

File tree

docs/DEVELOPMENT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ DSMySQL is a header-only library. All functionality lives in `lib/include/ds_mys
2727
1. Create a new header under `lib/include/ds_mysql/`
2828
2. Use `#pragma once`
2929
3. Put all code in the `ds_mysql` namespace
30-
4. Include it transitively through `ds_mysql/database.hpp`, `ds_mysql/metadata.hpp`, or `ds_mysql/sql.hpp` if appropriate (those three are pulled in by the `ds_mysql/ds_mysql.hpp` umbrella header)
30+
4. Include it transitively through `ds_mysql/database.hpp`, `ds_mysql/metadata.hpp`, `ds_mysql/sql_ddl.hpp`, `ds_mysql/sql_dml.hpp`, or `ds_mysql/sql_dql.hpp` if appropriate (these are pulled in by the `ds_mysql/ds_mysql.hpp` umbrella header)
3131

3232
## Adding Unit Tests
3333

docs/QUICKREF.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,12 @@ DSMySQL/
4747
## Key Headers
4848

4949
| Header | Purpose |
50-
|--------|---------|
50+
| ------ | ------- |
5151
| `ds_mysql.hpp` | **Umbrella header** — include this to get everything |
5252
| `ds_mysql/database.hpp` | MySQL connection & queries |
53-
| `ds_mysql/sql.hpp` | SQL query builder (includes helpers & MySQL features) |
53+
| `ds_mysql/sql_ddl.hpp` | DDL query builder (CREATE / DROP / ALTER / ...) |
54+
| `ds_mysql/sql_dml.hpp` | DML query builder (INSERT / UPDATE / DELETE / DESCRIBE / ...) |
55+
| `ds_mysql/sql_dql.hpp` | DQL query builder (SELECT / projections / expressions / ...) |
5456
| `ds_mysql/sql_temporal.hpp` | Temporal types: `datetime_type`, `timestamp_type`, `time_type` |
5557
| `ds_mysql/metadata.hpp` | MySQL information_schema types |
5658
| `ds_mysql/column_field.hpp` | Typed column descriptors |
@@ -61,7 +63,7 @@ DSMySQL/
6163
## Environment Variables (Integration Tests)
6264

6365
| Variable | Default |
64-
|----------|---------|
66+
| -------- | ------- |
6567
| `DS_MYSQL_TEST_HOST` | `127.0.0.1` |
6668
| `DS_MYSQL_TEST_PORT` | `3307` |
6769
| `DS_MYSQL_TEST_DATABASE` | `ds_mysql_test` |

lib/include/ds_mysql/database.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ namespace ds_mysql {
2626
// ===================================================================
2727
// raw_sql — explicit escape hatch for raw SQL strings.
2828
//
29-
// Use this only when none of the typed builders in sql.hpp cover your
29+
// Use this only when none of the typed builders in sql_ddl.hpp, sql_dml.hpp,
30+
// or sql_dql.hpp cover your
3031
// case. Always returns std::expected<std::vector<std::vector<std::optional<std::string>>>, std::string>.
3132
// Each inner vector is a row; each element is a nullable cell value.
3233
// DDL / DML statements that produce no result set return an empty outer vector.
@@ -123,7 +124,8 @@ void validate_table_fields(std::vector<describe_row_type> const& rows, std::stri
123124
// mysql_database — thin wrapper around the MySQL C API.
124125
//
125126
// Provides type-safe query() and execute() methods that accept any builder
126-
// from sql.hpp, plus a raw_sql overload for unhandled cases.
127+
// from sql_ddl.hpp, sql_dml.hpp, and sql_dql.hpp, plus a raw_sql overload
128+
// for unhandled cases.
127129
//
128130
// Factory methods:
129131
// mysql_database::connect(host, database, credentials, port)

lib/include/ds_mysql/ds_mysql.hpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@
44
//
55
// Transitively provides:
66
// database.hpp — database connection, query execution, result sets
7-
// sql.hpp — query builder (SELECT / INSERT / UPDATE / DELETE / ...) and helpers
7+
// sql_ddl.hpp — DDL query builder (CREATE / DROP / ALTER / ...)
8+
// sql_dml.hpp — DML query builder (INSERT / UPDATE / DELETE / DESCRIBE / ...)
9+
// sql_dql.hpp — DQL query builder (SELECT / projections / expressions / ...)
810
// metadata.hpp — runtime metadata helpers (column info, schema introspection)
911
//
1012
// All other library headers (column_field, schema_generator, sql_identifiers,
1113
// sql_temporal, sql_varchar, sql_text, config, credentials, …) are
12-
// pulled in transitively by the three headers above.
14+
// pulled in transitively by the headers above.
1315

1416
#include "ds_mysql/database.hpp"
1517
#include "ds_mysql/metadata.hpp"

0 commit comments

Comments
 (0)