[Mono-bugs] [Bug 81899][Wis] New - Problem running sqlite code in Maemo(N780/N800) environment
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Tue Jun 19 03:50:44 EDT 2007
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by tquerci at gmail.com.
http://bugzilla.ximian.com/show_bug.cgi?id=81899
--- shadow/81899 2007-06-19 03:50:44.000000000 -0400
+++ shadow/81899.tmp.20632 2007-06-19 03:50:44.000000000 -0400
@@ -0,0 +1,183 @@
+Bug#: 81899
+Product: Mono: Runtime
+Version: unspecified
+OS:
+OS Details: Maemo
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: packaging
+AssignedTo: wberrier at novell.com
+ReportedBy: tquerci at gmail.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Problem running sqlite code in Maemo(N780/N800) environment
+
+Hi,
+I have found some problem running application that use sqlite database on
+Nokia Maemo Environment.
+
+If I compile a mono program for 1.0 runtime on a system host I have no
+problem, but if I use 2.0 environment this program is not executable 'cause
+an assembly is missing (System.Transactions, Version=2.0.0.0,
+Culture=neutral, PublicKeyToken=b77a5c561934e089).
+I have a workaround, you can copy the assembly in the same place of your
+application and the program is able to run.
+
+So I try to write an application that load the assembly that use sqlite
+database on runtime, so I compile the mail program using 2.0 environment
+while the library use 1.0 environment.
+I run the program on my host and work fine but is loaded the 2.0 client
+library, nor the 1.0 (I suppose that must exist a system to load an
+explicit version of the library).
+
+I try to run on maemo environment and don't work.
+This is the error that I have:
+---------------------------------------------------
+mono[1182]: GLIB WARNING ** default - Missing method
+Mono.Data.SqliteClient.SqliteConnection::CreateCommand() in assembly
+/usr/lib/mono/gac/Mono.Data.SqliteClient/2.0.0.0__0738eb9f132ed756/Mono.Data.SqliteClient.dll,
+referenced in assembly /media/mmc1/test/dataLoader.dll
+.........
+-----------------------------------------------------
+
+This compiling instruction that I use
+P.S. If I use mcs to compile all, the program work.
+P.S.2 I not able to compile this program in maemo scratchbox 'cause I
+obtain several error in class hierarchy in both 1.0 and 2.0 environment.
+
+-------------- compile.sh ------------------
+mcs -target:library -out:interface.dll IDataLoader.cs
+
+mcs -target:library -r:interface.dll -r:Mono.Data.SqliteClient
+-r:System.Data -out:dataLoader.dll DataLoaderSqlite.cs
+
+gmcs -target:exe -r:interface.dll -out:testDynamicLoader.exe Main.cs
+
+----------------------------------------------
+
+Here there is my testing code ...
+
+---------------- Main.cs ---------------------
+using System;
+
+namespace test_dynamic_loading
+{
+ class MainClass
+ {
+ public static void Main(string[] args)
+ {
+ IDataLoader dl;
+
+ Console.WriteLine("Hello World!");
+ System.Reflection.Assembly asm =
+System.Reflection.Assembly.LoadFrom("dataLoader.dll");
+ Type[] types = asm.GetTypes();
+
+ foreach (Type ty in types){
+ Console .WriteLine("Create instance of "+ty.Name);
+
+ object o = Activator.CreateInstance(ty);
+ dl=(IDataLoader)o;
+ dl.getListTitle();
+ }
+ }
+ }
+}
+---------------- IDataLoader.cs -------------------
+using System;
+using System.Collections;
+
+namespace test_dynamic_loading
+{
+
+ public interface IDataLoader
+ {
+ ArrayList getListTitle();
+ }
+}
+--------------- DataLoaderSqlite.cs---------------
+using System;
+using Mono.Data.SqliteClient;
+using System.Data;
+using System.Collections;
+
+namespace test_dynamic_loading
+{
+
+
+ public class DataLoaderSqlite : IDataLoader
+ {
+ private SqliteConnection cnn=null;
+
+ public DataLoaderSqlite()
+ {
+ SqliteCommand dbcmd;
+// System.Data.Common.DbCommand dbcmd;
+ string sql;
+
+ // Create the DB Connection
+ cnn=new SqliteConnection("URI=file:SqliteTest.db");
+ cnn.Open();
+
+ // Try to create DB new Table
+ try {
+
+ sql="CREATE TABLE test_table (title TEXT )";
+ dbcmd = cnn.CreateCommand();
+
+ System.Console.WriteLine("Command class:
+"+dbcmd.GetType().Assembly.FullName);
+
+ dbcmd.CommandText = sql;
+ dbcmd.ExecuteNonQuery();
+ dbcmd.Dispose();
+ } catch {}
+ }
+
+ public ArrayList getListTitle() {
+ IDbCommand dbcmd;
+ string sql;
+ int ncolumn;
+ string[] values;
+ ArrayList dataTable=new ArrayList();
+ int i;
+
+ // Try to create insert data into the Table
+ try {
+ sql="SELECT * FROM test_table";
+ dbcmd = cnn.CreateCommand();
+ dbcmd.CommandText = sql;
+ IDataReader dr=dbcmd.ExecuteReader();
+
+ // Read the number of column
+ DataTable dt=dr.GetSchemaTable();
+ DataColumnCollection dcc=dt.Columns;
+ ncolumn=dcc.Count;
+ ncolumn=dt.Rows.Count;
+
+ // Read all the data
+ while (dr.Read()) {
+
+ values=new String[ncolumn];
+ for (i=0; i<ncolumn; i++) {
+ values[i]=dr.GetValue(i).ToString();
+ }
+ dataTable.Add(values);
+ }
+
+ dr.Close();
+ dbcmd.Dispose();
+ } catch (Exception ex) {
+ Console.WriteLine("Unable to get data from table test_table. " +
+ex.Message);
+ Console.WriteLine(ex.StackTrace);
+ }
+
+ return dataTable;
+ }
+ }
+}
More information about the mono-bugs
mailing list