Using SQLite with Rubymotion - sqlite

I want to use the C-level SQLite API with Rubymotion, but I'm not sure how to include the SQLite dylib & header files, if it is possible at all.
As I understand the dylib should be included in the following way:
app.libs += ['/usr/lib/libsqlite3.dylib']
But that's not enough, the sqlite3_open function is still not found. I guess the header file should be specified somehow.
P.S. I know that I can use FMDB to get the same functionality, but I'm wondering about using the C library directly.

I'm not having any issues with mine. Here's my lib entry:
app.libs += ['/usr/lib/libz.dylib', '/usr/lib/libsqlite3.dylib']
Maybe you need the libz.dylib part.

You might check out https://github.com/sxross/MotionModel/tree/sql. I've built an ActiveRecord-like adapter for SQLite using FMDB. The sample app might be a good reference for you.

The fmdb cocoapod github repository currently (as of Feb 26 2014) has 3970 favorites on github, 918 forks, and 336 watchers.
I think this is what you are looking for. fmdb is an Objective C wrapper on top of sqlite.
To get started with cocoapods, run:
gem install cocoapods
the ruby motion gem for handling cocoapods is motion-cocoapods
I'm still looking for an activerecord-like ORM though. there's the motion-sqlite3 gem but so far I haven't been able to get it to work. (5 minutes later) though the motion-model gem is looking promising...& heavily documented

By the way, it's 2020 now and you can easily work with SQLite in a RubyMotion iOS app by using the motion-sqlite3 gem. It hasn't been updated in a while, but that's because it just works.

Related

Unable to use SQLite in VS2017 universal windows platform project

I try to use the SQLite in the VS2017 in a universal windows platform project. I follow the guidance to download the SQLite extension for VS2015 although my local machine environment is VS2017, maybe this is the root cause? Then I add the reference with SQLIte. After that I installed the SQLitePCL with nuget.
After the SQLite installed, I wanted to try to run a demo to see if it can work right. But I found I can't using the namespace (using SQLite.Net.Attributes;) which it necessary for my demo.
I did some search about the SQLite and VS2017, But didn't found too much about such circumstances. So I want to know if anyone ever met such problem and How can your fix that?
Or it just unavailable to using SQLite in VS2017? If yes, can I complier a newest version about this?
Thanks everyone who can give me some reply or suggestion about this issue.
But I found I can't using the namespace (using SQLite.Net.Attributes;)
It seems like SQLite.Net.Attributes is belong to the Nuget package SQLite.Net-PCL, not SQLitePCL, the one you are using. SQLitePCL does't contain SQLite.Net.Attributes. You may obtain the package that is not you attempt to use.
There're many Nuget packages for SQLite, some of them are older with long time no updating. For UWP app, I'd recommend you to follow this tutorial to use a SQLite database in a UWP app.

PhoneGap Build pre-populated SQLite DB

I've successfully used PhoneGap Build with pre-populated SQLite DBs in the past via the https://build.phonegap.com/plugins/2368 plugin. However, Adobe deprecated the use of all plugins from the PG Build repository. Thus, I've been forced to use the npm alternatives.
https://www.npmjs.com/package/cordova-sqlite-storage is the recommended alternative to brodybits' original plugin. However, it's not compatible with PG Build due to them not honoring before_plugin_install hook.
https://github.com/litehelpers/Cordova-sqlite-evcore-extbuild-free and https://github.com/litehelpers/Cordova-sqlite-legacy-build-support are the recommended PG Build solutions. These work successfully to create and save/load to a new SQLite DB. However, they do not inherently support pre-populated DBs. It seems the solution to this was to copy the directory from the www/ directory to the app's DB dir before opening the DB. This is made possible by using https://github.com/an-rahulpandey/cordova-plugin-dbcopy. I've had success using this plugin, but have also experience the app initially crashing (likely due to some case where the DB was trying to be opened before it was copied..?).
It's frustrating to now have to use two plugins to do what one accomplished simply because Adobe deprecated use of its repository. Furthermore, I find it strange that the newer versions of Cordova-sqlite-storage don't support pre-populated DBs anymore when version 1.0.6 did.
I tried adding https://github.com/litehelpers/Cordova-sqlite-storage/tree/a97198d as the plugin source in my config.xml file. However, I can't seem to be able to specify a tag for the git repo (it only seems to pull the master version). Also, I tried adding https://github.com/litehelpers/Cordova-sqlite-storage/tree/a97198d as a custom plugin for PG Build and got an error for invalid url.
Does anyone know a possible solution to this? I'd really just like to be able to use the same plugin I've used for almost two years. Thanks!
was the right way to add the plugin to my config.xml file

