libmx3 / mx3

a sample project showcasing/collecting cross platform techniques on mobile
MIT License
1.17k stars 145 forks source link

Orm? #43

Open daviswalker opened 9 years ago

daviswalker commented 9 years ago

Has anyone experimented with different options for an ORM to sit on top of SQLite?

hamedmohammadi commented 9 years ago

this is far from what you are looking for dude.this repo is created for a practical cross platform solutions that facilitate to create high level library just once for all platforms and reuse code . so you can use and develop what you want int this environment or look for it some other place . :) hope my answer help

skabbes commented 9 years ago

Hey @hamedmohammadi I'm not sure that comment is very helpful, this is a place for people to help each other and experiment and discuss. So, I think actually this is a good place for practical discussions like this.

As far as ORM's go - I don't have any good answers unfortunately. I have a few ideas of my own on architecture for data modeling, but not ORMs. I'd love to hear other opinions on this.

@daviswalker please keep me up to date on anything you find - I'd be curious to hear.

daviswalker commented 9 years ago

Let me know if there's a better place for this kind of "discussion board" topic than the issues list.

After some searching and experimentation we've started thinking more about a view model interface, in particular a way to deliver update notifications to the right UI at the right time. You've got a simple example here in your user interface example, but when the app gets complicated I imagine there's a need for some real smarts that detects changes to the database, updates the corresponding view models, and delivers those notifications upwards. Is there anything in existence to help with this, I wonder?

In iOS this could be done as a fetched results controller, which you initialize with a query and every time the output of the query changes you get called. For example.

skabbes commented 9 years ago

Ya, I'm a big fan of the view model way of doing things as well. I've been brainstorming some ideas for observing changes to the database as you suggest. I had some local experimentations that I pushed up here: https://github.com/libmx3/mx3/tree/wip/observe_sqlite

The idea is to have to 2 sqlite connections (but one database) in WAL mode on the same database. Then, by starting a read transaction on one connection, you can fetch the old and new versions, and build a changeset of that transaction, modeled here.

Hopefully this isn't reinventing the wheel, but either way it is a fun little project.

hamedmohammadi commented 9 years ago

ok @skabbes i intent to help may be it was not the right way . sry :+1:

skabbes commented 9 years ago

@hamedmohammadi No problem, I just think this project is probably even more useful as a discussion forum as it is just raw code.

tslater commented 9 years ago

Seems to me like a c++ ORM makes the most sense so you can share as much of your code as possible. So far hilberlite seems to be the best i've seen...

https://github.com/paulftw/hiberlite

On Sat, Jan 24, 2015 at 11:08 AM, Steven Kabbes notifications@github.com wrote:

@hamedmohammadi https://github.com/hamedmohammadi No problem, I just think this project is probably even more useful as a discussion forum as it is just raw code.

— Reply to this email directly or view it on GitHub https://github.com/libmx3/mx3/issues/43#issuecomment-71330026.

skabbes commented 9 years ago

Hiberlite doesn't seem to be very mature, not very well maintained, not exception safe etc. I dug up a few others, POCO::Data, QxORM, and not an ORM but sqlpp11 but haven't vetted them yet.

However, I am not a huge fan or ORM style db abstractions. Everything that I've worked on more advanced than toy apps are hindered by them, not helped. Does anyone else echo that sentiment?

ghost commented 8 years ago

Hi @daviswalker , I would recommend SqliteCpp if you still need it. It is not an ORM, but from my experience it is suitable to put it on the top of SQLite.

etchbee commented 7 years ago

@skabbes For ORM kind of interface, take a look at ODB, which is based on sqlite. I have personally used it in my pet project along with djinni and it works well both on iOS as well as android.