MCPcopy
hub / github.com/sequelize/sequelize / quoteTable

Method quoteTable

src/dialects/abstract/query-generator.js:1091–1122  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

1089 * @returns {string}
1090 */
1091 quoteTable(param, alias) {
1092 let table = '';
1093
1094 if (alias === true) {
1095 alias = param.as || param.name || param;
1096 }
1097
1098 if (_.isObject(param)) {
1099 if (this._dialect.supports.schemas) {
1100 if (param.schema) {
1101 table += `${this.quoteIdentifier(param.schema)}.`;
1102 }
1103
1104 table += this.quoteIdentifier(param.tableName);
1105 } else {
1106 if (param.schema) {
1107 table += param.schema + (param.delimiter || '.');
1108 }
1109
1110 table += param.tableName;
1111 table = this.quoteIdentifier(table);
1112 }
1113 } else {
1114 table = this.quoteIdentifier(param);
1115 }
1116
1117 if (alias) {
1118 table += ` ${this.getAliasToken()} ${this.quoteIdentifier(alias)}`;
1119 }
1120
1121 return table;
1122 }
1123
1124 /*
1125 Escape a value (e.g. a string, number or date)

Callers 15

describeTableQueryMethod · 0.95
dropTableQueryMethod · 0.95
renameTableQueryMethod · 0.95
insertQueryMethod · 0.95
bulkInsertQueryMethod · 0.95
updateQueryMethod · 0.95
arithmeticQueryMethod · 0.95
addIndexQueryMethod · 0.95
addConstraintQueryMethod · 0.95
getConstraintSnippetMethod · 0.95
removeConstraintQueryMethod · 0.95
quoteMethod · 0.95

Calls 2

quoteIdentifierMethod · 0.95
getAliasTokenMethod · 0.95

Tested by 1

testFunction · 0.64