H2 embedded DB problems

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

Moderators: Lapo, Bax

User avatar
mariana
Posts: 77
Joined: 26 Mar 2007, 11:15
Location: Buenos Aires, Argentina

H2 embedded DB problems

Postby mariana » 02 May 2009, 14:16

I'm trying to do a query on the database:

Code: Select all

sql =  "SELECT SUM(SCORE)as SUMA FROM SCORES WHERE NAME ='"+_server.escapeQuotes(params.nombre)+"'"
sql += " AND GC='" +_server.escapeQuotes(gc)+ "'"
trace ("78  SQL=   "+sql)

queryRes = dbase.executeQuery(sql)
      
tempRow = queryRes.get(0);
var cp = tempRow.getItem("SUMA");
trace("84 "+cp)

var o = {};
o._cmd = "scores"
o.vecScores = cp
_server.sendResponse(o, currentRoomId);

      
}


and I get the right answer (900), but after this the extension gives an error and does not return the result:

Image

can anybody tell me what is happening? I've already checked all the posts on this problem that I could find (908,3612,4166), even tried using as you suggest

Code: Select all

_server.executeQuery(theSql, _server.QUERY_INT_KEYS)

but then the extension fails saying it cannot find the function executeQuery.

Do you know what is happening?

Thanks,

Mariana
User avatar
BigFIsh
Posts: 1698
Joined: 25 Feb 2008, 19:26
Location: New Zealand

Postby BigFIsh » 02 May 2009, 19:48

I think your sendResponse is expecting a userlist (3rd parameter). I think the reason why you're getting "cannot read property 'length' from undefined" is that the array of users is undefined thus the length cannot be read.
Smartfox's forum is my daily newspaper.
User avatar
mariana
Posts: 77
Joined: 26 Mar 2007, 11:15
Location: Buenos Aires, Argentina

Postby mariana » 03 May 2009, 05:53

Hey, THANKS! BigFish.....

I don't know why the _server.sendResponse command worked w/o the user vector in an older program I have running, but such is life with AS, 2 & 3.... right?

I got it working now, thanks to your response.

Mariana

Return to “Server Side Extension Development”

Who is online

Users browsing this forum: No registered users and 20 guests