Monday, 15 April 2013

iOS SQLite equivalences with Android SQLite -



iOS SQLite equivalences with Android SQLite -

i new programmer in objective-c. have created android app , i've integrated sqlite. want build same app in ios. in android sqlite manipulation i've created class extends content provider:

public class mycprovider extends contentprovider { ... ... }

i've overrided methods: boolean oncreate() method:

@override public boolean oncreate() { dbhelper = new mysqliteopenhelper(getcontext(), mysqliteopenhelper.database_name, null, mysqliteopenhelper.database_version); homecoming dbhelper != null; } @override public cursor query(uri uri, string[] projection, string selection, string[] selectionargs, string sortorder) { ... } @override public string gettype(uri uri) { ... } @override public uri insert(uri uri, contentvalues values) { sqlitedatabase db = dbhelper.getwritabledatabase(); string nullcolumnhack = null; long id = -1; uri contenturi = null; switch (urimatcher.match(uri)) { case group_all_rows: contenturi = group_content_uri; id = db.insert(useful_number_group_table_name, nullcolumnhack, values); break; ... ... }

i wanted know methods equivalences in objective- c. thought this?

sqlite provided straight ios , you'd utilize native c api. apple doesn't provide sort of wrapping.

the mental attitude seems can utilize sqlite straight or can utilize core data, quite different thing — it's queriable object graph implicitly relies on opaque storage method can sqlite-based relational database if core info explicitly not relational database. can , should optimise sql store underneath if that's storage pick database has private schema , not queried directly.

as such there's no equivalent sqliteopenhelper. if want utilize sqlite need work of opening, creating, migrating, etc yourself.

ios doesn't have equivalent contentprovider because that's formalised model construction allow sharing of info between applications ios doesn't sharing of info between applications in sense. applications same developer can share disk storage, applications can open each other url schema, etc, can't write code different applications can interact with. you'd build whatever sort of model object think appropriate , lifetime , interface whatever explicitly decide.

android ios sqlite

No comments:

Post a Comment