All Projects → victorzhuk → orm-qt

victorzhuk / orm-qt

Licence: MIT License
Object Relation Mapping with Qt library

Programming Languages

C++
36643 projects - #6 most used programming language
QMake
1090 projects
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to orm-qt

nim-gatabase
Connection-Pooling Compile-Time ORM for Nim
Stars: ✭ 103 (+221.88%)
Mutual labels:  databases, orm-framework
psimedia
Audio/video RTP abstraction library
Stars: ✭ 19 (-40.62%)
Mutual labels:  qt
CodexMicroORM
An alternative to ORM's such as Entity Framework, offers light-weight database mapping to your existing CLR objects. Visit "Design Goals" on GitHub to see more rationale and guidance.
Stars: ✭ 32 (+0%)
Mutual labels:  orm-framework
DataViewExtenders
Extenders for WinForms controls, such as DataGridView, DataGridViewColumn, FlowLayoutPanel, TableLayoutPanel, etc
Stars: ✭ 22 (-31.25%)
Mutual labels:  databases
pydbantic
A single model for shaping, creating, accessing, storing data within a Database
Stars: ✭ 137 (+328.13%)
Mutual labels:  databases
radb
RA (radb): A relational algebra interpreter over relational databases
Stars: ✭ 48 (+50%)
Mutual labels:  databases
sqlalchemy-enum34
SQLAlchemy type to store standard enum.Enum values
Stars: ✭ 47 (+46.88%)
Mutual labels:  databases
SER-datasets
A collection of datasets for the purpose of emotion recognition/detection in speech.
Stars: ✭ 74 (+131.25%)
Mutual labels:  databases
octoxbps
A Qt-based XBPS front end
Stars: ✭ 45 (+40.63%)
Mutual labels:  qt
nakal
A MySQL backup tool for Google Sheets, written in Node.js.
Stars: ✭ 14 (-56.25%)
Mutual labels:  databases
active-persistence
Active Persistence is a implementation of Active Record Query Interface for JPA that makes it easy and fun.
Stars: ✭ 14 (-56.25%)
Mutual labels:  orm-framework
devops-notes
My technical documentation in the SRE / DevOps paradigm.
Stars: ✭ 19 (-40.62%)
Mutual labels:  databases
Paging-3-Sample
This app is created as a sample app which loads movies from Tmdb api and uses Paging 3 library to show it in a Recycler view.
Stars: ✭ 96 (+200%)
Mutual labels:  databases
database-all
Eloquent ORM for Java 【database-spring-boot-starter】
Stars: ✭ 151 (+371.88%)
Mutual labels:  orm-framework
QUaServer
Qt C++ wrapper for open62541 server stack
Stars: ✭ 78 (+143.75%)
Mutual labels:  qt
tmeta
Minimalistic Idiomatic Database "ORM" functionality for Go
Stars: ✭ 46 (+43.75%)
Mutual labels:  databases
GoGonicEcommerceApi
Ecommerce Rest API application built in Go with Gin Gonic + Gorm
Stars: ✭ 81 (+153.13%)
Mutual labels:  orm-framework
jds
Jenesis Data Store: a dynamic, cross platform, high performance, ORM data-mapper. Designed to assist in rapid development and data mining
Stars: ✭ 17 (-46.87%)
Mutual labels:  orm-framework
meta-pelux
PELUX is an open source, GENIVI compliant development platform that supports the Qt Automotive Suite
Stars: ✭ 34 (+6.25%)
Mutual labels:  qt
qt cef poc
Proof of concept of simple browser w/ CEF and Qt
Stars: ✭ 26 (-18.75%)
Mutual labels:  qt

Missing Object Relation Mapping realization in Qt framework

This library presents you a simple way to work with database tables like some script languages do.

Features

  • easy use and integrate with your project
  • full CRUD support with ActiveRecord pattern
  • deep integration with Qt
  • easy SQL select/insert/update/delete manipulation

Installation

  1. Using qpm package manager: $ qpm install pro.zhukva.orm-qt

  2. Manually: add include(<path-to-lib>/include.pri) in your *.pro file

Example code

Let we have created a table foobar with fields foo and bar:

// ... other Qt includes
#include "activerecord.h"

// create empty record
orm::ActiveRecord ar_obj("foobar");

// set values
ar_obj.setValue("foo", "this is test string");
ar_obj.setValue("bar", 123);

// save this record
bool ok = ar_obj.save();

// get result primary key
QVariant pk = ar_obj.primaryKey().value();

// load second obj
orm::ActiveRecord ar2_obj("foobar");
ar2_obj.load(pk);

// get value
int val = ar2_obj.value("bar").toInt();

// remove object
ar2_obj.remove();

Notes

"Where are other features?" you can ask. As I noted before, this is light library, all your need exists in Qt already.

For example you need to select many records. Your example code:

QSqlQuery qr = orm::Query::select("foobar").where("id > ?", 100).make();
if (qr.exec()) {
        while (qr.next()) {
                orm::ActiveRecord ar_obj("foobar");
                ar_obj.setRecord(qr.record());
                ar_obj.setValue("foo", "new_foo_value");
                ar_obj.save();
        }
}

As you can see, any wrapper only complicate code. orm-qt aim to efficiently manipulate standard Qt classes and try not to reinvent the wheel. Another example, you need to create some model. Your example code:

// ...
QTableView *view = new QTableView;
QSqlQueryModel *model = new QSqlQueryModel;
// ...
QSqlQuery qr = orm::Query::select("foobar").where("id > ?", 100).make();
if (qr.exec()) {
        model->setQuery(qr);
        view->setModel(model);
}
// get ActiveRecord from 1st row
QSqlRecord rec = model.record(0);
if (!rec.isEmpty()) {
        orm::ActiveRecord ar_obj("foobar");
        ar_obj.setRecord(rec);
        // some actions...
}

If you work need any other functions or classes your can email me. Unfortunately this time documentation is empty. I fix it nearest time, you can see test folder for code examples.

License

This code under MIT license
Home: https://github.com/victorzhuk/orm-qt
Author: Victor Zhuk [email protected]

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].