diff --git a/.pubignore b/.pubignore index ec6e2ff..472e2cb 100644 --- a/.pubignore +++ b/.pubignore @@ -29,4 +29,6 @@ doc/api/ main.exe teste_concorrencia.dart teste_utils.dart -teste_insert_get_id.dart \ No newline at end of file +teste_insert_get_id.dart + +example/bin/teste_insert_get_id.dart \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 293a634..82d34bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -86,4 +86,8 @@ final manager = Manager(); - fix bugs in onOpen callback to configure connection settings - improvements to README -- implemented connection pool for 'postgres' (v2) driver_implementation \ No newline at end of file +- implemented connection pool for 'postgres' (v2) driver_implementation + +## 3.2.1 + +- fix bug on format Schema \ No newline at end of file diff --git a/lib/src/connectors/postgres_connector.dart b/lib/src/connectors/postgres_connector.dart index fde72f3..63f9116 100644 --- a/lib/src/connectors/postgres_connector.dart +++ b/lib/src/connectors/postgres_connector.dart @@ -115,9 +115,9 @@ class PostgresConnector extends Connector implements ConnectorInterface { } if (config['schema'] != null) { - dsn += ";schema=${config['schema']}"; + dsn += ";schema=${formatSchema(config['schema'])}"; } - + if (config['timezone'] != null) { dsn += ";timezone=${config['timezone']}"; } @@ -132,11 +132,20 @@ class PostgresConnector extends Connector implements ConnectorInterface { /// @return string /// String formatSchema(dynamic schema) { - if (Utils.is_array(schema)) { - return '"' + Utils.implode('", "', schema) + '"'; + String result = ''; + if (schema is List) { + result = schema.map((e) => '"$e"').join(','); + } else if (schema is String) { + if (schema.contains(',')) { + final parts = schema.split(','); + result = parts.map((e) => '"$e"').join(','); + } else { + result = '"$schema"'; + } } else { - return '"' + schema + '"'; + throw Exception('schema is not String or List'); } + return result; } /// diff --git a/pubspec.yaml b/pubspec.yaml index 7f77816..01a4e10 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: eloquent -version: 3.2.0 +version: 3.2.1 description: eloquent query builder port from PHP Laravel homepage: https://github.com/insinfo/eloquent_dart #publish_to: none