DB query return with DataRow of nulls

Post here your questions about Actionscript and Java server side extensions development.

Moderators: Lapo, Bax

eyal
Posts: 35
Joined: 29 Nov 2009, 11:18

DB query return with DataRow of nulls

Postby eyal » 24 Feb 2010, 15:35

Hi,
I'm using MySql with my SFS for login check through internal event.
I'm using the following code for the query:

Code: Select all

      String sql = "SELECT " + " * "  + " FROM " + DB_TBL_NAME + " WHERE " +
         DB_USER_ID + "='" + name + "'" +
         "AND " + DB_USER_PWD + "='" + pass + "'";
      // Execute the query
      ArrayList arrayList = dbManager.executeQuery(sql);

The return arrayList contains 1 DataRow which contains nulls.
Do you have any idea about this problem?
Do you know how to solve it?
Thanks,
Eyal.
orthiac
Posts: 115
Joined: 25 Jun 2008, 10:03
Location: Massachusetts, USA

Postby orthiac » 25 Feb 2010, 10:17

eyal -

I would try to hard-code the query first to determine if it is actually getting the datarow correctly.

Code: Select all

String sql = "select * from users where username = 'Mike'";
      ArrayList<DataRow> arrayList = dbManager.executeQuery(sql);

If that returns your expected results, one-by-one start substituting the variables.

Code: Select all

String sql = "select * from users where username = '"+name+"'";
      ArrayList<DataRow> arrayList = dbManager.executeQuery(sql);
until you find what is causing the failure.

Sometimes it's as simple as a String/int issue and just requires a convert to set up the var for the query.

Good luck - Mike

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 25 guests