You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ibatis.apache.org by "Roberto Rabe (JIRA)" <ib...@incubator.apache.org> on 2005/05/06 15:44:08 UTC

[jira] Resolved: (IBATISNET-49) Exceptions such as NotSupportedException not handled gracefully in CreateParametersForStatementText()

     [ http://issues.apache.org/jira/browse/IBATISNET-49?page=all ]
     
Roberto Rabe resolved IBATISNET-49:
-----------------------------------

     Resolution: Fixed
    Fix Version: DataMapper 1.2

Resolved (assuming this is working as needed...Ron?)

> Exceptions such as NotSupportedException not handled gracefully in CreateParametersForStatementText()
> -----------------------------------------------------------------------------------------------------
>
>          Key: IBATISNET-49
>          URL: http://issues.apache.org/jira/browse/IBATISNET-49
>      Project: iBatis for .NET
>         Type: Bug
>     Versions: DataMapper 1.1
>  Environment: [assembly: AssemblyVersion("1.1.458")]
>     Reporter: Ron Grabowski
>     Assignee: Roberto Rabe
>      Fix For: DataMapper 1.2

>
> SQLite:
>  http://www.sqlite.org/
> doesn't have strongly typed data columns like most other databases. The SQLite.Net provider:
>  http://sourceforge.net/projects/adodotnetsqlite
> throws NotSupportedExceptions when code like this is executed:
>  ((IDbDataParameter)dataParameter).Precision = property.Precision;
> [NotSupportedException: Specified method is not supported.]
>    Finisar.SQLite.SQLiteParameter.set_Precision(Byte value)
>    IBatisNet.DataMapper.Configuration.Statements.PreparedStatementFactory.CreateParametersForStatementText()
> A naive way to solve this is to simply wrap the setting of IDbDataParameter properties in a try/catch block:
> try
> {
>  // Set IDbDataParameter
>  if (property.Size != -1)
>  {
>  ((IDbDataParameter)dataParameter).Size = property.Size;
>  }
>  ((IDbDataParameter)dataParameter).Precision = property.Precision;
>  ((IDbDataParameter)dataParameter).Scale = property.Scale;
> }
> catch
> {
> }
> This thread:
>  http://tinyurl.com/atwzn 
>  http://www.mail-archive.com/ibatis-user-cs@incubator.apache.org/msg00317.html
> talks about similiar issues with an Oracle provider that can be solved by not setting the certain IDbDataParameter properties. Perhaps it may be worthwhile to look into adding additional attributes to the <provider> nodes in providers.config to specify which properties of the IDbDataParameter to set. For example this is how a <provider> entry may look after incorporating this idea as well as ideas from IBATISNET-48 and IBATISNET-47:
>  <provider
>   name="SQLite3"
>   enabled="true" 
>   assemblyName="SQLite.NET, Version=0.21.1869.3794, Culture=neutral, PublicKeyToken=c273bd375e695f9c"
>   connectionClass="Finisar.SQLite.SQLiteConnection"
>   commandClass="Finisar.SQLite.SQLiteCommand"
>   parameterClass="Finisar.SQLite.SQLiteParameter"
>   parameterDbTypeClass="System.Data.DbType, System.Data"
>   parameterDbTypeProperty="DbType"
>   dataAdapterClass="Finisar.SQLite.SQLiteDataAdapter"
>   commandBuilderClass="Finisar.SQLite.SQLiteCommandBuilder"	
>   usePositionalParameters = "true"	
>   useParameterPrefixInSql = "false"
>   useParameterPrefixInParameter = "false"
>   parameterPrefix=""
>   setDbParameterPrecision="false"
>   setDbParameterScale="false"
>   setDbParameterSize="false"
> />

-- 
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