aaron3481 / assql

Automatically exported from code.google.com/p/assql
0 stars 0 forks source link

Issues With rs.first() and rs.last(); (Fix is commited in subversion) #59

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Have 2 tables set up, Account (has columns identity [primary key], name,
type, pass) and AccountBeatMeUpToo (identity [primary key], some other fields)

2. execute the query SELECT * FROM Account INNER JOIN AccountBeatMeUpToo ON
Account.identity=AccountBeatMeUpToo.identity WHERE Account.name='Will' AND
Account.identity='Will.0' AND Account.type=0

3. try to do:  rs.first(); rs.getString("pass")

What is the expected output? What do you see instead?

expected: returns the value in the 'pass' column of the first table
what I see: Cannot access a property or method of a null object reference.
    at
com.maclema.mysql::ResultSet/getString()[/Users/Matt/Documents/00-Flex/assql/com
/maclema/mysql/ResultSet.as:171]

What version of the product are you using? On what operating system?

2.7 on Windows2000

Please provide any additional information below.

This previously worked in 2.6, All I did was switch out 2.6 with 2.7 and it
 broke.

Original issue reported on code.google.com by will.per...@gmail.com on 8 Aug 2008 at 6:10

GoogleCodeExporter commented 9 years ago
this is an issue with rs.first() and rs.last() methods. I have commited the fix 
into
subversion if you wish to checkout the latest code.

If you have the source, in ResultSet you can change the first()/last() methods 
to the
following:

/**
 * Moves the pointer to the first row
 **/
public function first():Boolean
{
    if ( rows.length == 0 )
    {
        index = -1;
        return false;
    }

    index = 0;
    initRow(index);
    return true;
}

/**
 * Moves the pointer to the last row.
 **/
public function last():Boolean
{
    if ( rows.length == 0 )
    {
        index = -1;
        return false;
    }

    index = rows.length-1;
    initRow(index);
    return true;
}

Original comment by macl...@gmail.com on 8 Aug 2008 at 7:30

GoogleCodeExporter commented 9 years ago

Original comment by macl...@gmail.com on 8 Aug 2008 at 7:31

GoogleCodeExporter commented 9 years ago

Original comment by macl...@gmail.com on 8 Aug 2008 at 7:32

GoogleCodeExporter commented 9 years ago

Original comment by macl...@gmail.com on 8 Aug 2008 at 7:33

GoogleCodeExporter commented 9 years ago

Original comment by macl...@gmail.com on 1 Mar 2010 at 2:48