jdonaldson / postgrehx

An implementation of the postgres wire protocol in Haxe
16 stars 3 forks source link

manager.count and manager.unsafeCount break in getIntResult() #12

Closed theRemix closed 10 years ago

theRemix commented 10 years ago

i gave it a good solid effort, and i could not figure out why getIntResult() does not work with SELECT COUNT(*) FROM Table

i did find that current_row is null, and my guess is that because it's a spod manager, it expects an id field, which COUNT(*) does not give that.

var safeCount = test_spod_manager.count(true);
var unsafeCount = test_spod_manager.unsafeCount('SELECT COUNT(*) as FROM TestSpodObject');
assertTrue(safeCount > 0);
assertTrue(unsafeCount > 0);

of course the con.request works just fine, so getIntResult() probably doesn't need to be changed.

var res = con.request( 'SELECT COUNT(*) FROM TestSpodObject' );
var r = res.next();
assertTrue(r.count > 0);
jdonaldson commented 10 years ago

I think this should be fixed in the latest version.