[ Previous ] [ Contents ] [ Index ] [ Next ]

Ns_DbPoolGetMultipleHandles

Overview

Get multiple database handles from pool

Syntax

    int Ns_DbPoolGetMultipleHandles(
    	Ns_DbHandle **handles,
    	char         *poolname,
    	int           nhandles
    );

Description

The Ns_DbPoolGetMultipleHandles function gets a database handle from the pool specified by poolname and returns an array of handles (handles). If all of the specified number of handles (nhandles) are not available, the function waits until they are. It returns NS_OK if all requested handles are returned or NS_ERROR on an error condition. You must request all the database handles you will need for a specific pool with one call to Ns_DbPoolGetHandle (if you need only one handle) or Ns_DbPoolGetMultipleHandles (if you need more than one handle). You must release all your database handles explicitly (with Ns_DbPoolPutHandle) before acquiring more.

Example

    #define NUM_HANDLES 5
    Ns_DbHandle **handles;
    
    handles = ns_malloc(NUM_HANDLES * sizeof (Ns_DbHandle *));
    if (Ns_DbPoolGetMultipleHandles(handles, "aPoolName",
    					 			NUM_HANDLES) != NS_OK) {
    	Ns_Set *row;
    	row = Ns_DbSelect(handles[0], "select * from aTable");
    	...
    } else {
    	/* handle error condition */
    }
    

Top of Page

[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright © 1996 America Online, Inc.