tm929 / dapper-dot-net

Automatically exported from code.google.com/p/dapper-dot-net
Other
0 stars 0 forks source link

Oracle ODP.NET connection causes unit tests to fail #38

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. download dapper from nuget or by hand
2. open a connection to an Oracle 10 or 11 db
3. run the sample test code
4. exception 

What is the expected output? What do you see instead?

System.ArgumentException was caught
  Message=Value does not fall within the expected range.
  Source=Oracle.DataAccess
  StackTrace:
       at Oracle.DataAccess.Client.OracleParameter.set_DbType(DbType value)
       at ParamInfo6757459b-c923-49af-aba7-97aefc1b85fe(IDbCommand , Object )
       at Dapper.SqlMapper.SetupCommand(IDbConnection cnn, IDbTransaction transaction, String sql, Action`2 paramReader, Object obj, Nullable`1 commandTimeout, Nullable`1 commandType) in C:\code\VisionCore\BE\PPCOM\CoreLogic\Com.BE.BizLib\Com.BuyEfficient.Entity\Dapper\SqlMapper.cs:line 1036
       at Dapper.SqlMapper.<QueryInternal>d__4`1.MoveNext() in C:\code\VisionCore\BE\PPCOM\CoreLogic\Com.BE.BizLib\Com.BuyEfficient.Entity\Dapper\SqlMapper.cs:line 395
       at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
       at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
       at Dapper.SqlMapper.Query[T](IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Boolean buffered, Nullable`1 commandTimeout, Nullable`1 commandType) in C:\code\VisionCore\BE\PPCOM\CoreLogic\Com.BE.BizLib\Com.BuyEfficient.Entity\Dapper\SqlMapper.cs:line 351
       at TestProject.UnitTest1.TestDapper() in C:\code\VisionCore\BE\PPCOM\CoreLogic\Com.BE.BizLib\TestProject\UnitTest1.cs:line 41
  InnerException: 

What version of the product are you using? On what operating system?
1.4
Windows 7 64bit Enterprise

Please provide any additional information below.

Original issue reported on code.google.com by stephenp...@gmail.com on 17 Jun 2011 at 4:28

GoogleCodeExporter commented 8 years ago
Interesting, I am not sure there is an easy way to create a db independent test 
case family. stored procs, temp tables, information schema etc, all differ. 

I would however be happy to have a test suite for oracle if you feel like 
committing a patch to dapper.contrib. 

Original comment by sam.saff...@gmail.com on 20 Jun 2011 at 11:03

GoogleCodeExporter commented 8 years ago
Sam/Marc,

I'd be happy to, what is the process of committing a patch to contrib?

Stephen

Original comment by stephenp...@gmail.com on 20 Jun 2011 at 9:43

GoogleCodeExporter commented 8 years ago
simplest would be to clone the repo on google code, port the test file and add 
it to the Dapper.Test project actually ... maybe create TestOracle.cs ... then 
we can add a compile flag for oracle

Original comment by sam.saff...@gmail.com on 21 Jun 2011 at 2:10

GoogleCodeExporter commented 8 years ago
There are 4 projects

Dapper
DapperNET35
Dapper.Contrib
Dapper.Contrib.Tests
DapperTest

I don't see a project Dapper.Test with the dot between them so assume you
mean DapperTest and add a file (OracleTests.cs) that is
the functional equivalent as Tests.cs but for Oracle.

Original comment by stephenp...@gmail.com on 21 Jun 2011 at 3:38

GoogleCodeExporter commented 8 years ago
Stephan 

yerp I meant DapperTest 

awesome 

Original comment by sam.saff...@gmail.com on 24 Jun 2011 at 2:07

GoogleCodeExporter commented 8 years ago
Sam,

Just now getting around to this..sorry.

Anyways it seems that the Oracle .NET provider tries to validate every
statement in the command object and will not let you construct a malformed
query, at least one without a 'From' clause. Guess the simple examples have
to be commented out for right now,or I can did in and see if there may be a
way to turn off validation on the command object.

Stephen

Original comment by stephenp...@gmail.com on 30 Jun 2011 at 4:11