Giorgi / EntityFramework.Exceptions

Strongly typed exceptions for Entity Framework Core. Supports SQLServer, PostgreSQL, SQLite, Oracle and MySql.
https://giorgi.dev/entity-framework/introducing-entityframework-exceptions/
Other
1.44k stars 68 forks source link

Added Oracle implementation #27

Closed anoordover closed 3 years ago

Giorgi commented 3 years ago

Did you test it on a real Oracle database?

anoordover commented 3 years ago

Yes, I did on my own environment. The constants I use are part of the so called ORA messages e.g. ORA-02291. The others are:

Giorgi commented 3 years ago

Yes, I'm aware of Ora errors. The reason I'm asking is that from my experience in some cases the library throws OracleTruncateException when there is numeric overflow.

anoordover commented 3 years ago

I think this Exception is only thrown by the non-core Oracle.ManagedDataAccess en the Oracle.DataAccess libraries This isn't correct. Reading internet says that this isn't a database problem but a problem in de ODP classes where truncation occurs. See https://docs.oracle.com/cd/B28359_01/win.111/b28375/OracleTruncateExceptionClass.htm and https://stackoverflow.com/questions/6606076/oracletruncateexception

anoordover commented 3 years ago

I did an additional test using a decimal and I don't get this error. Is still get the ORA-01438 error (putting 10.001m in a number(5,4) column)

anoordover commented 3 years ago

I tried another integrationtest but I stil didn't get this exception. I don't know how to get this type of exception... Passing a value too large for a long in a long when executing a select-query.

Giorgi commented 3 years ago

Can you add those tests to the tests project so that I can run them locally? Preferably following the same structure and covering all cases as the current tests do.

anoordover commented 3 years ago

Can you add those tests to the tests project so that I can run them locally? Preferably following the same structure and covering all cases as the current tests do.

I added unittests for the Oracle implementation.

Giorgi commented 3 years ago

I'll check it in a couple of days.

Giorgi commented 3 years ago

I ran the tests and it worked fine. Can you make the changes according to the comments that I left? Also, add the attribute to the Oracle tests so they get skipped because AppVeyor doesn't support oracle 😞

anoordover commented 3 years ago

I can't find how to skip all the test in a class in XUnit except by making the test-class non-public. Do you know another way to skip all the tests of a whole class?

Giorgi commented 3 years ago

There is no such way in xUnit. The only way is to override every test method and mark it as skipped.

Making the class private will remove those test from skipped section in unit tests results.

Giorgi commented 3 years ago

@anoordover Do you think that it should handle Ora-02292 too?

anoordover commented 3 years ago

To be honest, I think you are right to say that we should support ORA-02292 as well.