Skip to content

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

@Dev0n

Description

@Dev0n

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions