You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "Ron Grabowski (JIRA)" <ib...@incubator.apache.org> on 2005/05/09 19:22:09 UTC
[jira] Created: (IBATISNET-60) QueryForMap(string statementName, object parameterObject, string keyProperty, string valueProperty) not calling session.CloseConnection() correctly
QueryForMap(string statementName, object parameterObject, string keyProperty, string valueProperty) not calling session.CloseConnection() correctly
---------------------------------------------------------------------------------------------------------------------------------------------------
Key: IBATISNET-60
URL: http://issues.apache.org/jira/browse/IBATISNET-60
Project: iBatis for .NET
Type: Bug
Reporter: Ron Grabowski
Assigned to: Gilles Bayon
As of 5/9/2005, the version of IBatisNet.DataMapper.SqlMapper.cs in source control contains the following code:
public IDictionary QueryForMap(string statementName, object parameterObject, string keyProperty, string valueProperty)
{
bool isSessionLocal = false;
IDalSession session = _sessionContainer.LocalSession;
IDictionary map = null;
if (session == null)
{
session = new SqlMapSession(this.DataSource);
session.OpenConnection();
isSessionLocal = true;
}
IMappedStatement statement = GetMappedStatement(statementName);
try
{
map = statement.ExecuteQueryForMap(session, parameterObject, keyProperty, valueProperty);
}
catch
{
throw;
}
finally
{
if ( isSessionLocal )
{
session.CloseConnection();
}
}
If ExecuteQueryForMap completes successfully and isSessionLocal is set to true, session.CloseConnection() is not called. The code should be changed as follows (to match the other QueryFor... methods):
try
{
map = statement.ExecuteQueryForMap(session, parameterObject, keyProperty, valueProperty);
}
catch
{
throw;
}
finally
{
if ( isSessionLocal )
{
session.CloseConnection();
}
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[jira] Commented: (IBATISNET-60) QueryForMap(string statementName, object parameterObject, string keyProperty, string valueProperty) not calling session.CloseConnection() correctly
Posted by "Ron Grabowski (JIRA)" <ib...@incubator.apache.org>.
[ http://issues.apache.org/jira/browse/IBATISNET-60?page=comments#action_64760 ]
Ron Grabowski commented on IBATISNET-60:
----------------------------------------
I pasted the example code in wrong. Both examples are of the corrected code. Here is the wrong code and corrected code:
// WRONG
try
{
map = statement.ExecuteQueryForMap(session, parameterObject, keyProperty, valueProperty);
}
catch
{
if ( isSessionLocal )
{
session.CloseConnection();
}
throw;
}
// CORRECT
try
{
map = statement.ExecuteQueryForMap(session, parameterObject, keyProperty, valueProperty);
}
catch
{
throw;
}
finally
{
if ( isSessionLocal )
{
session.CloseConnection();
}
}
> QueryForMap(string statementName, object parameterObject, string keyProperty, string valueProperty) not calling session.CloseConnection() correctly
> ---------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: IBATISNET-60
> URL: http://issues.apache.org/jira/browse/IBATISNET-60
> Project: iBatis for .NET
> Type: Bug
> Reporter: Ron Grabowski
> Assignee: Gilles Bayon
>
> As of 5/9/2005, the version of IBatisNet.DataMapper.SqlMapper.cs in source control contains the following code:
> public IDictionary QueryForMap(string statementName, object parameterObject, string keyProperty, string valueProperty)
> {
> bool isSessionLocal = false;
> IDalSession session = _sessionContainer.LocalSession;
> IDictionary map = null;
> if (session == null)
> {
> session = new SqlMapSession(this.DataSource);
> session.OpenConnection();
> isSessionLocal = true;
> }
> IMappedStatement statement = GetMappedStatement(statementName);
> try
> {
> map = statement.ExecuteQueryForMap(session, parameterObject, keyProperty, valueProperty);
> }
> catch
> {
> throw;
> }
> finally
> {
> if ( isSessionLocal )
> {
> session.CloseConnection();
> }
> }
> If ExecuteQueryForMap completes successfully and isSessionLocal is set to true, session.CloseConnection() is not called. The code should be changed as follows (to match the other QueryFor... methods):
> try
> {
> map = statement.ExecuteQueryForMap(session, parameterObject, keyProperty, valueProperty);
> }
> catch
> {
> throw;
> }
> finally
> {
> if ( isSessionLocal )
> {
> session.CloseConnection();
> }
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
[jira] Closed: (IBATISNET-60) QueryForMap(string statementName, object parameterObject, string keyProperty, string valueProperty) not calling session.CloseConnection() correctly
Posted by "Gilles Bayon (JIRA)" <ib...@incubator.apache.org>.
[ http://issues.apache.org/jira/browse/IBATISNET-60?page=all ]
Gilles Bayon closed IBATISNET-60:
---------------------------------
Resolution: Fixed
Fix Version: DataMapper 1.2
Thanks Ron
> QueryForMap(string statementName, object parameterObject, string keyProperty, string valueProperty) not calling session.CloseConnection() correctly
> ---------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: IBATISNET-60
> URL: http://issues.apache.org/jira/browse/IBATISNET-60
> Project: iBatis for .NET
> Type: Bug
> Reporter: Ron Grabowski
> Assignee: Gilles Bayon
> Fix For: DataMapper 1.2
>
> As of 5/9/2005, the version of IBatisNet.DataMapper.SqlMapper.cs in source control contains the following code:
> public IDictionary QueryForMap(string statementName, object parameterObject, string keyProperty, string valueProperty)
> {
> bool isSessionLocal = false;
> IDalSession session = _sessionContainer.LocalSession;
> IDictionary map = null;
> if (session == null)
> {
> session = new SqlMapSession(this.DataSource);
> session.OpenConnection();
> isSessionLocal = true;
> }
> IMappedStatement statement = GetMappedStatement(statementName);
> try
> {
> map = statement.ExecuteQueryForMap(session, parameterObject, keyProperty, valueProperty);
> }
> catch
> {
> throw;
> }
> finally
> {
> if ( isSessionLocal )
> {
> session.CloseConnection();
> }
> }
> If ExecuteQueryForMap completes successfully and isSessionLocal is set to true, session.CloseConnection() is not called. The code should be changed as follows (to match the other QueryFor... methods):
> try
> {
> map = statement.ExecuteQueryForMap(session, parameterObject, keyProperty, valueProperty);
> }
> catch
> {
> throw;
> }
> finally
> {
> if ( isSessionLocal )
> {
> session.CloseConnection();
> }
> }
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira