File tree Expand file tree Collapse file tree 5 files changed +16
-5
lines changed Expand file tree Collapse file tree 5 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -96,8 +96,8 @@ export interface Connector {
9696 /** DSN parser for this connector */
9797 dsnParser : DSNParser ;
9898
99- /** Create a new instance of this connector (for multi-source support) - optional, only implemented for tested connectors */
100- clone ? ( ) : Connector ;
99+ /** Create a new instance of this connector (for multi-source support). This method is required for all connectors. */
100+ clone ( ) : Connector ;
101101
102102 /** Connect to the database using DSN, with optional init script and database-specific configuration */
103103 connect ( dsn : string , initScript ?: string , config ?: ConnectorConfig ) : Promise < void > ;
Original file line number Diff line number Diff line change @@ -112,9 +112,8 @@ export class ConnectorManager {
112112 }
113113
114114 // Create a new instance of the connector (clone) to avoid sharing state between sources
115- // Only SQLite currently supports cloning for multi-source configurations
116- // Other databases will reuse the singleton instance (not recommended for multi-source)
117- const connector = connectorPrototype . clone ? connectorPrototype . clone ( ) : connectorPrototype ;
115+ // All connectors support cloning for multi-source configurations
116+ const connector = connectorPrototype . clone ( ) ;
118117
119118 // Build config for database-specific options
120119 const config : ConnectorConfig = { } ;
Original file line number Diff line number Diff line change @@ -98,6 +98,10 @@ export class MariaDBConnector implements Connector {
9898
9999 private pool : mariadb . Pool | null = null ;
100100
101+ clone ( ) : Connector {
102+ return new MariaDBConnector ( ) ;
103+ }
104+
101105 async connect ( dsn : string , initScript ?: string , config ?: ConnectorConfig ) : Promise < void > {
102106 try {
103107 const connectionConfig = await this . dsnParser . parse ( dsn , config ) ;
Original file line number Diff line number Diff line change @@ -101,6 +101,10 @@ export class MySQLConnector implements Connector {
101101
102102 private pool : mysql . Pool | null = null ;
103103
104+ clone ( ) : Connector {
105+ return new MySQLConnector ( ) ;
106+ }
107+
104108 async connect ( dsn : string , initScript ?: string , config ?: ConnectorConfig ) : Promise < void > {
105109 try {
106110 const connectionOptions = await this . dsnParser . parse ( dsn , config ) ;
Original file line number Diff line number Diff line change @@ -137,6 +137,10 @@ export class SQLServerConnector implements Connector {
137137 private connection ?: sql . ConnectionPool ;
138138 private config ?: sql . config ;
139139
140+ clone ( ) : Connector {
141+ return new SQLServerConnector ( ) ;
142+ }
143+
140144 async connect ( dsn : string , initScript ?: string , config ?: ConnectorConfig ) : Promise < void > {
141145 try {
142146 this . config = await this . dsnParser . parse ( dsn , config ) ;
You can’t perform that action at this time.
0 commit comments