Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
ActiveRecord in Qt
I wonder if someone has created a library that uses ActiveRecord's pattern in Qt.
goetz last edited by
We have created a similar approach in one of our projects. Instead of saving in a database directly, we use some hand-crafted XML to push the data to java based server application that does the actual db operations.
Unfortunately I cannot post source code, as this is a closed source project.
To be flexible, one might consider adding a wrapper level between the objects and the database or provide a kind of database driver for getting and submitting the data to a remote server.
goetz last edited by
For those who are not familiar with the concept: A short "descripton of ActiveRecord on wikipedia":http://en.wikipedia.org/wiki/Active_record_pattern.
Heard about couple of qt projects that provides orm functionality. I will find them and post back
Hey, thanks. That would really help me.
I was thinking in making an ActiveRecord library of my own, just to satisfy the needs of my project.
But I just thought that would be better to adapt an existing project, don't you think?
Anyway any help and examples would be appreciated.
I really like the "Ruby ActiveRecord's API":http://ar.rubyonrails.org/.
I have a concept mail to the qt mailinglist hanging around with thoughts about this issue. I really think something like this is needed, but it needs to be Done Right (TM). ORM frameworks for Qt that I know of are QDjango, QsT SQL Tools, QxOrm and QtPersistence. None of these seem to fit my bill, but there are interesting ideas in some of them.
Yes, I've meant QDjango, QxOrm and QsT. As I know last one was made to avoid problems in other ORMs for Qt, so maybe it will become awesome tool someday.
blex last edited by
[quote author="Denis Kormalev" date="1291220985"]Heard about couple of qt projects that provides orm functionality. I will find them and post back[/quote]
But I do not know anything about it's quality.
blex, at the September QDjango had too little features. But all other ORMs are also not fully-featured. AFAIK QxOrm is the most featured library now.
blex last edited by
[quote author="Denis Kormalev" date="1291285604"]blex, at the September QDjango had too little features. But all other ORMs are also not fully-featured. AFAIK QxOrm is the most featured library now.[/quote]
Thank you for information.
But my opinion is that C++ is not a good choice for ORM. ORM lives better in Java and Net :)
[quote author="blex" date="1291285797"]
But my opinion is that C++ is not a good choice for ORM. ORM lives better in Java and Net :) [/quote]
IMHO, you don't choose a language just for building an ORM. You use an ORM as part of your application for which you have chosen a language. If you choose Qt, then you have already chosen C++ in most cases.
Back to the issue in question: an ORM for Qt.
Dennis: what specific issues was QsT SQL Tools designed to avoid?
Andre, I didn't use it, but I've read QsT maintaners article about it. He said that it was designed to make library users live easier. Also he said that it is not an ORM in common, it is something that is near to ORM. There are some problems witch caching, relations support (QxOrm will be the best in this case), full sql support.
I just downloaded it, and I immediately noticed one massive drawback for me. All documentation is in Russian. That makes it impossible for me to work with it, I fear. Pitty.
Andre, oops, didn't know it. If you want I can ask maintainer to write english docs.
[quote author="Andre" date="1291288904"]I just downloaded it, and I immediately noticed one massive drawback for me. All documentation is in Russian. That makes it impossible for me to work with it, I fear. Pitty. [/quote]
BUT, QDjango looks really good. At least for my needs right now.. I will check it out later. Thanks
[quote author="Denis Kormalev" date="1291291416"]Andre, oops, didn't know it. If you want I can ask maintainer to write english docs.[/quote]
Please do. In the meantime, I created a ticket for it on sourceforge with the same request as well. Even the in-code stuff is in Russian, though the method and class names are in English.
Andre, done. Will update you when he will answer me.
Andre, maintaner answered that he translation is in progress now. Full translation will be in approx 3 months (with 0.5 version of QsT).
@http://sourceforge.net/projects/qstsqltools/files/QST 0.5/doc_english_partial QST 0.5.6.zip/download@
you can download partial translation of docs.
Good day to all!
Andre, documentation of the QsT SQL Tools is fully translated to English. If you are still interested, you can get it "here":https://sourceforge.net/projects/qstsqltools/files/QST 0.5/QST 0.5.9.4 beta/ with the sources.
With best regards.
Great! Thank you for the follow-up. I am always interested in looking into interesting libraries like this.
And thank you too. I am always interested in people who interested in my library. :)
I am looking into QsT, but I find it hard to find a point to start in the documentation. Is there something like a basic tutorial outlining the most important features of QsT?
Unfortunately there are no tutorial as such. But there are some example projects, QTelecom (http://sourceforge.net/projects/qstsqltools/files/QST 0.5/QTelecom 0.1 Special example/), TradeDB (for QST 0.4, http://sourceforge.net/projects/qstsqltools/files/TradeDB 0.4 example/), the simplest DB application "SQLiteExample" in the package of the library. QTelecom is project where many of QST functions were realized, it may be useful. And now I will try to develop some tutorial for you.
Please don't develop a tutorial just for me. Develop one if you think that is useful, I'm sure I can figure it out based on the sample applications you link. Thanks!
As some help: main features are described in these classes:
- QstAbstractModelHandler (main class of the library)
And I will answer all your questions. :)