ericsink / SQLitePCL.raw

A Portable Class Library (PCL) for low-level (raw) access to SQLite
Apache License 2.0
522 stars 109 forks source link

Method not found: string SQLitePCL.raw.sqlite3_column_name(SQLitePCL.sqlite3_stmt,int) #338

Closed randomroxks closed 2 years ago

randomroxks commented 4 years ago

I am on Android only project.. the missing method issue was not seen when my target framework was monodroidv81. As soon as I updated it to v90, I started seeing this issue. In my BaseActivity: I have the following code: SQLitePCL.Batteries_V2.Init(); SQLitePCL.raw.SetProvider(new SQLitePCL.SQLite3Provider_e_sqlite3());

The code that invokes SqlLite CreateTableAsync() is quite simple: ` public LocalDataStore() { DBPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), PackageInfoHelper.PackageName + ".db3"); _localDb = new LocalDatabase(DBPath); CreateTables(); }

    private void CreateTables()
    {
        _localDb.CreateTableAsync<Item>().Wait();
    } `

and LocalDatabase is this: public class LocalDatabase : SQLiteAsyncConnection { public LocalDatabase(string path) : base(path) { } }

ericsink commented 4 years ago

Hmmm.

I need to investigate the Android-specific issue here.

It looks like I am building with MonoAndroid80 as my TFM. I don't remember exactly how that works, but I would expect this to be a minimum, so it should work with MonoAndroid90 as well. But perhaps it does not.

Even though you didn't say so, you are apparently using sqlite-net as well?

randomroxks commented 4 years ago

Here is the screenshot. I rolled back to Monodroid81. Is that the right version of sqlite-net? Screen Shot 2020-03-09 at 2 21 18 PM

ericsink commented 4 years ago

Oh, wait, I see you are still using SQLitePCLRaw 1.x.

Your original comment (over in #317) was on an issue specific to SQLitePCLRaw 2.0.

I suggest you consider updating. But there are certain complications to consider.

SQLitePCLRaw 2.x has breaking changes from 1.x. See the release notes:

https://github.com/ericsink/SQLitePCL.raw/blob/master/v2.md

You can't mix 1.x and 2.x. If you have other packages that use SQLitePCLRaw, they all need to be updated at the same time. Examples include Akavache, App Center, Entity Framework, etc.

You'll need the beta version of sqlite-net-pcl.

randomroxks commented 4 years ago

Wait. So I'm not intentionally using 1x. I added sqlite-net and it brought it with it. The screenshot I sent you is the one that works. What does not work is this one:

Screen Shot 2020-03-09 at 2 30 08 PM

are you referring to this bullet point? sqlite-net is (probably) not yet compatible with v2

ericsink commented 4 years ago

Change sqlite-net-pcl to 1.7.302-beta

Remove all SQLitePCLRaw packages with a 1.x version number.

It looks like you're also still using packages.config. Life is much better if you switch to PackageReference instead. :-)

randomroxks commented 4 years ago

It looks like you're also still using packages.config. Life is much better if you switch to PackageReference instead. :-) Havent gotten around to changing to reference. May be the Project template on VS for mac needs to be updated.

So did first and the second step. Now compile errors: Screen Shot 2020-03-09 at 2 50 55 PM

randomroxks commented 4 years ago

Any updates? I don't think changing to Beta version works

ericsink commented 4 years ago

(I hadn't seen your latest because it was an Edit.)

Yeah, it looks like something is wrong the reference to the sqlite-net package. Did an error happen during package restore?

randomroxks commented 4 years ago

No errors during package restore .

On Tue, Mar 10, 2020 at 14:02 Eric Sink notifications@github.com wrote:

(I hadn't seen your latest because it was an Edit.)

Yeah, it looks like something is wrong the reference to the sqlite-net package. Did an error happen during package restore?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ericsink/SQLitePCL.raw/issues/338?email_source=notifications&email_token=AINVXSUGOUJ63KW3VIRWXBDRG2FFVA5CNFSM4LEPGWC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEOMXFOY#issuecomment-597258939, or unsubscribe https://github.com/notifications/unsubscribe-auth/AINVXSTFFOLRIQ34CHINHPLRG2FFVANCNFSM4LEPGWCQ .

-

ericsink commented 4 years ago

Can you post your packages.config file?

randomroxks commented 4 years ago

Here is the package file. `<?xml version="1.0" encoding="utf-8"?>

`
ericsink commented 4 years ago

Where?

randomroxks commented 4 years ago

https://github.com/ericsink/SQLitePCL.raw/issues/338#issuecomment-597270801

ericsink commented 4 years ago

You posted what looks like your original packages.config file. But I was wanting to see the packages.config file after these changes:

Change sqlite-net-pcl to 1.7.302-beta

Remove all SQLitePCLRaw packages with a 1.x version number.

to help figure out why SQLite-net wasn't getting found during build.

randomroxks commented 4 years ago

Here is the one with the beta and not 1x Sql packages. `<?xml version="1.0" encoding="utf-8"?>

`
ericsink commented 4 years ago

I don't see anything obviously wrong with your packages.config, but there are many ways something could be wrong. PackageReference is so much better.

I do note that you are using AppCenter, which also uses SQLitePCLRaw. There have been problems caused by version conflicts. But the issue(s) you are seeing do not seem like that.

At this point I'm just not sure how to help you.

When you switch to sqlite-net-pcl 1.7 beta, you get a build error. The next step is to figure out why. Maybe try a clean rebuild.

randomroxks commented 4 years ago

Yep. What I am saying is that the build error is because it cannot find the package. All of the usual task to get the build going is not working.

ericsink commented 2 years ago

Closing old/stale issue.