Skip to content

Commit

Permalink
Merge pull request #2 from rodrigogs/order_columns_ordinal_position
Browse files Browse the repository at this point in the history
Order columns by ordinal position
  • Loading branch information
rodrigogs authored Jan 11, 2019
2 parents 5e313b3 + 0fbfd72 commit f18e75a
Show file tree
Hide file tree
Showing 7 changed files with 2,666 additions and 1,497 deletions.
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"env": {
"node": true
"node": true,
"es6": true
},
"extends": "eslint:recommended",
"rules": {
Expand Down
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ npm-install-stamp

*.sublime-project
*.sublime-workspace
.idea
*.iml
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ services:
MYSQL_ROOT_PASSWORD: root
mysql80:
image: mysql:8.0
command: [ "--server-id=1", "--log-bin=/var/lib/mysql/mysql-bin.log", "--binlog-format=row"]
command: [ "--server-id=1", "--log-bin=/var/lib/mysql/mysql-bin.log", "--binlog-format=row", "--default-authentication-plugin=mysql_native_password"]
networks:
default:
aliases:
Expand Down
2 changes: 2 additions & 0 deletions docker-test.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/bin/bash
MYSQL_HOSTS="mysql55 mysql56 mysql57 mysql80"

docker-compose up -d

for hostname in ${MYSQL_HOSTS}; do
echo $hostname
docker run -it --network=zongji_default -e MYSQL_HOST=$hostname -w /build -v $PWD:/build node:8 npm test
Expand Down
14 changes: 10 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,16 @@ ZongJi.prototype._executeCtrlCallbacks = function() {
}
};

var tableInfoQueryTemplate = 'SELECT ' +
'COLUMN_NAME, COLLATION_NAME, CHARACTER_SET_NAME, ' +
'COLUMN_COMMENT, COLUMN_TYPE ' +
'FROM information_schema.columns ' + "WHERE table_schema='%s' AND table_name='%s'";
var tableInfoQueryTemplate = `
SELECT
COLUMN_NAME, COLLATION_NAME, CHARACTER_SET_NAME,
COLUMN_COMMENT, COLUMN_TYPE
FROM
information_schema.columns
WHERE
table_schema='%s' AND table_name='%s'
ORDER BY ORDINAL_POSITION;
`;

ZongJi.prototype._fetchTableInfo = function(tableMapEvent, next) {
var self = this;
Expand Down
Loading

0 comments on commit f18e75a

Please sign in to comment.