Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
telematicus
Posts: 9
Registered: ‎06-29-2011
My Device: Not specified
My Carrier: Not specified
Accepted Solution

SELECT return 0 rows after upgrade to 7.0.0

Hi

 

I've developed a Bold 9780 application (BB6) and now I'm upgrading the application to deploy it into a Simulator Bold 9900 (BB7). The application uses a SQLite database (not encrypted)

 

Apparently everything looks OK at the start (creates the table and fill up the tables through INSERT) but when I try to recover the information from the database (a simple SELECT) It returns no rows.

 

I open the database by other means and I can confirm the information is in the table (so the CREATE and INSERT commands work), but the SELECT always returns 0 rows.

 

Following there is the code I originally executing (in BB6 works perfectly), but finally I change it to make a simple simple "SELECT * FROM table" to be sure I do not miss anything.

 

Does anybody find a similar problem? Do I miss something?

 

Thanks in advance

 

protected Statement executeQuery(String table, String[] columns, String where, String orderBy) throws DatabaseException {
        char comma=',';
        char space=' ';
        StringBuffer sb=new StringBuffer();
       
        //Build the statement
        //SELECT
        sb.append(Util.STRING_SQL_SELECT);
        //COLUMNS
        int size=columns.length;
        boolean isFirst=true;
        for(int i=0;i<size;++i) {
            if(isFirst) {
                isFirst=false;
            } else {
                sb.append(comma);
                sb.append(space);
            }
            sb.append(columns[i]);
        }
        //FROM
        sb.append(Util.STRING_SQL_FROM);
        sb.append(table);
        //WHERE
        sb.append(Util.STRING_SQL_WHERE);
        sb.append(where);
        //ORDER BY
        sb.append(Util.STRING_SQL_ORDERBY);
        sb.append(orderBy);
        LOG.info(CabisDatabase.class,sb.toString());
        //Create the statement
        Statement st=mDb.createStatement(sb.toString());//"SELECT * FROM "+table
        //Prepare the statement
        st.prepare();
        st.setCursorBufferSize(10);
        //Execute the query
        return st;
    }

Please use plain text.
New Developer
telematicus
Posts: 9
Registered: ‎06-29-2011
My Device: Not specified
My Carrier: Not specified

Re: SELECT return 0 rows after upgrade to 7.0.0

:Whistling:

After becoming crazy I notice I miss I can not invoke Cursor.isEmpty() before invoke Cursor.last(), Cursor.first() or Cursor.next(). If I do that Cursor.isEmpty() always returns true.

Please use plain text.