How can I upgrade my Realm Swift version from 0.96 to 0.97?

Can I just replace the two old version realm frameworks to the new version ones? Or what should I do?
Yep! If you're not using a dependency manager like CocoaPods or Carthage, you just need to delete the old framework folders and copy the new ones into the same place. Xcode should be fine handling that the next time you attempt to build your project.
If you are using a dependency manager, then you just need to hit the update command in their command line tools, and it'll be taken care of automatically.
Please keep in mind that Realm 0.97 has completely removed all of its previously deprecated APIs, so if you were using any of those, you will get build errors, but they'll be very easy to fix.
I cam up with the same question and while looking around came up with a good solution. This is in addition to what TiM has pointed out. Also, a few things to keep in mind:
I upgraded from version 1.0 to 1.0.1: so there weren't many changes to the framework and commands I used in my app.
I didn't use any special or very specific commands. Mainly the queries and writes/updates of objects. Nothing very fancy. If you have very specific requirements of Realm than I suggest look into those and see if there are any special changes to how they are managed.
Now to the steps:
Remove the frameworks from the "Embedded Binaries" section by clicking the "-":
General Tab - Embedded Binaries
Remove the frameworks from the project itself by right-clicking on them and select "Delete"
Navigator - Framework Files
Now just go and do the steps for installing the frameworks as found in the documentation "realm.io/docs/swift/latest/#installation-swift-22".
I understand this question is rather old, but looking through the SO I dint find a definite answer to this.
Hope this helped!

How to integrate Sqlite to Visual Studio?

I'm planning to use Sqlite but I don't know how to integrate it to visual studio or use it. Any help please... thanks.
I really recommend using System.Data.Sqlite ( http://sqlite.phxsoftware.com).
Have been using it for quite some time and it works great every time! You can create tables using the designer, similar to for MSSQL etc. Recommended++
Depends on how you want to use it. The easiest is to get the amalgamation version - this version "contains all preprocessed C code combined into a single source file", meaning you have a single .h and .c file to add to your project. This is the officially recommended practice.
If you want to build a "proper" library or link against SQLite dynamically, you have a bit more work ahead, since there's no VS project/solution files included with SQLite. You'll have to set up your own library project, add the correct files from the sqlite-source-x.y.z.zip file, and set this project as a dependency on your main project. Doing this is actually officially discouraged.
EDIT:
Forgot to mention that the above solution is assuming C/C++, as OP didn't specify language.
use System.Data.Sqlite
System.Data.SQLite is an ADO.NET provider for SQLite.

SQLite android NDK

I'm trying to use a custom function in sqlite3.
I found no way in Java to do that so I moved on android-ndk, but now
I'm having troubles integrating sqlite3 sources in my project.
Compiler give me an error 'sqlite3_api' was note declared in this
scope.
In my source "sqlite3ext.h" is included (sqlite3 amalgamation is also included in project).
Any suggestion is welcome!
I had similar problems trying to get SQLite with SEE (SQLite Encryption Extensions) to compile and work. In the end I found http://code.google.com/p/sqlite3-android/ (the 2 downloads dated 17th February, the march downloads added some extra complications that didn't do what I wanted)
Once I had that working I included in the see.c with sqlite3.c and soon got it all working.

Resources