Android Question Any tool to test sqlite queries?

Discussion in 'Android Questions' started by Alberto Michelis, Jun 15, 2015.

  1. Alberto Michelis

    Alberto Michelis Active Member Licensed User

    This select works ok...
    Code:
    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
    Code:
    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
     
  2. LucaMs

    LucaMs Expert Licensed User

  3. Alberto Michelis

    Alberto Michelis Active Member Licensed User

    Thanks, I've tried this query with SQLite Expert personal and it works as expected, but using Cursor1 = SQL1.ExecQuery() I get no rows.
    Any Idea??
     
  4. LucaMs

    LucaMs Expert Licensed User

    If you are sure you have tested the same query, then the db is different.
     
    DonManfred likes this.
  5. Alberto Michelis

    Alberto Michelis Active Member Licensed User

    No, verified, same DB.
     
  6. eurojam

    eurojam Well-Known Member Licensed User

    May be you should use alias names for the grouped columns like:
    Code:
    Cursor1 = SQL1.ExecQuery("SELECT
    posicion.especie,max(cotiza.sector) as maxsector ...
     
  7. LucaMs

    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.
     
    Informatix likes this.
  8. Alberto Michelis

    Alberto Michelis Active 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>
     
  9. Mahares

    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 and DonManfred like this.
  10. LucaMs

    LucaMs Expert Licensed User

    Unfortunately, there is also the risk that he becomes a LucaMs :D
     
  11. Alberto Michelis

    Alberto Michelis Active 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...
     
  12. LucaMs

    LucaMs Expert Licensed User

    Do you think that bugs are only in programs of idiots?

    Then we are all idiots :)
     
    GGSoft and Mahares like this.
Loading...