0

我正在开发 bb 应用程序,应用程序已完成,但从 sqlite 选择数据时速度很慢,我无法找到任何提高性能的解决方案,请参阅下面的代码

for(int a=0;a<200;a++){
   retrieveCode(selectQuery);
}

在哪里

public String retrieveCode(String query)
{
    String s = "";   
    Vector v = new Vector();

    try
    {
        g.vec_Result = new Vector();

        // Read in all records from the Category table
        Statement statement = _db.createStatement(query);//"SELECT * FROM samples"

        statement.prepare();
        Cursor cursor = statement.getCursor();              

        Row row;
        // Iterate through the result set.  For each row, create a new
        // Category object and add it to the hash table. 
        while(cursor.next())
        {
             row = cursor.getRow();

             s = row.getString(0);
             v.addElement(vmd);
        }
        statement.close();
        cursor.close();
    }
    catch(DatabaseException dbe)
    {
        g.errorDialog(dbe.toString());
    }
    catch(DataTypeException dte)
    {
        g.errorDialog(dte.toString());
    }
    s = v.firstElement().toString();
    return s;    
}

我正在为 OS5.0 开发,请帮助

4

0 回答 0