mirror of
				https://github.com/Fabio286/antares.git
				synced 2025-06-05 21:59:22 +02:00 
			
		
		
		
	fix(PostgreSQL): schema different than public not automatically selected, closes #172
This commit is contained in:
		| @@ -131,15 +131,23 @@ export class PostgreSQLClient extends AntaresCore { | |||||||
|    } |    } | ||||||
|  |  | ||||||
|    /** |    /** | ||||||
|     * Executes an "USE" query |     * Executes an 'SET search_path TO "${schema}"' query | ||||||
|     * |     * | ||||||
|     * @param {String} schema |     * @param {String} schema | ||||||
|  |     * @param {Object?} connection optional | ||||||
|     * @memberof PostgreSQLClient |     * @memberof PostgreSQLClient | ||||||
|     */ |     */ | ||||||
|    use (schema) { |    use (schema, connection) { | ||||||
|       this._schema = schema; |       this._schema = schema; | ||||||
|       if (schema) |  | ||||||
|          return this.raw(`SET search_path TO "${schema}"`); |       if (schema) { | ||||||
|  |          const sql = `SET search_path TO "${schema}"`; | ||||||
|  |  | ||||||
|  |          if (connection === undefined) | ||||||
|  |             return this.raw(sql); | ||||||
|  |          else | ||||||
|  |             return connection.query(sql); | ||||||
|  |       } | ||||||
|    } |    } | ||||||
|  |  | ||||||
|    /** |    /** | ||||||
| @@ -1441,7 +1449,7 @@ export class PostgreSQLClient extends AntaresCore { | |||||||
|          this._runningConnections.set(args.tabUid, connection.processID); |          this._runningConnections.set(args.tabUid, connection.processID); | ||||||
|  |  | ||||||
|       if (args.schema && args.schema !== 'public') |       if (args.schema && args.schema !== 'public') | ||||||
|          await this.use(args.schema); |          await this.use(args.schema, connection); | ||||||
|  |  | ||||||
|       for (const query of queries) { |       for (const query of queries) { | ||||||
|          if (!query) continue; |          if (!query) continue; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user