This example was produced on commit f6baee4 (latest main at the time of writing).
On MySQL, assuming that database mydb and staff are created, and that given the following table created by:
CREATE TABLE IF NOT EXISTS staff.announcements (
id INT PRIMARY KEY AUTO_INCREMENT,
message VARCHAR(1000)
);
with the following config having db_mysql_mydb is defined as:
"db_mysql_mydb": {
"DB_TYPE": "mysql",
"DB_HOST": "127.0.0.1",
"DB_PORT": 33306,
"DB_USER": "root",
"DB_NAME": "anotherdb"
}
The SQL following produces incorrect types:
const mixedQualifiedNamesMySqlStaff = sql`
-- @name: mixed qualified names mine
-- @db: db_mysql_mydb
SELECT message FROM staff.announcements`;
The type generation:
export type MixedQualifiedNamesMineParams = [];
export interface IMixedQualifiedNamesMineResult {
}
export interface IMixedQualifiedNamesMineQuery {
params: MixedQualifiedNamesMineParams;
result: IMixedQualifiedNamesMineResult;
}
It is worth nothing that changing db_mysql_mydb to the following config:
"db_mysql_mydb": {
"DB_TYPE": "mysql",
"DB_HOST": "127.0.0.1",
"DB_PORT": 33306,
"DB_USER": "root",
- "DB_NAME": "anotherdb"
+ "DB_NAME": "staff"
}
results in the correct behavior:
export type MixedQualifiedNamesMineParams = [];
export interface IMixedQualifiedNamesMineResult {
message: string | null;
}
export interface IMixedQualifiedNamesMineQuery {
params: MixedQualifiedNamesMineParams;
result: IMixedQualifiedNamesMineResult;
}
This example was produced on commit f6baee4 (latest main at the time of writing).
On MySQL, assuming that database
mydbandstaffare created, and that given the following table created by:with the following config having
db_mysql_mydbis defined as:The SQL following produces incorrect types:
The type generation:
It is worth nothing that changing
db_mysql_mydbto the following config:"db_mysql_mydb": { "DB_TYPE": "mysql", "DB_HOST": "127.0.0.1", "DB_PORT": 33306, "DB_USER": "root", - "DB_NAME": "anotherdb" + "DB_NAME": "staff" }results in the correct behavior: