Most of my experience is with Classic ACS4, but assuming this wasn't massively changed in OACS4, in general you should use the
db_
calls (aka "database access api"). Truth/beauty debates aside, if you don't know what you're doing, the
ns_
calls can lead to subtle and hard to track down bugs. The reason is that the database access api performs its own internal database handle accounting and most of ACS relies on it. The
ns_
calls require that you allocate handles manually, so you should only use it if you can be sure that no other
db_*
calls can grab handles from the same pool.
The ArsDigita docs for the db api are here: http://developer.arsdigita.com/doc/db-api-detailed.html.
Perhaps someone can post the OACS URL for this (if it exists).
If you want to perform some operation that is not covered by the
api, you can always use db_with_handle
.