Skip to content

Commit

Permalink
Add connection pool limit option
Browse files Browse the repository at this point in the history
  • Loading branch information
v-chojas committed May 7, 2021
1 parent 6727dee commit 6df155f
Show file tree
Hide file tree
Showing 7 changed files with 917 additions and 594 deletions.
18 changes: 18 additions & 0 deletions DriverManager/SQLAllocHandle.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,9 @@ static char const rcsid[]= "$RCSfile: SQLAllocHandle.c,v $ $Revision: 1.13 $";
*/

extern int pooling_enabled;
extern int pool_max_size;
extern int pool_wait_timeout;


/*
* this is used so that it can be called without falling
Expand All @@ -277,6 +280,8 @@ SQLRETURN __SQLAllocHandle( SQLSMALLINT handle_type,
{
DMHENV environment;
char pooling_string[ 128 ];
char pool_max_size_string [ 128 ];
char pool_wait_timeout_string [ 128 ];

if ( !output_handle )
{
Expand Down Expand Up @@ -308,6 +313,19 @@ SQLRETURN __SQLAllocHandle( SQLSMALLINT handle_type,
pooling_enabled = 0;
}

if ( pooling_enabled )
{
SQLGetPrivateProfileString( "ODBC", "PoolMaxSize", "0",
pool_max_size_string, sizeof( pool_max_size_string ),
"ODBCINST.INI" );
pool_max_size = atoi( pool_max_size_string );

SQLGetPrivateProfileString( "ODBC", "PoolWaitTimeout", "30",
pool_wait_timeout_string, sizeof( pool_wait_timeout_string ),
"ODBCINST.INI" );
pool_wait_timeout = atoi( pool_wait_timeout_string );
}

if ( !( environment = __alloc_env()))
{
*output_handle = SQL_NULL_HENV;
Expand Down
Loading

0 comments on commit 6df155f

Please sign in to comment.