mirror of
https://github.com/gnustep/libs-sqlclient.git
synced 2025-02-22 11:21:20 +00:00
provide available connections
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/sqlclient/trunk@37985 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
e9e530123c
commit
8faf0731ec
2 changed files with 22 additions and 0 deletions
|
@ -1424,6 +1424,10 @@ SQLCLIENT_PRIVATE
|
||||||
NSTimeInterval _failWaits; /** Time waiting for timewouts */
|
NSTimeInterval _failWaits; /** Time waiting for timewouts */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Returns the count of currently available connections in the pool.
|
||||||
|
*/
|
||||||
|
- (int) availableConnections;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a pool of clients using a single client configuration.<br />
|
* Creates a pool of clients using a single client configuration.<br />
|
||||||
* Calls -initWithConfiguration:name:pool: (passing NO to say the client
|
* Calls -initWithConfiguration:name:pool: (passing NO to say the client
|
||||||
|
|
|
@ -56,6 +56,24 @@
|
||||||
|
|
||||||
@implementation SQLClientPool
|
@implementation SQLClientPool
|
||||||
|
|
||||||
|
- (int) availableConnections
|
||||||
|
{
|
||||||
|
int available;
|
||||||
|
int index;
|
||||||
|
|
||||||
|
[self _lock];
|
||||||
|
available = index = max;
|
||||||
|
while (index-- > 0)
|
||||||
|
{
|
||||||
|
if (YES == u[index])
|
||||||
|
{
|
||||||
|
available--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[self _unlock];
|
||||||
|
return available;
|
||||||
|
}
|
||||||
|
|
||||||
- (void) dealloc
|
- (void) dealloc
|
||||||
{
|
{
|
||||||
SQLClient **clients;
|
SQLClient **clients;
|
||||||
|
|
Loading…
Reference in a new issue