get date from sfsobject of java api

Post here your questions about the Java client / Android API for SFS2X

Moderators: Lapo, Bax

muni
Posts: 12
Joined: 27 Aug 2012, 04:56

get date from sfsobject of java api

Postby muni » 19 Nov 2012, 06:17

I'm getting date from mysql table...... I had a problem while getting from sfsobject....

I had used getutfstring, getInt , getDouble and getLong,, but i ended with cast error...

note : date format :: 2012-11-18 04:09:08

IDBManager dbManager=getParentExtension().getParentZone().getDBManager();
String query="SELECT created, total_score FROM wkm_challenge_players where player_id="+userId+"";
try {
ISFSArray result=dbManager.executeQuery(query);
for(int i=0;i<result.size();i++)
{
ISFSObject response=result.getSFSObject(i);
trace("created---------"+response.getLong("created")); (where i get casting error........ : :roll: )
trace("total_score-----"+response.getInt("total_score"));
}

Many Thanks,
Muni
User avatar
Lapo
Site Admin
Posts: 23027
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: get date from sfsobject of java api

Postby Lapo » 19 Nov 2012, 16:45

Maybe there's a type mismatch between the DB type and the Java type.
Try to dump the whole result object to see what type the "created" field was mapped to.

Simply add to your code:

Code: Select all

trace(result.getDump());
Lapo
--
gotoAndPlay()
...addicted to flash games

Return to “SFS2X Java / Android API”

Who is online

Users browsing this forum: No registered users and 30 guests