downpouring / csharp-sqlite

Automatically exported from code.google.com/p/csharp-sqlite
Other
0 stars 0 forks source link

[PATCH] compilation failure in NET_2_0 mode #103

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
If you define NET_2_0 and the compilation fails in the test driver (in the 
latest tip version).

The attached patch fixes the issue.

Original issue reported on code.google.com by contact....@gmail.com on 21 Mar 2011 at 12:31

Attachments:

GoogleCodeExporter commented 9 years ago
There's also a small bug in SqlConnection.cs: the token is converted to lower 
case, but the value used for comparison is mixed case (hence it always fails).

Original comment by contact....@gmail.com on 21 Mar 2011 at 12:44

Attachments:

GoogleCodeExporter commented 9 years ago
re: NET_2_0.patch

I'm confused, I've looked at the NET_2_0 patch, and all it does is change the 
type of the variable.  I've defined NET_2_0  in the conditional compilation 
symbols, changed the and it still works without this patch.  There must be 
something else going on. 

What specific error did you get without this patch?

-      SqliteCommand cmd = con.CreateCommand();
+      IDbCommand cmd = con.CreateCommand();

Original comment by noah.hart@gmail.com on 21 Mar 2011 at 1:57

GoogleCodeExporter commented 9 years ago
re: fix-datasource.patch  

Accepted

Original comment by noah.hart@gmail.com on 21 Mar 2011 at 2:02

GoogleCodeExporter commented 9 years ago
for the NET_2_0 patch:

if you don't define NET_2_0 in the Community.CsharpSqlite.SQLiteClient project, 
then two methods are present called CreateCommand(): the implementation for 
IDbConnection.CreateCommand which returns IDbCommand and CreateCommand which 
returns a SqliteCommand. However, if you define it then only one method is 
overriden: CreateDbCommand which returns a DbCommand (CreateCommand() from 
DbConnection is used then).

Hence, to make the code work in both modes -- it is best to use the common 
interface IDbCommand and IDataReader (otherwise a cast is required).

Original comment by contact....@gmail.com on 22 Mar 2011 at 3:34

GoogleCodeExporter commented 9 years ago
btw, is there a reason why the conditional NET_2_0 is present? Because the code 
uses partial classes heavily, and those are only present in .NET 2 and up. if 
you want, I can contribute a patch which removes this.

Original comment by contact....@gmail.com on 22 Mar 2011 at 3:38

GoogleCodeExporter commented 9 years ago
OK, that makes sense.  Yes a patch would help.

I didn't write the client and I think that the conditional means that only NET 
2 is available, and not NET 3

Let me ask the Mono teams

Noah

Original comment by noah.hart@gmail.com on 22 Mar 2011 at 3:05

GoogleCodeExporter commented 9 years ago
Ah, if it was derived from Mono then I'm sure it is for supporting .NET 1.1 -- 
DbCommand was introduced in .NET 2.0 and Mono supported both.

I'll post a patch which removes the conditional NET_2_0 soon, at least for this 
use case.

Original comment by contact....@gmail.com on 23 Mar 2011 at 3:50

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
added a bundle which includes these changes (apply using hg unbundle):

38083affba0e reformat Community.CsharpSqlite.SQLiteClient to use tabs
d8bc18f2b226 issue 103: remove support for .NET 1.1 (via the NET_2_0 
conditional)
243fce1a3284 issue 104: remove conflicting class
3d8072be4d60 issue 103: fix warnings in SqlClient and compilation errors in 
TestDriver

I have not changed the usage of NET_2_0 in Community.CsharpSqlite (which 
apparently is used to select a different crypto provider).

Original comment by contact....@gmail.com on 23 Mar 2011 at 5:29

Attachments:

GoogleCodeExporter commented 9 years ago
Patches accepted and applied

Original comment by noah.hart@gmail.com on 23 Mar 2011 at 9:11