GNOME Bugzilla – Bug 599719
Compilation problem in Mono 2.6.1
Last modified: 2010-12-17 20:32:25 UTC
I need to call your attention to this. I'm not sure if this a bug on CJ or in Fedora's Mono suite or Mono upstream, so please review. This is the deps installing log (without apparent problem): http://koji.fedoraproject.org/koji/getfile?taskID=1770703&name=root.log And the compiling log with the error: http://koji.fedoraproject.org/koji/getfile?taskID=1770703&name=build.log ./../src/sqlite/country.cs(77,38): error CS1061: Type `Mono.Data.Sqlite.SqliteConnection' does not contain a definition for `LastInsertRowId' and no extension method `LastInsertRowId' of type `Mono.Data.Sqlite.SqliteConnection' could be found (are you missing a using directive or an assembly reference?) Compilation failed: 1 error(s), 3 warnings OTOH the building for F12 run smoothly: http://koji.fedoraproject.org/koji/buildinfo?buildID=138410 Any idea?
I think I've got a tip: F12 compiles with: DEBUG util.py:256: 0:mono-devel-2.4.2.3-2.fc12.i686 DEBUG util.py:256: 0:mono-data-sqlite-2.4.2.3-2.fc12.i686 and F13/devel/rawhide: DEBUG util.py:256: 0:mono-devel-2.6-1.fc13.i686 DEBUG util.py:256: 0:mono-data-sqlite-2.6-1.fc13.i686 Maybe we had the 2.6 support broken or maybe the API had changed :-m
More testing: cd /builddir/build/BUILD/chronojump-0.8.14/src make [...] ./sqlite/person.cs(78,38): error CS1061: Type `Mono.Data.Sqlite.SqliteConnection' does not contain a definition for `LastInsertRowId' and no extension method `LastInsertRowId' of type `Mono.Data.Sqlite.SqliteConnection' could be found (are you missing a using directive or an assembly reference?) Compilation failed: 1 error(s), 15 warnings make: *** [bin/Release/Chronojump.exe] Error 1 exactly the same error CS1061 and related to the same method...
Update: I've just modified the report title since I've confirmed it's not a Fedora problem. I've wandering how to determine it so finally I set up a vm running the Mono 2.6.1 Live ISO[1] [1] http://ftp.novell.com/pub/mono/appliance/2.6.1/Mono-2.6.1.iso These are the steps: 1.- set up a VM (under a KVM/QEMU infrastructre) and installed the live[1] system under a vm running machine 2.- installed the Fedora SRPM Chronojump[2] [2] http://ftp.cica.es/fedora/linux/updates/12/SRPMS/chronojump-0.8.14-1.fc12.src.rpm 3.- building: rpmbuild --nodeps -ba chronojump.spec (take note all build dependencies are installed but with some SuSE names differs): ./../src/sqlite/country.cs(77,38): error CS1061: Type `Mono.Data.Sqlite.SqliteConnection' does not contain a definition for `LastInsertRowId' and no extension method `LastInsertRowId' of type `Mono.Data.Sqlite.SqliteConnection' could be found (are you missing a using directive or an assembly reference?) which is exactly the error got on Fedora 13. So, again, now I'm sure this is not a Fedora problem (which still has a very unsatisfactory mono 2.6 support). I'll report it to Mono upstream
The mistery had been explained at https://bugzilla.novell.com/show_bug.cgi?id=567903#c2 SqliteConnection.LastInsertRowId is gone from 2.6+ version of Mono.Data.Sqlite. If you need it, link your application against Mono.Data.SqliteClient (but beware it is deprecated). Current Mono.Data.Sqlite version is a port of http://sqlite.phxsoftware.com/ with the minimum set of changes. Xavi, your turn.
Done: Changed this: int myLast = dbcon.LastInsertRowId; To: //http://stackoverflow.com/questions/4341178/getting-the-last-insert-id-with-sqlite-net-in-c string myString = @"select last_insert_rowid()"; dbcmd.CommandText = myString; int myLast = (int)dbcmd.ExecuteScalar(); // Need to type-cast since `ExecuteScalar` returns an object. It's a pity we need to perdorm a search now when before there's no need.