AIR and reading local sqlite db problem

7 views
Skip to first unread message

kamiseq

unread,
Jan 17, 2009, 1:23:56 PM1/17/09
to Flex India Community
hej, I read data from my local sqlite file. I created the db in
sqlitespy, db is in 3rd version and I open db in async manner.

then I try to read data like this
var statement :SQLStatement = new SQLStatement
();
statement.sqlConnection = conn;

statement.text = 'select c.id_course,
c.id_student, c.total_hours,
c.discount, c.price, c.date as created, c.id_course_type, ct.descr,
sum
(l.total_hour) as done_hours ' +
'from courses c ' +
'left join lessons l on c.id_course =
l.id_course ' +
'inner join coursetypes ct on
c.id_course_type = ct.id_course_type
' +
'where c.id_student = :id_student ' +
'group by c.id_course, c.id_student,
c.total_hours, c.discount,
c.price, c.date, c.id_course_type, ct.descr';

the statement is trivial and I dont have any problem with it when I
run it in sqlite admin ajak

statement.parameters[':id_student'] = 11;
statement.execute(-1, new Responder
(hndLoadSuccess, hndFail));

when statement is executed the hndLoadSuccess is fired

private function hndLoadSuccess(event:SQLResult):void{
var cs : Course;
for each(var c : Object in event.data){
cs = new Course();
cs.id_course = c.id_course;
cs.id_student = c.id_student;

cs.id_course_type = c.id_course_type;
cs.course_type = c.descr;

cs.total_hours = c.total_hours;
cs.done_hours = c.done_hours;
..
so the problem is that c and event.data objects has all data I asked
for (when I investigate in debugger)but assigning values to cs object
fails and all I have are NaNs and nulls. what s more trace() i
Alert.show also throws nullable values :(

I have no idea what I do wrong here I have other select and insert
statement that works great ....
I tried casting and getting values directly from event.data[i] with
same result......

help :)

kamiseq

unread,
Jan 17, 2009, 5:28:07 PM1/17/09
to Flex India Community
ok, here is a print screen http://kamiseq.info/airshit.jpg
I was changing sql statement and found out that without left join and
group by values assigns..... but still I dont think so it is something
about sqllit. any ideas?
Reply all
Reply to author
Forward
0 new messages