multiple connections to a sqlite database

Discussion in 'Questions (Windows Mobile)' started by Peter, May 12, 2007.

  1. Peter

    Peter Member Licensed User

    Can anybody please tell me how can i make more than one connection to the same database?

    Peter
     
  2. Cableguy

    Cableguy Expert Licensed User

    Why do You need to make more than one conection to the Same DB in the Same APP?
     
  3. Peter

    Peter Member Licensed User

    The database containes several tables, linked by other tables in the same database.

    for example:
    table 1 containes films + details, primary key is the filmnumber
    table 2 containes filmnumber, personalnumber, functionnumber
    table 3 containes data about a person, primary key is personalnumber

    Several persons can have the same function with a film.
    Connection 1 would be for selecting all personalnumbers with a function in a certain film
    connection 2 would be for selecting the data for each person in the results of connection 1.

    I had thought this would be the easiest way to get the results i want, instead of storing the results of connection 1 in a temporary variable.

    Peter
     
  4. Cableguy

    Cableguy Expert Licensed User

    Not quite sure if it works but you could try to add several objects with dirent names like "con1","con2",... and then when conecting to the database use the respective con...
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    Two connections will not help here.
    You could do it with one command.
    Something like:
    SELECT * FROM tabl1, table2, table3 WHERE table1.filmnumber = table2.filmnumber AND table2.personalnumber = table3.personalnumber

    Search the web for SQL join for more information.
     
  6. Peter

    Peter Member Licensed User

    I know it can be done in one query, in fact it is the easiest (programming)way. The downside of this is a much worse performance.

    I haven't tried this with b4ppc (obviously), but i've had some experience with a comparable situation in VB6 on the PC. When i did a single query the results took about 14 seconds, while two queries together took a fraction of a second. Which is why i prefer to do it likewise on the PPC, which requieres two connections.

    Peter
     
Loading...