Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent runQuery results depending on the order of the column names in the query. #3

Open
Dev0n opened this issue Aug 4, 2011 · 0 comments

Comments

@Dev0n
Copy link
Contributor

Dev0n commented Aug 4, 2011

Using the latest snapshot of txMySQL.

Table Schema:

CREATE TABLE `users` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user` varchar(30) NOT NULL DEFAULT '',
  `credit` mediumint(8) unsigned NOT NULL DEFAULT '0',
  `class` tinyint(2) unsigned NOT NULL DEFAULT '0',
  `first_usage` int(10) unsigned NOT NULL DEFAULT '0',
  `last_usage` int(10) unsigned NOT NULL DEFAULT '0',
  `enabled` tinyint(1) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  UNIQUE KEY `idx_uc` (`user`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8

Test Data:

INSERT INTO `users` (`id`,`user`,`credit`,`class`,`first_usage`,`last_usage`,`enabled`) VALUES (1,'foo',1000000,10,1312417862,0,0);

Expected Results:

Running: d = conn.runQuery("SELECT id, user, credit, class, first_usage, last_usage, enabled FROM users")
Yields: [[256, '', 7037701, 112, 1111519090, 1175060495, 232]] - Incorrect

Running: d = conn.runQuery("SELECT id, user, credit, first_usage, last_usage, enabled FROM users")
Yields: [[1, ''foo', 1000000, 971523584, 78, 0]] - Incorrect

Running: d = conn.runQuery("SELECT first_usage, last_usage, enabled, id, user, credit FROM users")
Yields: [[1312417862, 0, 0, 1, 'foo', 1000000]] - Correct

Running: d = conn.runQuery("SELECT credit, class FROM users")
Yields: [[1000000, 0]] - Incorrect

Running: d = conn.runQuery("SELECT class, credit FROM users")
Yields:[[10, 1000000]] - Correct

Issue is possibly related to the mediumint datatype used in the class column.

//EDIT

For testing sake, I changed all the tinyints/mediumints to ints and still not getting the correct results.

Table Schema:

CREATE TABLE `users` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `user` varchar(30) NOT NULL DEFAULT '',
  `credit` int(10) unsigned NOT NULL DEFAULT '0',
  `class` int(2) unsigned NOT NULL DEFAULT '0',
  `first_usage` int(10) unsigned NOT NULL DEFAULT '0',
  `last_usage` int(10) unsigned NOT NULL DEFAULT '0',
  `enabled` int(1) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  UNIQUE KEY `idx_uc` (`user`)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8

Expected Results:

Running: d = conn.runQuery("SELECT id, user, class, credit, first_usage, last_usage, enabled FROM users")
Yields: [[256, '', 1886085893, 683890, 1111490560, 3896901647L, 20025]] - Incorrect

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant