lib/adapters/mysql.js
function (tableName, opts) {
            var m = this.outputIdentifierFunc, im = this.inputIdentifierFunc, self = this;
            return this.metadataDataset.withSql("DESCRIBE ?", sql.identifier(im(tableName))).map(function (row) {
                var ret = {};
                var e = row[m("Extra")];
                var allowNull = row[m("Null")];
                var key = row[m("Key")];
                ret.autoIncrement = e.match(/auto_increment/i) !== null;
                ret.allowNull = allowNull.match(/Yes/i) !== null;
                ret.primaryKey = key.match(/PRI/i) !== null;
                var defaultValue = row[m("Default")];
                ret["default"] = Buffer.isBuffer(defaultValue) ? defaultValue.toString() : defaultValue;
                if (isEmpty(row["default"])) {
                    row["default"] = null;
                }
                ret.dbType = row[m("Type")];
                if (Buffer.isBuffer(ret.dbType)) {
                    //handle case for field type being returned at 252  (i.e. BLOB)
                    ret.dbType = ret.dbType.toString();
                }
                ret.type = self.schemaColumnType(ret.dbType.toString("utf8"));
                var fieldName = m(row[m("Field")]);
                return [fieldName, ret];
            });
        }
function (tableName, opts) {
            var m = this.outputIdentifierFunc, im = this.inputIdentifierFunc, self = this;
            return this.metadataDataset.withSql("DESCRIBE ?", sql.identifier(im(tableName))).map(function (row) {
                var ret = {};
                var e = row[m("Extra")];
                var allowNull = row[m("Null")];
                var key = row[m("Key")];
                ret.autoIncrement = e.match(/auto_increment/i) !== null;
                ret.allowNull = allowNull.match(/Yes/i) !== null;
                ret.primaryKey = key.match(/PRI/i) !== null;
                var defaultValue = row[m("Default")];
                ret["default"] = Buffer.isBuffer(defaultValue) ? defaultValue.toString() : defaultValue;
                if (isEmpty(row["default"])) {
                    row["default"] = null;
                }
                ret.dbType = row[m("Type")];
                if (Buffer.isBuffer(ret.dbType)) {
                    //handle case for field type being returned at 252  (i.e. BLOB)
                    ret.dbType = ret.dbType.toString();
                }
                ret.type = self.schemaColumnType(ret.dbType.toString("utf8"));
                var fieldName = m(row[m("Field")]);
                return [fieldName, ret];
            });
        }
function ( tableName , opts ) { var m = this . outputIdentifierFunc , im = this . inputIdentifierFunc , self = this ; return this . metadataDataset . withSql ( "DESCRIBE ?" , sql . identifier ( im ( tableName ) ) ) . map ( function ( row ) { var ret = { } ; var e = row [ m ( "Extra" ) ] ; var allowNull = row [ m ( "Null" ) ] ; var key = row [ m ( "Key" ) ] ; ret . autoIncrement = e . match ( / auto_increment / i ) !== null ; ret . allowNull = allowNull . match ( / Yes / i ) !== null ; ret . primaryKey = key . match ( / PRI / i ) !== null ; var defaultValue = row [ m ( "Default" ) ] ; ret [ "default" ] = Buffer . isBuffer ( defaultValue ) ? defaultValue . toString ( ) : defaultValue ; if ( isEmpty ( row [ "default" ] ) ) { row [ "default" ] = null ; } ret . dbType = row [ m ( "Type" ) ] ; if ( Buffer . isBuffer ( ret . dbType ) ) { //handle case for field type being returned at 252  (i.e. BLOB) ret . dbType = ret . dbType . toString ( ) ; } ret . type = self . schemaColumnType ( ret . dbType . toString ( "utf8" ) ) ; var fieldName = m ( row [ m ( "Field" ) ] ) ; return [ fieldName , ret ] ; } ) ; }
Use the MySQL specific DESCRIBE syntax to get a table description.
Use the MySQL specific DESCRIBE syntax to get a table description .