Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/legacy-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
shell: pwsh
command: |
$mysqlJob = Start-Job -ScriptBlock {
choco install mysql --no-progress --version=8.4.6 -y --params "/serviceName:MySQL"
choco install mysql --no-progress -y --params "/serviceName:MySQL"
return $LASTEXITCODE
}

Expand Down
4 changes: 3 additions & 1 deletion Drivers/NpgsqlDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ public override string AddParametersToCommand(Query query)
}).JoinByNewLine();
}

private static (string, string) GetEnumSchemaAndName(Column column)
private (string, string) GetEnumSchemaAndName(Column column)
{
var schemaName = column.Type.Schema;
var enumName = column.Type.Name;
Expand All @@ -740,6 +740,8 @@ private static (string, string) GetEnumSchemaAndName(Column column)
schemaName = schemaAndEnum[0];
enumName = schemaAndEnum[1];
}
if (schemaName == DefaultSchema)
schemaName = string.Empty;
return (schemaName, enumName);
}

Expand Down
1 change: 1 addition & 0 deletions examples/NpgsqlDapperExample/Models.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ public class PostgresSpecialType
{
public Guid? CUuid { get; init; }
public CEnum? CEnum { get; init; }
public CEnum? CQualifiedEnum { get; init; }
public JsonElement? CJson { get; init; }
public JsonElement? CJsonStringOverride { get; init; }
public JsonElement? CJsonb { get; init; }
Expand Down
12 changes: 9 additions & 3 deletions examples/NpgsqlDapperExample/QuerySql.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1358,7 +1358,8 @@ INSERT INTO postgres_special_types
c_xml,
c_xml_string_override,
c_uuid,
c_enum
c_enum,
c_qualified_enum
)
VALUES (
@c_json,
Expand All @@ -1368,7 +1369,8 @@ INSERT INTO postgres_special_types
@c_xml::xml,
@c_xml_string_override::xml,
@c_uuid,
@c_enum::c_enum
@c_enum::c_enum,
@c_qualified_enum::c_enum
)";
public class InsertPostgresSpecialTypesArgs
{
Expand All @@ -1380,6 +1382,7 @@ public class InsertPostgresSpecialTypesArgs
public string? CXmlStringOverride { get; init; }
public Guid? CUuid { get; init; }
public CEnum? CEnum { get; init; }
public CEnum? CQualifiedEnum { get; init; }
};
public async Task InsertPostgresSpecialTypesAsync(InsertPostgresSpecialTypesArgs args)
{
Expand All @@ -1392,6 +1395,7 @@ public async Task InsertPostgresSpecialTypesAsync(InsertPostgresSpecialTypesArgs
queryParams.Add("c_xml_string_override", args.CXmlStringOverride);
queryParams.Add("c_uuid", args.CUuid);
queryParams.Add("c_enum", args.CEnum != null ? args.CEnum.Value.Stringify() : null);
queryParams.Add("c_qualified_enum", args.CQualifiedEnum != null ? args.CQualifiedEnum.Value.Stringify() : null);
if (this.Transaction == null)
{
using (var connection = await GetDataSource().OpenConnectionAsync())
Expand Down Expand Up @@ -1484,7 +1488,8 @@ public async Task TruncatePostgresNotNullTypesAsync()
c_xml,
c_xml_string_override,
c_uuid,
c_enum
c_enum,
c_qualified_enum
FROM postgres_special_types
LIMIT 1";
public class GetPostgresSpecialTypesRow
Expand All @@ -1497,6 +1502,7 @@ public class GetPostgresSpecialTypesRow
public string? CXmlStringOverride { get; init; }
public Guid? CUuid { get; init; }
public CEnum? CEnum { get; init; }
public CEnum? CQualifiedEnum { get; init; }
};
public async Task<GetPostgresSpecialTypesRow?> GetPostgresSpecialTypesAsync()
{
Expand Down
37 changes: 35 additions & 2 deletions examples/NpgsqlDapperExample/request.json
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,17 @@
"name": "c_enum"
}
},
{
"name": "c_qualified_enum",
"length": -1,
"table": {
"name": "postgres_special_types"
},
"type": {
"schema": "public",
"name": "c_enum"
}
},
{
"name": "c_json",
"length": -1,
Expand Down Expand Up @@ -35090,7 +35101,7 @@
}
},
{
"text": "\nINSERT INTO postgres_special_types\n(\n c_json,\n c_json_string_override,\n c_jsonb,\n c_jsonpath,\n c_xml,\n c_xml_string_override,\n c_uuid,\n c_enum\n)\nVALUES (\n $1, \n $2::json, \n $3,\n $4::jsonpath,\n $5::xml,\n $6::xml,\n $7,\n $8::c_enum\n)",
"text": "\nINSERT INTO postgres_special_types\n(\n c_json,\n c_json_string_override,\n c_jsonb,\n c_jsonpath,\n c_xml,\n c_xml_string_override,\n c_uuid,\n c_enum,\n c_qualified_enum\n)\nVALUES (\n $1, \n $2::json, \n $3,\n $4::jsonpath,\n $5::xml,\n $6::xml,\n $7,\n $8::c_enum,\n $9::c_enum\n)",
"name": "InsertPostgresSpecialTypes",
"cmd": ":exec",
"parameters": [
Expand Down Expand Up @@ -35192,6 +35203,16 @@
"name": "c_enum"
}
}
},
{
"number": 9,
"column": {
"name": "c_qualified_enum",
"length": -1,
"type": {
"name": "c_enum"
}
}
}
],
"comments": [
Expand Down Expand Up @@ -35251,7 +35272,7 @@
"filename": "query.sql"
},
{
"text": "SELECT\n c_json,\n c_json_string_override,\n c_jsonb,\n c_jsonpath,\n c_xml,\n c_xml_string_override,\n c_uuid,\n c_enum\nFROM postgres_special_types \nLIMIT 1",
"text": "SELECT\n c_json,\n c_json_string_override,\n c_jsonb,\n c_jsonpath,\n c_xml,\n c_xml_string_override,\n c_uuid,\n c_enum,\n c_qualified_enum\nFROM postgres_special_types \nLIMIT 1",
"name": "GetPostgresSpecialTypes",
"cmd": ":one",
"columns": [
Expand Down Expand Up @@ -35344,6 +35365,18 @@
"name": "c_enum"
},
"originalName": "c_enum"
},
{
"name": "c_qualified_enum",
"length": -1,
"table": {
"name": "postgres_special_types"
},
"type": {
"schema": "public",
"name": "c_enum"
},
"originalName": "c_qualified_enum"
}
],
"filename": "query.sql"
Expand Down
30 changes: 18 additions & 12 deletions examples/NpgsqlDapperExample/request.message
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
2
postgresql-examples/config/postgresql/authors/schema.sql+examples/config/postgresql/types/schema.sql",examples/config/postgresql/authors/query.sql"*examples/config/postgresql/types/query.sqlb‡
examples/NpgsqlDapperExamplecsharpÈ{"debugRequest":true,"generateCsproj":true,"namespaceName":"NpgsqlDapperExampleGen","overrides":[{"column":"GetPostgresFunctions:max_integer","csharp_type":{"notNull":false,"type":"int"}},{"column":"GetPostgresFunctions:max_varchar","csharp_type":{"notNull":false,"type":"string"}},{"column":"GetPostgresFunctions:max_timestamp","csharp_type":{"notNull":true,"type":"DateTime"}},{"column":"GetPostgresSpecialTypesCnt:c_json","csharp_type":{"notNull":false,"type":"JsonElement"}},{"column":"GetPostgresSpecialTypesCnt:c_jsonb","csharp_type":{"notNull":false,"type":"JsonElement"}},{"column":"*:c_json_string_override","csharp_type":{"notNull":false,"type":"string"}},{"column":"*:c_xml_string_override","csharp_type":{"notNull":false,"type":"string"}},{"column":"*:c_macaddr8","csharp_type":{"notNull":false,"type":"string"}},{"column":"*:c_timestamp_noda_instant_override","csharp_type":{"notNull":false,"type":"Instant"}}],"targetFramework":"net8.0","useDapper":true}*
./dist/LocalRunner¡î public"ãpublicƒ
./dist/LocalRunnerìî public"®publicƒ
authors)
id0ÿÿÿÿÿÿÿÿÿR authorsb  bigserial&
name0ÿÿÿÿÿÿÿÿÿR authorsbtext#
Expand Down Expand Up @@ -83,10 +83,11 @@ pg_catalog timestamp
c_box0ÿÿÿÿÿÿÿÿÿRpostgres_geometric_typesbbox7
c_path0ÿÿÿÿÿÿÿÿÿRpostgres_geometric_typesbpath=
c_polygon0ÿÿÿÿÿÿÿÿÿRpostgres_geometric_typesb polygon;
c_circle0ÿÿÿÿÿÿÿÿÿRpostgres_geometric_typesbcircle’
c_circle0ÿÿÿÿÿÿÿÿÿRpostgres_geometric_typesbcircleÝ
postgres_special_types5
c_uuid0ÿÿÿÿÿÿÿÿÿRpostgres_special_typesbuuid7
c_enum0ÿÿÿÿÿÿÿÿÿRpostgres_special_typesbc_enumA
c_enum0ÿÿÿÿÿÿÿÿÿRpostgres_special_typesbc_enumI
c_qualified_enum0ÿÿÿÿÿÿÿÿÿRpostgres_special_typesbpublicc_enumA
c_json0ÿÿÿÿÿÿÿÿÿRpostgres_special_typesb
pg_catalogjsonQ
c_json_string_override0ÿÿÿÿÿÿÿÿÿRpostgres_special_typesb
Expand Down Expand Up @@ -10680,8 +10681,8 @@ LIMIT 1GetPostgresNetworkTypesCnt:one"=
) VALUES ($1, $2, $3)InsertPostgresNetworkTypesBatch :copyfrom*IE
c_cidr0ÿÿÿÿÿÿÿÿÿR publicpostgres_network_typesbcidrzc_cidr*IE
c_inet0ÿÿÿÿÿÿÿÿÿR publicpostgres_network_typesbinetzc_inet*RN
c_macaddr0ÿÿÿÿÿÿÿÿÿR publicpostgres_network_typesb macaddrz c_macaddr: query.sqlBpostgres_network_types¿
—
c_macaddr0ÿÿÿÿÿÿÿÿÿR publicpostgres_network_typesb macaddrz c_macaddr: query.sqlBpostgres_network_types’
½
INSERT INTO postgres_special_types
(
c_json,
Expand All @@ -10691,7 +10692,8 @@ INSERT INTO postgres_special_types
c_xml,
c_xml_string_override,
c_uuid,
c_enum
c_enum,
c_qualified_enum
)
VALUES (
$1,
Expand All @@ -10701,7 +10703,8 @@ VALUES (
$5::xml,
$6::xml,
$7,
$8::c_enum
$8::c_enum,
$9::c_enum
)InsertPostgresSpecialTypes:exec*VR
c_json0ÿÿÿÿÿÿÿÿÿ8R publicpostgres_special_typesbpg_catalog.jsonzc_json*;7
c_json_string_override0ÿÿÿÿÿÿÿÿÿb
Expand All @@ -10713,7 +10716,8 @@ c_jsonpath0
c_xml0ÿÿÿÿÿÿÿÿÿbxml*-)
c_xml_string_override0ÿÿÿÿÿÿÿÿÿbxml*KG
c_uuid0ÿÿÿÿÿÿÿÿÿ8R publicpostgres_special_typesbuuidzc_uuid*!
c_enum0ÿÿÿÿÿÿÿÿÿbc_enum2 Special types : query.sqlBpostgres_special_typesÎ
c_enum0ÿÿÿÿÿÿÿÿÿbc_enum*+ '
c_qualified_enum0ÿÿÿÿÿÿÿÿÿbc_enum2 Special types : query.sqlBpostgres_special_typesÎ
UINSERT INTO postgres_not_null_types
(
c_enum_not_null
Expand All @@ -10727,16 +10731,17 @@ VALUES (
FROM postgres_not_null_types
LIMIT 1GetPostgresNotNullTypes:one"T
c_enum_not_null0ÿÿÿÿÿÿÿÿÿRpostgres_not_null_typesbc_enumzc_enum_not_null: query.sqlX
&TRUNCATE TABLE postgres_not_null_typesTruncatePostgresNotNullTypes:exec: query.sqlµ
­SELECT
&TRUNCATE TABLE postgres_not_null_typesTruncatePostgresNotNullTypes:exec: query.sql¨
ÃSELECT
c_json,
c_json_string_override,
c_jsonb,
c_jsonpath,
c_xml,
c_xml_string_override,
c_uuid,
c_enum
c_enum,
c_qualified_enum
FROM postgres_special_types
LIMIT 1GetPostgresSpecialTypes:one"I
c_json0ÿÿÿÿÿÿÿÿÿRpostgres_special_typesb
Expand All @@ -10751,7 +10756,8 @@ c_jsonpath":
c_xml0ÿÿÿÿÿÿÿÿÿRpostgres_special_typesbxmlzc_xml"Z
c_xml_string_override0ÿÿÿÿÿÿÿÿÿRpostgres_special_typesbxmlzc_xml_string_override"=
c_uuid0ÿÿÿÿÿÿÿÿÿRpostgres_special_typesbuuidzc_uuid"?
c_enum0ÿÿÿÿÿÿÿÿÿRpostgres_special_typesbc_enumzc_enum: query.sqlW
c_enum0ÿÿÿÿÿÿÿÿÿRpostgres_special_typesbc_enumzc_enum"[
c_qualified_enum0ÿÿÿÿÿÿÿÿÿRpostgres_special_typesbpublicc_enumzc_qualified_enum: query.sqlW
%TRUNCATE TABLE postgres_special_typesTruncatePostgresSpecialTypes:exec: query.sql®
lINSERT INTO postgres_special_types
(
Expand Down
1 change: 1 addition & 0 deletions examples/NpgsqlDapperLegacyExample/Models.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ public class PostgresSpecialType
{
public Guid? CUuid { get; set; }
public CEnum? CEnum { get; set; }
public CEnum? CQualifiedEnum { get; set; }
public JsonElement? CJson { get; set; }
public JsonElement? CJsonStringOverride { get; set; }
public JsonElement? CJsonb { get; set; }
Expand Down
12 changes: 9 additions & 3 deletions examples/NpgsqlDapperLegacyExample/QuerySql.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1359,7 +1359,8 @@ INSERT INTO postgres_special_types
c_xml,
c_xml_string_override,
c_uuid,
c_enum
c_enum,
c_qualified_enum
)
VALUES (
@c_json,
Expand All @@ -1369,7 +1370,8 @@ INSERT INTO postgres_special_types
@c_xml::xml,
@c_xml_string_override::xml,
@c_uuid,
@c_enum::c_enum
@c_enum::c_enum,
@c_qualified_enum::c_enum
)";
public class InsertPostgresSpecialTypesArgs
{
Expand All @@ -1381,6 +1383,7 @@ public class InsertPostgresSpecialTypesArgs
public string CXmlStringOverride { get; set; }
public Guid? CUuid { get; set; }
public CEnum? CEnum { get; set; }
public CEnum? CQualifiedEnum { get; set; }
};
public async Task InsertPostgresSpecialTypesAsync(InsertPostgresSpecialTypesArgs args)
{
Expand All @@ -1393,6 +1396,7 @@ public async Task InsertPostgresSpecialTypesAsync(InsertPostgresSpecialTypesArgs
queryParams.Add("c_xml_string_override", args.CXmlStringOverride);
queryParams.Add("c_uuid", args.CUuid);
queryParams.Add("c_enum", args.CEnum != null ? args.CEnum.Value.Stringify() : null);
queryParams.Add("c_qualified_enum", args.CQualifiedEnum != null ? args.CQualifiedEnum.Value.Stringify() : null);
if (this.Transaction == null)
{
using (var connection = await GetDataSource().OpenConnectionAsync())
Expand Down Expand Up @@ -1485,7 +1489,8 @@ public async Task TruncatePostgresNotNullTypesAsync()
c_xml,
c_xml_string_override,
c_uuid,
c_enum
c_enum,
c_qualified_enum
FROM postgres_special_types
LIMIT 1";
public class GetPostgresSpecialTypesRow
Expand All @@ -1498,6 +1503,7 @@ public class GetPostgresSpecialTypesRow
public string CXmlStringOverride { get; set; }
public Guid? CUuid { get; set; }
public CEnum? CEnum { get; set; }
public CEnum? CQualifiedEnum { get; set; }
};
public async Task<GetPostgresSpecialTypesRow> GetPostgresSpecialTypesAsync()
{
Expand Down
37 changes: 35 additions & 2 deletions examples/NpgsqlDapperLegacyExample/request.json
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,17 @@
"name": "c_enum"
}
},
{
"name": "c_qualified_enum",
"length": -1,
"table": {
"name": "postgres_special_types"
},
"type": {
"schema": "public",
"name": "c_enum"
}
},
{
"name": "c_json",
"length": -1,
Expand Down Expand Up @@ -35090,7 +35101,7 @@
}
},
{
"text": "\nINSERT INTO postgres_special_types\n(\n c_json,\n c_json_string_override,\n c_jsonb,\n c_jsonpath,\n c_xml,\n c_xml_string_override,\n c_uuid,\n c_enum\n)\nVALUES (\n $1, \n $2::json, \n $3,\n $4::jsonpath,\n $5::xml,\n $6::xml,\n $7,\n $8::c_enum\n)",
"text": "\nINSERT INTO postgres_special_types\n(\n c_json,\n c_json_string_override,\n c_jsonb,\n c_jsonpath,\n c_xml,\n c_xml_string_override,\n c_uuid,\n c_enum,\n c_qualified_enum\n)\nVALUES (\n $1, \n $2::json, \n $3,\n $4::jsonpath,\n $5::xml,\n $6::xml,\n $7,\n $8::c_enum,\n $9::c_enum\n)",
"name": "InsertPostgresSpecialTypes",
"cmd": ":exec",
"parameters": [
Expand Down Expand Up @@ -35192,6 +35203,16 @@
"name": "c_enum"
}
}
},
{
"number": 9,
"column": {
"name": "c_qualified_enum",
"length": -1,
"type": {
"name": "c_enum"
}
}
}
],
"comments": [
Expand Down Expand Up @@ -35251,7 +35272,7 @@
"filename": "query.sql"
},
{
"text": "SELECT\n c_json,\n c_json_string_override,\n c_jsonb,\n c_jsonpath,\n c_xml,\n c_xml_string_override,\n c_uuid,\n c_enum\nFROM postgres_special_types \nLIMIT 1",
"text": "SELECT\n c_json,\n c_json_string_override,\n c_jsonb,\n c_jsonpath,\n c_xml,\n c_xml_string_override,\n c_uuid,\n c_enum,\n c_qualified_enum\nFROM postgres_special_types \nLIMIT 1",
"name": "GetPostgresSpecialTypes",
"cmd": ":one",
"columns": [
Expand Down Expand Up @@ -35344,6 +35365,18 @@
"name": "c_enum"
},
"originalName": "c_enum"
},
{
"name": "c_qualified_enum",
"length": -1,
"table": {
"name": "postgres_special_types"
},
"type": {
"schema": "public",
"name": "c_enum"
},
"originalName": "c_qualified_enum"
}
],
"filename": "query.sql"
Expand Down
Loading
Loading