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

Method quoteTable

lib/dialects/abstract/query-generator.js:974–1005  ·  lib/dialects/abstract/query-generator.js::QueryGenerator.quoteTable

* 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

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)

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 1

quoteIdentifierMethod · 0.95

Tested by 1

testFunction · 0.64