3

Let say I have two tables with a many-to-many relationship (i.e. there is a 3rd table only used for the relationship).

Does SOCI support the different types of 'join' in the statements?

If yes, does it work with all the databases (so called backends in the documentation) ?

Thanks!

unludo
  • 4,912
  • 7
  • 47
  • 71
  • Joins are at database level, not at query level. – DumbCoder Jan 25 '12 at 17:32
  • @DumbCoder You can do a select... join, so it is also at query level. – unludo Jan 26 '12 at 15:02
  • 1
    Sorry should have made it more clearer. Joins are put in the select statement, but they are only used by the Db engine at the Db level. Your statement/editor(if any) doesn't care if you put in the join word or not and does no optimization. – DumbCoder Jan 26 '12 at 15:11

1 Answers1

3

With SOCI, you still have to construct your SQL statements and you can put joins in them (or anything else for that matter). SOCI basically just helps you

  1. to get your input data into the SQL query (with use(...)) and
  2. to work with the returned results in a nice way (with into(...) and rowset, etc.).

Since the result of a select is just a list of rows, no matter whether you use join or not, there's nothing stopping you from using them.

Mika Fischer
  • 4,058
  • 1
  • 26
  • 28
  • Thanks! Does that mean the SQL query is directly passed to the underlying databse driver? Does SOCI do some adaptation regarding possible difference of SQL format between different databases? – unludo Jan 26 '12 at 15:01
  • AFAIK, SOCI doesn't do anything like that. You would have to do this on top of SOCI. – Mika Fischer Jan 26 '12 at 15:24