* Quote table name with optional alias and schema attribution * * @param {string|object} param table string or object * @param {string|boolean} alias alias name * * @returns {string}
(param, alias)
| 972 | * @returns {string} |
| 973 | */ |
| 974 | quoteTable(param, alias) { |
| 975 | let table = class="st">''; |
| 976 | |
| 977 | if (alias === true) { |
| 978 | alias = param.as || param.name || param; |
| 979 | } |
| 980 | |
| 981 | if (_.isObject(param)) { |
| 982 | if (this._dialect.supports.schemas) { |
| 983 | if (param.schema) { |
| 984 | table += `${this.quoteIdentifier(param.schema)}.`; |
| 985 | } |
| 986 | |
| 987 | table += this.quoteIdentifier(param.tableName); |
| 988 | } else { |
| 989 | if (param.schema) { |
| 990 | table += param.schema + (param.delimiter || class="st">'.'); |
| 991 | } |
| 992 | |
| 993 | table += param.tableName; |
| 994 | table = this.quoteIdentifier(table); |
| 995 | } |
| 996 | } else { |
| 997 | table = this.quoteIdentifier(param); |
| 998 | } |
| 999 | |
| 1000 | if (alias) { |
| 1001 | table += ` AS ${this.quoteIdentifier(alias)}`; |
| 1002 | } |
| 1003 | |
| 1004 | return table; |
| 1005 | } |
| 1006 | |
| 1007 | /* |
| 1008 | Escape a value (e.g. a string, number or date) |