Android: SQLite Function Doesn't Return Valid Data

OK...I'm stumped! I wrote the following code circa 13-Feb-2013 and it has worked perfectly up till a few days ago:

/** 
 * Get a count of all resources in the selected Alliance
 * 
 * @param db    The EWTraker db
 * @param Sector    the Sector to be accessed
 * @param Alliance  the Alliance to be accessed */
public long[] getCountAllc(SQLiteDatabase db, String Sector, String Alliance){
    if (BuildConfig.DEBUG) {
        Log.i(Constants.TAG_DBHELPER, "getCountAllc(): Sector: "+Sector);
        Log.i(Constants.TAG_DBHELPER, "getCountAllc(): Alliance: "+Alliance);
    }
    long[] mTblCountArray = new long[6];
    String[] s = new String[2];
    s[0] = Sector;
    s[1] = Alliance;
    try{
        mTblCountArray[0] = DatabaseUtils.queryNumEntries(db,"TPLYS","FSECTR=? AND FANAME=?",s);
        mTblCountArray[1] = DatabaseUtils.queryNumEntries(db,"TBASE","FSECTR=? AND FANAME=?",s);
        mTblCountArray[2] = DatabaseUtils.queryNumEntries(db,"TBLDG","FSECTR=? AND FANAME=?",s);
        mTblCountArray[3] = DatabaseUtils.queryNumEntries(db,"TTRPS","FSECTR=? AND FANAME=?",s);
        mTblCountArray[4] = DatabaseUtils.queryNumEntries(db,"TINVY","FSECTR=? AND FANAME=?",s);
        mTblCountArray[5] = DatabaseUtils.queryNumEntries(db,"TMSNS","FSECTR=? AND FANAME=?",s);
        if (BuildConfig.DEBUG) {
          Log.i(Constants.TAG_DBHELPER, "getCountAllc(): Alliance No. of Players: "+mTblCountArray[0]);
          Log.i(Constants.TAG_DBHELPER, "getCountAllc(): Alliance No. of Bases: "+mTblCountArray[1]);
          Log.i(Constants.TAG_DBHELPER, "getCountAllc(): Alliance No. of Buildings: "+mTblCountArray[2]);
          Log.i(Constants.TAG_DBHELPER, "getCountAllc(): Alliance No. of Troup Rows: "+mTblCountArray[3]);
          Log.i(Constants.TAG_DBHELPER, "getCountAllc(): Alliance No. of Items: "+mTblCountArray[4]);
          Log.i(Constants.TAG_DBHELPER, "getCountAllc(): Alliance No. of Missions: "+mTblCountArray[5]);
        }
    } catch (Exception e) {
        Log.e(Constants.TAG_DBHELPER, "getCountAllc(): Exception while getting record count:");
        Log.e(Constants.TAG_DBHELPER, "getCountAllc(): Cause: "+e.getCause());
        Log.e(Constants.TAG_DBHELPER, "getCountAllc(): Message: "+e.getMessage());
        e.printStackTrace();
    }
    return mTblCountArray;
}

I'm at a TOTAL loss and would welcome any tip that would point me in the right direction. When completed all the numbers in the array are '0' when i know 100% that they should be greater than '0'. The arguments "Sector" and "Alliance" to the query are valid and exist in the queried tables in the database.

Thanks!

Answers


It turns out the function does work; the problem is with a particular piece of data i entered.


Need Your Help

Cannot compile Vagrant VirtualBox Guest Additions on 3.8 Kernel

ubuntu kernel virtualbox vagrant

Using VirtualBox 4.3.4 with Vagrant 1.3.5. Running an Ubuntu 12.04.3 box with a 3.8 kernel:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.