With ACS 4 you need as many pools as you want to allow nested queries. It doesn't matter what the pools are named, either (from my reading of
packages/acs-tcl/tcl/10-database-procs.tcl). For example with a normal configuration (main, subquery, log) you can't nest four layers deep:
db_foreach depth_1 { select 'depth 1' from dual } {
db_foreach depth_2 { select 'depth 2' from dual } {
db_foreach depth_3 { select 'depth 3' from dual } {
db_foreach depth_4 { select 'depth 4' from dual } {
set success_p 1
}
}
}
}
Without getting an error:
Ran out of database pools (subquery main log)
Personally I wish the db_* api had been designed to allow you to define pools per database so that you could use the same API and AOLserver instance to talk to both, say, Oracle & Postgres (or Solid or whatever) without having to use the
ns_db API directly. (Perhaps with one of them being the "default" and the others being specified via a switch, like
db_foreach foo_query -database solid ... Pools of pools, so to speak.)