Android Question Any tool to test sqlite queries?

Alberto Michelis

Well-Known Member
Licensed User
This select works ok...
B4X:
Cursor1 = SQL1.ExecQuery("SELECT 
cotiza.ultimoleido,posicion.PF,posicion.id,cotiza.sector,posicion.especie,
posicion.cantidad,posicion.costo,cotiza.ultimo,cotiza.dia,cotiza.cantbid,
cotiza.bid,cotiza.ask,cotiza.cantask,posicion.comiscompra,posicion.sl,posicion.sg 
FROM posicion 
left outer join cotiza on cotiza.especie=posicion.especie 
order by posicion.especie")
This is the same but group by and brigs 0 rows
B4X:
Cursor1 = SQL1.ExecQuery("SELECT 
posicion.especie,max(cotiza.sector),max(cotiza.ultimoleido),min(posicion.PF),
min(posicion.id),sum(posicion.cantidad),avg(posicion.costo),max(cotiza.ultimo),
max(cotiza.dia),max(cotiza.cantbid),max(cotiza.bid),max(cotiza.ask),
max(cotiza.cantask),sum(posicion.comiscompra),min(posicion.sl),
max(posicion.sg) 
FROM posicion 
left outer join cotiza on cotiza.especie=posicion.especie 
group by posicion.especie 
order by posicion.especie")
Any tool with which I can test queries before using it in the app?
Thanks
 

eurojam

Well-Known Member
Licensed User
May be you should use alias names for the grouped columns like:
B4X:
Cursor1 = SQL1.ExecQuery("SELECT
posicion.especie,max(cotiza.sector) as maxsector ...
 

LucaMs

Expert
Licensed User
The problem can only be one of the three below (I THINK):

1) the query tested in SQLite expert Is not the same used in the project
2) the db used in SQLite Expert is not the same used in the project
3) displaying the results in the project is wrong.
 

Alberto Michelis

Well-Known Member
Licensed User
1) the query is copied from the source code withot any modification.
2) the db is copied from the phone to a new folder that had no db in it, its the same.
3) ??

I will make an little app to demostrate the problem, may making it I'll find the bug <G>
 

Mahares

Well Known Member
Licensed User
Your best bet is to zip your project or a miniature project, do not forget to include your database or a portion of it. Someone in the forum will discover the problem.
Are you really 14 years old? If you are not pulling our chains, then perhaps in a few years you will become Erel and Manfred combined in one.
 

LucaMs

Expert
Licensed User
Your best bet is to zip your project or a miniature project, do not forget to include your database or a portion of it. Someone in the forum will discover the problem.
Are you really 14 years old? If you are not pulling our chains, then perhaps in a few years you will become Erel and Manfred combined in one.
Unfortunately, there is also the risk that he becomes a LucaMs :D
 

Alberto Michelis

Well-Known Member
Licensed User
No, a pity but... I'm not 14
And I'm an idiot because all this thread was by a big bug in my app.
I Hope I could delete it!
Thanks all
Sory all...
 
Top