Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 9d05e414

Von Christian Ehringfeld vor mehr als 9 Jahren hinzugefügt

  • ID 9d05e41440ae9802bdd1d81c402209c3729f084c
  • Vorgänger 14f9beed
  • Nachfolger 7e233492

brainfuck

Unterschiede anzeigen:

.gitignore
*.pro.user
*build
build-*
build-Example-Desktop-Debug/Makefile
#############################################################################
# Makefile for building: EntityManager
# Generated by qmake (3.0) (Qt 5.4.1)
# Project: ../example/Example.pro
# Template: app
# Command: /usr/lib/qt/bin/qmake -spec linux-g++ CONFIG+=debug -o Makefile ../example/Example.pro
#############################################################################
MAKEFILE = Makefile
####### Compiler, tools and options
CC = gcc
CXX = g++
DEFINES = -DQT_SQL_LIB -DQT_CORE_LIB
CFLAGS = -pipe -g -Wall -W -D_REENTRANT -fPIE $(DEFINES)
CXXFLAGS = -pipe -g -Wall -W -D_REENTRANT -fPIE $(DEFINES)
INCPATH = -I../example -I. -isystem /usr/include/qt -isystem /usr/include/qt/QtSql -isystem /usr/include/qt/QtCore -I. -I/usr/lib/qt/mkspecs/linux-g++
QMAKE = /usr/lib/qt/bin/qmake
DEL_FILE = rm -f
CHK_DIR_EXISTS= test -d
MKDIR = mkdir -p
COPY = cp -f
COPY_FILE = cp -f
COPY_DIR = cp -f -R
INSTALL_FILE = install -m 644 -p
INSTALL_PROGRAM = install -m 755 -p
INSTALL_DIR = $(COPY_DIR)
DEL_FILE = rm -f
SYMLINK = ln -f -s
DEL_DIR = rmdir
MOVE = mv -f
TAR = tar -cf
COMPRESS = gzip -9f
DISTNAME = EntityManager1.0.0
DISTDIR = /home/cehringfeld/gitrepos/entitymanager/example/.tmp/EntityManager1.0.0
LINK = g++
LFLAGS =
LIBS = $(SUBLIBS) -lQt5Sql -lQt5Core -lpthread
AR = ar cqs
RANLIB =
SED = sed
STRIP = strip
####### Output directory
OBJECTS_DIR = ./
####### Files
SOURCES = ../example/models/artikel.cpp
OBJECTS = artikel.o
DIST = /usr/lib/qt/mkspecs/features/spec_pre.prf \
/usr/lib/qt/mkspecs/common/shell-unix.conf \
/usr/lib/qt/mkspecs/common/unix.conf \
/usr/lib/qt/mkspecs/common/linux.conf \
/usr/lib/qt/mkspecs/common/gcc-base.conf \
/usr/lib/qt/mkspecs/common/gcc-base-unix.conf \
/usr/lib/qt/mkspecs/common/g++-base.conf \
/usr/lib/qt/mkspecs/common/g++-unix.conf \
/usr/lib/qt/mkspecs/qconfig.pri \
/usr/lib/qt/mkspecs/modules/qt_Attica.pri \
/usr/lib/qt/mkspecs/modules/qt_KActivities.pri \
/usr/lib/qt/mkspecs/modules/qt_KArchive.pri \
/usr/lib/qt/mkspecs/modules/qt_KAuth.pri \
/usr/lib/qt/mkspecs/modules/qt_KBookmarks.pri \
/usr/lib/qt/mkspecs/modules/qt_KCMUtils.pri \
/usr/lib/qt/mkspecs/modules/qt_KCodecs.pri \
/usr/lib/qt/mkspecs/modules/qt_KCompletion.pri \
/usr/lib/qt/mkspecs/modules/qt_KConfigCore.pri \
/usr/lib/qt/mkspecs/modules/qt_KConfigGui.pri \
/usr/lib/qt/mkspecs/modules/qt_KConfigWidgets.pri \
/usr/lib/qt/mkspecs/modules/qt_KCoreAddons.pri \
/usr/lib/qt/mkspecs/modules/qt_KCrash.pri \
/usr/lib/qt/mkspecs/modules/qt_KDBusAddons.pri \
/usr/lib/qt/mkspecs/modules/qt_KDeclarative.pri \
/usr/lib/qt/mkspecs/modules/qt_KDESu.pri \
/usr/lib/qt/mkspecs/modules/qt_KDEWebKit.pri \
/usr/lib/qt/mkspecs/modules/qt_KEmoticons.pri \
/usr/lib/qt/mkspecs/modules/qt_KGlobalAccel.pri \
/usr/lib/qt/mkspecs/modules/qt_KGuiAddons.pri \
/usr/lib/qt/mkspecs/modules/qt_KHtml.pri \
/usr/lib/qt/mkspecs/modules/qt_KI18n.pri \
/usr/lib/qt/mkspecs/modules/qt_KIconThemes.pri \
/usr/lib/qt/mkspecs/modules/qt_KIdleTime.pri \
/usr/lib/qt/mkspecs/modules/qt_KIOCore.pri \
/usr/lib/qt/mkspecs/modules/qt_KIOFileWidgets.pri \
/usr/lib/qt/mkspecs/modules/qt_KIOWidgets.pri \
/usr/lib/qt/mkspecs/modules/qt_KItemModels.pri \
/usr/lib/qt/mkspecs/modules/qt_KItemViews.pri \
/usr/lib/qt/mkspecs/modules/qt_KJobWidgets.pri \
/usr/lib/qt/mkspecs/modules/qt_KJS.pri \
/usr/lib/qt/mkspecs/modules/qt_KJSApi.pri \
/usr/lib/qt/mkspecs/modules/qt_KJsEmbed.pri \
/usr/lib/qt/mkspecs/modules/qt_KNewStuff.pri \
/usr/lib/qt/mkspecs/modules/qt_KNotifications.pri \
/usr/lib/qt/mkspecs/modules/qt_KNotifyConfig.pri \
/usr/lib/qt/mkspecs/modules/qt_KNTLM.pri \
/usr/lib/qt/mkspecs/modules/qt_KParts.pri \
/usr/lib/qt/mkspecs/modules/qt_KPlotting.pri \
/usr/lib/qt/mkspecs/modules/qt_KPty.pri \
/usr/lib/qt/mkspecs/modules/qt_KRunner.pri \
/usr/lib/qt/mkspecs/modules/qt_KScreen.pri \
/usr/lib/qt/mkspecs/modules/qt_KService.pri \
/usr/lib/qt/mkspecs/modules/qt_KTextEditor.pri \
/usr/lib/qt/mkspecs/modules/qt_KTextWidgets.pri \
/usr/lib/qt/mkspecs/modules/qt_KUnitConversion.pri \
/usr/lib/qt/mkspecs/modules/qt_KWallet.pri \
/usr/lib/qt/mkspecs/modules/qt_KWidgetsAddons.pri \
/usr/lib/qt/mkspecs/modules/qt_KWindowSystem.pri \
/usr/lib/qt/mkspecs/modules/qt_KXmlGui.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_bootstrap_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_clucene_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_concurrent.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_concurrent_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_core.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_core_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_dbus.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_dbus_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_declarative.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_declarative_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_designer.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_designer_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_designercomponents_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_gui.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_gui_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_help.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_help_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_location.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_location_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_multimedia.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_multimedia_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_multimediawidgets.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_multimediawidgets_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_network.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_network_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_opengl.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_opengl_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_openglextensions.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_openglextensions_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_platformsupport_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_positioning.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_positioning_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_printsupport.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_printsupport_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_qml.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_qml_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_qmldevtools_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_qmltest.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_qmltest_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_qtmultimediaquicktools_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_quick.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_quick_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_quickparticles_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_quickwidgets.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_quickwidgets_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_script.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_script_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_scripttools.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_scripttools_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_sensors.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_sensors_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_sql.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_sql_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_svg.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_svg_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_testlib.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_testlib_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_uitools.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_uitools_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_webchannel.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_webchannel_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_webkit.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_webkit_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_webkitwidgets.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_webkitwidgets_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_websockets.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_websockets_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_widgets.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_widgets_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_x11extras.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_x11extras_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_xml.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_xml_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_xmlpatterns.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_xmlpatterns_private.pri \
/usr/lib/qt/mkspecs/modules/qt_phonon4qt5.pri \
/usr/lib/qt/mkspecs/modules/qt_QuickAddons.pri \
/usr/lib/qt/mkspecs/modules/qt_Solid.pri \
/usr/lib/qt/mkspecs/modules/qt_SonnetCore.pri \
/usr/lib/qt/mkspecs/modules/qt_SonnetUi.pri \
/usr/lib/qt/mkspecs/modules/qt_ThreadWeaver.pri \
/usr/lib/qt/mkspecs/features/qt_functions.prf \
/usr/lib/qt/mkspecs/features/qt_config.prf \
/usr/lib/qt/mkspecs/linux-g++/qmake.conf \
/usr/lib/qt/mkspecs/features/spec_post.prf \
/usr/lib/qt/mkspecs/features/exclusive_builds.prf \
/usr/lib/qt/mkspecs/features/default_pre.prf \
/usr/lib/qt/mkspecs/features/resolve_config.prf \
/usr/lib/qt/mkspecs/features/default_post.prf \
/usr/lib/qt/mkspecs/features/warn_on.prf \
/usr/lib/qt/mkspecs/features/qt.prf \
/usr/lib/qt/mkspecs/features/resources.prf \
/usr/lib/qt/mkspecs/features/moc.prf \
/usr/lib/qt/mkspecs/features/unix/thread.prf \
/usr/lib/qt/mkspecs/features/testcase_targets.prf \
/usr/lib/qt/mkspecs/features/exceptions.prf \
/usr/lib/qt/mkspecs/features/yacc.prf \
/usr/lib/qt/mkspecs/features/lex.prf \
../example/Example.pro ../example/models/artikel.h ../example/models/artikel.cpp
QMAKE_TARGET = EntityManager
DESTDIR = #avoid trailing-slash linebreak
TARGET = EntityManager
first: all
####### Implicit rules
.SUFFIXES: .o .c .cpp .cc .cxx .C
.cpp.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.cc.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.cxx.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.C.o:
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
.c.o:
$(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
####### Build rules
$(TARGET): $(OBJECTS)
$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
Makefile: ../example/Example.pro /usr/lib/qt/mkspecs/linux-g++/qmake.conf /usr/lib/qt/mkspecs/features/spec_pre.prf \
/usr/lib/qt/mkspecs/common/shell-unix.conf \
/usr/lib/qt/mkspecs/common/unix.conf \
/usr/lib/qt/mkspecs/common/linux.conf \
/usr/lib/qt/mkspecs/common/gcc-base.conf \
/usr/lib/qt/mkspecs/common/gcc-base-unix.conf \
/usr/lib/qt/mkspecs/common/g++-base.conf \
/usr/lib/qt/mkspecs/common/g++-unix.conf \
/usr/lib/qt/mkspecs/qconfig.pri \
/usr/lib/qt/mkspecs/modules/qt_Attica.pri \
/usr/lib/qt/mkspecs/modules/qt_KActivities.pri \
/usr/lib/qt/mkspecs/modules/qt_KArchive.pri \
/usr/lib/qt/mkspecs/modules/qt_KAuth.pri \
/usr/lib/qt/mkspecs/modules/qt_KBookmarks.pri \
/usr/lib/qt/mkspecs/modules/qt_KCMUtils.pri \
/usr/lib/qt/mkspecs/modules/qt_KCodecs.pri \
/usr/lib/qt/mkspecs/modules/qt_KCompletion.pri \
/usr/lib/qt/mkspecs/modules/qt_KConfigCore.pri \
/usr/lib/qt/mkspecs/modules/qt_KConfigGui.pri \
/usr/lib/qt/mkspecs/modules/qt_KConfigWidgets.pri \
/usr/lib/qt/mkspecs/modules/qt_KCoreAddons.pri \
/usr/lib/qt/mkspecs/modules/qt_KCrash.pri \
/usr/lib/qt/mkspecs/modules/qt_KDBusAddons.pri \
/usr/lib/qt/mkspecs/modules/qt_KDeclarative.pri \
/usr/lib/qt/mkspecs/modules/qt_KDESu.pri \
/usr/lib/qt/mkspecs/modules/qt_KDEWebKit.pri \
/usr/lib/qt/mkspecs/modules/qt_KEmoticons.pri \
/usr/lib/qt/mkspecs/modules/qt_KGlobalAccel.pri \
/usr/lib/qt/mkspecs/modules/qt_KGuiAddons.pri \
/usr/lib/qt/mkspecs/modules/qt_KHtml.pri \
/usr/lib/qt/mkspecs/modules/qt_KI18n.pri \
/usr/lib/qt/mkspecs/modules/qt_KIconThemes.pri \
/usr/lib/qt/mkspecs/modules/qt_KIdleTime.pri \
/usr/lib/qt/mkspecs/modules/qt_KIOCore.pri \
/usr/lib/qt/mkspecs/modules/qt_KIOFileWidgets.pri \
/usr/lib/qt/mkspecs/modules/qt_KIOWidgets.pri \
/usr/lib/qt/mkspecs/modules/qt_KItemModels.pri \
/usr/lib/qt/mkspecs/modules/qt_KItemViews.pri \
/usr/lib/qt/mkspecs/modules/qt_KJobWidgets.pri \
/usr/lib/qt/mkspecs/modules/qt_KJS.pri \
/usr/lib/qt/mkspecs/modules/qt_KJSApi.pri \
/usr/lib/qt/mkspecs/modules/qt_KJsEmbed.pri \
/usr/lib/qt/mkspecs/modules/qt_KNewStuff.pri \
/usr/lib/qt/mkspecs/modules/qt_KNotifications.pri \
/usr/lib/qt/mkspecs/modules/qt_KNotifyConfig.pri \
/usr/lib/qt/mkspecs/modules/qt_KNTLM.pri \
/usr/lib/qt/mkspecs/modules/qt_KParts.pri \
/usr/lib/qt/mkspecs/modules/qt_KPlotting.pri \
/usr/lib/qt/mkspecs/modules/qt_KPty.pri \
/usr/lib/qt/mkspecs/modules/qt_KRunner.pri \
/usr/lib/qt/mkspecs/modules/qt_KScreen.pri \
/usr/lib/qt/mkspecs/modules/qt_KService.pri \
/usr/lib/qt/mkspecs/modules/qt_KTextEditor.pri \
/usr/lib/qt/mkspecs/modules/qt_KTextWidgets.pri \
/usr/lib/qt/mkspecs/modules/qt_KUnitConversion.pri \
/usr/lib/qt/mkspecs/modules/qt_KWallet.pri \
/usr/lib/qt/mkspecs/modules/qt_KWidgetsAddons.pri \
/usr/lib/qt/mkspecs/modules/qt_KWindowSystem.pri \
/usr/lib/qt/mkspecs/modules/qt_KXmlGui.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_bootstrap_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_clucene_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_concurrent.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_concurrent_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_core.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_core_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_dbus.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_dbus_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_declarative.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_declarative_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_designer.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_designer_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_designercomponents_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_gui.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_gui_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_help.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_help_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_location.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_location_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_multimedia.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_multimedia_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_multimediawidgets.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_multimediawidgets_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_network.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_network_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_opengl.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_opengl_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_openglextensions.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_openglextensions_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_platformsupport_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_positioning.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_positioning_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_printsupport.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_printsupport_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_qml.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_qml_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_qmldevtools_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_qmltest.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_qmltest_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_qtmultimediaquicktools_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_quick.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_quick_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_quickparticles_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_quickwidgets.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_quickwidgets_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_script.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_script_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_scripttools.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_scripttools_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_sensors.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_sensors_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_sql.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_sql_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_svg.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_svg_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_testlib.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_testlib_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_uitools.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_uitools_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_webchannel.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_webchannel_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_webkit.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_webkit_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_webkitwidgets.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_webkitwidgets_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_websockets.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_websockets_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_widgets.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_widgets_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_x11extras.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_x11extras_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_xml.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_xml_private.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_xmlpatterns.pri \
/usr/lib/qt/mkspecs/modules/qt_lib_xmlpatterns_private.pri \
/usr/lib/qt/mkspecs/modules/qt_phonon4qt5.pri \
/usr/lib/qt/mkspecs/modules/qt_QuickAddons.pri \
/usr/lib/qt/mkspecs/modules/qt_Solid.pri \
/usr/lib/qt/mkspecs/modules/qt_SonnetCore.pri \
/usr/lib/qt/mkspecs/modules/qt_SonnetUi.pri \
/usr/lib/qt/mkspecs/modules/qt_ThreadWeaver.pri \
/usr/lib/qt/mkspecs/features/qt_functions.prf \
/usr/lib/qt/mkspecs/features/qt_config.prf \
/usr/lib/qt/mkspecs/linux-g++/qmake.conf \
/usr/lib/qt/mkspecs/features/spec_post.prf \
/usr/lib/qt/mkspecs/features/exclusive_builds.prf \
/usr/lib/qt/mkspecs/features/default_pre.prf \
/usr/lib/qt/mkspecs/features/resolve_config.prf \
/usr/lib/qt/mkspecs/features/default_post.prf \
/usr/lib/qt/mkspecs/features/warn_on.prf \
/usr/lib/qt/mkspecs/features/qt.prf \
/usr/lib/qt/mkspecs/features/resources.prf \
/usr/lib/qt/mkspecs/features/moc.prf \
/usr/lib/qt/mkspecs/features/unix/thread.prf \
/usr/lib/qt/mkspecs/features/testcase_targets.prf \
/usr/lib/qt/mkspecs/features/exceptions.prf \
/usr/lib/qt/mkspecs/features/yacc.prf \
/usr/lib/qt/mkspecs/features/lex.prf \
../example/Example.pro \
/usr/lib/libQt5Sql.prl \
/usr/lib/libQt5Core.prl
$(QMAKE) -spec linux-g++ CONFIG+=debug -o Makefile ../example/Example.pro
/usr/lib/qt/mkspecs/features/spec_pre.prf:
/usr/lib/qt/mkspecs/common/shell-unix.conf:
/usr/lib/qt/mkspecs/common/unix.conf:
/usr/lib/qt/mkspecs/common/linux.conf:
/usr/lib/qt/mkspecs/common/gcc-base.conf:
/usr/lib/qt/mkspecs/common/gcc-base-unix.conf:
/usr/lib/qt/mkspecs/common/g++-base.conf:
/usr/lib/qt/mkspecs/common/g++-unix.conf:
/usr/lib/qt/mkspecs/qconfig.pri:
/usr/lib/qt/mkspecs/modules/qt_Attica.pri:
/usr/lib/qt/mkspecs/modules/qt_KActivities.pri:
/usr/lib/qt/mkspecs/modules/qt_KArchive.pri:
/usr/lib/qt/mkspecs/modules/qt_KAuth.pri:
/usr/lib/qt/mkspecs/modules/qt_KBookmarks.pri:
/usr/lib/qt/mkspecs/modules/qt_KCMUtils.pri:
/usr/lib/qt/mkspecs/modules/qt_KCodecs.pri:
/usr/lib/qt/mkspecs/modules/qt_KCompletion.pri:
/usr/lib/qt/mkspecs/modules/qt_KConfigCore.pri:
/usr/lib/qt/mkspecs/modules/qt_KConfigGui.pri:
/usr/lib/qt/mkspecs/modules/qt_KConfigWidgets.pri:
/usr/lib/qt/mkspecs/modules/qt_KCoreAddons.pri:
/usr/lib/qt/mkspecs/modules/qt_KCrash.pri:
/usr/lib/qt/mkspecs/modules/qt_KDBusAddons.pri:
/usr/lib/qt/mkspecs/modules/qt_KDeclarative.pri:
/usr/lib/qt/mkspecs/modules/qt_KDESu.pri:
/usr/lib/qt/mkspecs/modules/qt_KDEWebKit.pri:
/usr/lib/qt/mkspecs/modules/qt_KEmoticons.pri:
/usr/lib/qt/mkspecs/modules/qt_KGlobalAccel.pri:
/usr/lib/qt/mkspecs/modules/qt_KGuiAddons.pri:
/usr/lib/qt/mkspecs/modules/qt_KHtml.pri:
/usr/lib/qt/mkspecs/modules/qt_KI18n.pri:
/usr/lib/qt/mkspecs/modules/qt_KIconThemes.pri:
/usr/lib/qt/mkspecs/modules/qt_KIdleTime.pri:
/usr/lib/qt/mkspecs/modules/qt_KIOCore.pri:
/usr/lib/qt/mkspecs/modules/qt_KIOFileWidgets.pri:
/usr/lib/qt/mkspecs/modules/qt_KIOWidgets.pri:
/usr/lib/qt/mkspecs/modules/qt_KItemModels.pri:
/usr/lib/qt/mkspecs/modules/qt_KItemViews.pri:
/usr/lib/qt/mkspecs/modules/qt_KJobWidgets.pri:
/usr/lib/qt/mkspecs/modules/qt_KJS.pri:
/usr/lib/qt/mkspecs/modules/qt_KJSApi.pri:
/usr/lib/qt/mkspecs/modules/qt_KJsEmbed.pri:
/usr/lib/qt/mkspecs/modules/qt_KNewStuff.pri:
/usr/lib/qt/mkspecs/modules/qt_KNotifications.pri:
/usr/lib/qt/mkspecs/modules/qt_KNotifyConfig.pri:
/usr/lib/qt/mkspecs/modules/qt_KNTLM.pri:
/usr/lib/qt/mkspecs/modules/qt_KParts.pri:
/usr/lib/qt/mkspecs/modules/qt_KPlotting.pri:
/usr/lib/qt/mkspecs/modules/qt_KPty.pri:
/usr/lib/qt/mkspecs/modules/qt_KRunner.pri:
/usr/lib/qt/mkspecs/modules/qt_KScreen.pri:
/usr/lib/qt/mkspecs/modules/qt_KService.pri:
/usr/lib/qt/mkspecs/modules/qt_KTextEditor.pri:
/usr/lib/qt/mkspecs/modules/qt_KTextWidgets.pri:
/usr/lib/qt/mkspecs/modules/qt_KUnitConversion.pri:
/usr/lib/qt/mkspecs/modules/qt_KWallet.pri:
/usr/lib/qt/mkspecs/modules/qt_KWidgetsAddons.pri:
/usr/lib/qt/mkspecs/modules/qt_KWindowSystem.pri:
/usr/lib/qt/mkspecs/modules/qt_KXmlGui.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_bootstrap_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_clucene_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_concurrent.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_concurrent_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_core.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_core_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_dbus.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_dbus_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_declarative.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_declarative_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_designer.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_designer_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_designercomponents_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_gui.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_gui_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_help.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_help_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_location.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_location_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_multimedia.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_multimedia_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_multimediawidgets.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_multimediawidgets_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_network.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_network_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_opengl.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_opengl_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_openglextensions.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_openglextensions_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_platformsupport_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_positioning.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_positioning_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_printsupport.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_printsupport_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_qml.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_qml_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_qmldevtools_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_qmltest.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_qmltest_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_qtmultimediaquicktools_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_quick.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_quick_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_quickparticles_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_quickwidgets.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_quickwidgets_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_script.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_script_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_scripttools.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_scripttools_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_sensors.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_sensors_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_sql.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_sql_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_svg.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_svg_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_testlib.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_testlib_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_uitools.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_uitools_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_webchannel.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_webchannel_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_webkit.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_webkit_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_webkitwidgets.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_webkitwidgets_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_websockets.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_websockets_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_widgets.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_widgets_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_x11extras.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_x11extras_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_xml.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_xml_private.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_xmlpatterns.pri:
/usr/lib/qt/mkspecs/modules/qt_lib_xmlpatterns_private.pri:
/usr/lib/qt/mkspecs/modules/qt_phonon4qt5.pri:
/usr/lib/qt/mkspecs/modules/qt_QuickAddons.pri:
/usr/lib/qt/mkspecs/modules/qt_Solid.pri:
/usr/lib/qt/mkspecs/modules/qt_SonnetCore.pri:
/usr/lib/qt/mkspecs/modules/qt_SonnetUi.pri:
/usr/lib/qt/mkspecs/modules/qt_ThreadWeaver.pri:
/usr/lib/qt/mkspecs/features/qt_functions.prf:
/usr/lib/qt/mkspecs/features/qt_config.prf:
/usr/lib/qt/mkspecs/linux-g++/qmake.conf:
/usr/lib/qt/mkspecs/features/spec_post.prf:
/usr/lib/qt/mkspecs/features/exclusive_builds.prf:
/usr/lib/qt/mkspecs/features/default_pre.prf:
/usr/lib/qt/mkspecs/features/resolve_config.prf:
/usr/lib/qt/mkspecs/features/default_post.prf:
/usr/lib/qt/mkspecs/features/warn_on.prf:
/usr/lib/qt/mkspecs/features/qt.prf:
/usr/lib/qt/mkspecs/features/resources.prf:
/usr/lib/qt/mkspecs/features/moc.prf:
/usr/lib/qt/mkspecs/features/unix/thread.prf:
/usr/lib/qt/mkspecs/features/testcase_targets.prf:
/usr/lib/qt/mkspecs/features/exceptions.prf:
/usr/lib/qt/mkspecs/features/yacc.prf:
/usr/lib/qt/mkspecs/features/lex.prf:
../example/Example.pro:
/usr/lib/libQt5Sql.prl:
/usr/lib/libQt5Core.prl:
qmake: FORCE
@$(QMAKE) -spec linux-g++ CONFIG+=debug -o Makefile ../example/Example.pro
qmake_all: FORCE
all: Makefile $(TARGET)
dist: distdir FORCE
(cd `dirname $(DISTDIR)` && $(TAR) $(DISTNAME).tar $(DISTNAME) && $(COMPRESS) $(DISTNAME).tar) && $(MOVE) `dirname $(DISTDIR)`/$(DISTNAME).tar.gz . && $(DEL_FILE) -r $(DISTDIR)
distdir: FORCE
@test -d $(DISTDIR) || mkdir -p $(DISTDIR)
$(COPY_FILE) --parents $(DIST) $(DISTDIR)/
$(COPY_FILE) --parents ../example/models/artikel.h $(DISTDIR)/
$(COPY_FILE) --parents ../example/models/artikel.cpp $(DISTDIR)/
clean:compiler_clean
-$(DEL_FILE) $(OBJECTS)
-$(DEL_FILE) *~ core *.core
distclean: clean
-$(DEL_FILE) $(TARGET)
-$(DEL_FILE) Makefile
####### Sub-libraries
mocclean: compiler_moc_header_clean compiler_moc_source_clean
mocables: compiler_moc_header_make_all compiler_moc_source_make_all
check: first
compiler_rcc_make_all:
compiler_rcc_clean:
compiler_moc_header_make_all:
compiler_moc_header_clean:
compiler_moc_source_make_all:
compiler_moc_source_clean:
compiler_yacc_decl_make_all:
compiler_yacc_decl_clean:
compiler_yacc_impl_make_all:
compiler_yacc_impl_clean:
compiler_lex_make_all:
compiler_lex_clean:
compiler_clean:
####### Compile
artikel.o: ../example/models/artikel.cpp ../example/models/artikel.h
$(CXX) -c $(CXXFLAGS) $(INCPATH) -o artikel.o ../example/models/artikel.cpp
####### Install
install: FORCE
uninstall: FORCE
FORCE:
example/Example.pro
TEMPLATE = app
HEADERS += \
models/artikel.h
models/artikel.h \
models/person.h \
models/group.h
SOURCES += \
models/artikel.cpp
main.cpp \
models/artikel.cpp \
models/person.cpp \
models/group.cpp
unix:!macx: LIBS += -L$$PWD/../../build-EntityManager-Desktop-Debug -lCuteEntityManager
INCLUDEPATH += $$PWD/../src
DEPENDPATH += $$PWD/../src
CONFIG += c++11
example/main.cpp
#include <QCoreApplication>
#include "src/entitymanager.h"
#include <typeinfo>
#include <QDir>
#include <QDebug>
#include "models/artikel.h"
#include "models/person.h"
#include <typeinfo>
#include <QMetaMethod>
#include <QMetaProperty>
#include "models/group.h"
#include "entity.h"
#include <QGenericReturnArgument>
/**
* create,remove und merge funktionieren
*/
int main(int argc, char *argv[])
{
OpenTeacherTool::EntityManager *e = new OpenTeacherTool::EntityManager("QSQLITE",QDir::currentPath() + "/db.sqlite");
int main(int argc, char *argv[]) {
// OpenTeacherTool::EntityManager *e = new OpenTeacherTool::EntityManager("QSQLITE",QDir::currentPath() + "/db.sqlite");
OpenTeacherTool::Artikel *b= new OpenTeacherTool::Artikel(30,"Peter123");
OpenTeacherTool::Entity *entity = b->getEntity();
qDebug() << "findByAttributes:" << e->findByAttributes(entity,true);
qDebug() << "create:" << e->create(entity);
qDebug() << "findAll:" << e->findAll(entity->getTablename());
entity->setAttributes(e->findByAttributes(entity,true).at(0));
qDebug() << "AttributeValues, Artikel:" << *b->getAttributeValues();
b->setName("Peter");
b->setPreis(20);
e->remove(entity);
qDebug() << "TypID:" << typeid(entity).name();
qDebug() << entity->getId();
qDebug() << "merge:" << e->merge(entity);
delete entity;
// OpenTeacherTool::Artikel *b= new OpenTeacherTool::Artikel(30,"Peter123");
// OpenTeacherTool::Entity *entity = b->getEntity();
// qDebug() << "findByAttributes:" << e->findByAttributes(entity,true);
// qDebug() << "create:" << e->create(entity);
// qDebug() << "findAll:" << e->findAll(entity->getTablename());
// entity->setAttributes(e->findByAttributes(entity,true).at(0));
// qDebug() << "AttributeValues, Artikel:" << *b->getAttributeValues();
// b->setName("Peter");
// b->setPreis(20);
// e->remove(entity);
// qDebug() << "TypID:" << typeid(entity).name();
// qDebug() << entity->getId();
// qDebug() << "merge:" << e->merge(entity);
// delete entity;
// Artikel *a = new Artikel(10.0,"pew");
// a->setId(100);
// qDebug() << a->getTablename();
// for (int var = 0; var < a->metaObject()->methodCount(); ++var) {
// qDebug() << a->metaObject()->method(var).name();
// }
// Person *b = new Person();
// b->setId(110);
// qDebug() << b->getTablename();
// for (int var = 0; var < b->metaObject()->propertyCount(); ++var) {
// qDebug() << b->metaObject()->property(var).name();
// qDebug() << b->metaObject()->property(var).read(b);
// }
Group *g = new Group();
for (int var = 0; var < g->metaObject()->propertyCount(); ++var) {
qDebug() << "Name:" << g->metaObject()->property(var).name();
auto p = g->metaObject()->property(var).read(g);
if (QString(p.typeName()).contains("QList")) {
auto n = static_cast<QList<CuteEntityManager::Entity *>*>(p.data());
qDebug() << "Size:" << n->size();
for (int var = 0; var < n->size(); ++var) {
CuteEntityManager::Entity *entity = n->at(var);
qDebug() << entity->toString();
}
}
}
return 0;
}
example/models/artikel.cpp
You should have received a copy of the GNU General Public License
along with OpenTeacherTool. If not, see <http://www.gnu.org/licenses/>.
*/
#include "artikel.h"
namespace OpenTeacherTool {
Artikel::Artikel()
{
}
//QHash<QString, QString> Artikel::getProperties(DatabaseType type) {
// QHash<QString, QString> h = QHash<QString, QString>();
// h.insert("id",this->idColumnSQL());
// h.insert("preis","DOUBLE");
// h.insert("name","TEXT");
// return h;
//}
Artikel::Artikel(double preis, QString name) {
this->preis = preis;
this->name = name;
}
//PersistenceType Artikel::getPersistenceType() {
// return OpenTeacherTool::LOCAL;
//}
QHash<QString, QString> Artikel::getProperties(DatabaseType type) {
QHash<QString, QString> h = QHash<QString, QString>();
h.insert("id",this->idColumnSQL());
h.insert("preis","DOUBLE");
h.insert("name","TEXT");
return h;
}
//QHash<QString, Entity*> *Artikel::getRelations() {
// return this->relations;
//}
PersistenceType Artikel::getPersistenceType() {
return OpenTeacherTool::LOCAL;
}
//QHash<QString, QVariant> *Artikel::getAttributeValues() {
// this->attributeValues->insert("id",this->id);
// this->attributeValues->insert("name",this->name);
// this->attributeValues->insert("preis",this->preis);
// return this->attributeValues;
//}
//void Artikel::setAttributes(QHash<QString, QVariant> h) {
// this->id = h.value("id").toInt();
// this->name = h.value("name").toString();
// this->preis = h.value("preis").toDouble();
//}
QHash<QString, Entity*> *Artikel::getRelations() {
return this->relations;
}
QHash<QString, QVariant> *Artikel::getAttributeValues() {
this->attributeValues->insert("id",this->id);
this->attributeValues->insert("name",this->name);
this->attributeValues->insert("preis",this->preis);
return this->attributeValues;
}
void Artikel::setAttributes(QHash<QString, QVariant> h) {
this->id = h.value("id").toInt();
this->name = h.value("name").toString();
this->preis = h.value("preis").toDouble();
double Artikel::getPreis() const {
return preis;
}
QString Artikel::getTablename() {
return "artikel";
void Artikel::setPreis(double value) {
preis = value;
}
void Artikel::setPreis(double preis) {
this->preis = preis;
QString Artikel::getName() const {
return name;
}
void Artikel::setName(QString name) {
this->name = name;
void Artikel::setName(const QString &value) {
name = value;
}
Artikel::~Artikel() {
}
Artikel::Artikel(double preis, QString name) : Entity(){
this->preis = preis;
this->name = name;
}
example/models/artikel.h
#ifndef ARTIKEL_H
#define ARTIKEL_H
#include "src/base/entity.h"
#include "entity.h"
#include <QHash>
#include <QVariant>
namespace OpenTeacherTool {
class Artikel : public Entity
{
class Artikel : public CuteEntityManager::Entity {
Q_OBJECT
private:
double preis;
QString name;
public:
~Artikel();
QHash<QString, QString> getProperties(DatabaseType type);
PersistenceType getPersistenceType();
QHash<QString,Entity*>* getRelations();
QHash<QString, QVariant>* getAttributeValues();
void setAttributes(QHash<QString, QVariant> h);
QString getTablename();
void setPreis(double preis);
void setName(QString name);
Artikel();
// QHash<QString, QString> getProperties(DatabaseType type);
// PersistenceType getPersistenceType();
// QHash<QString,Entity*>* getRelations();
// QHash<QString, QVariant>* getAttributeValues();
// void setAttributes(QHash<QString, QVariant> h);
explicit Artikel(QObject *parent = 0);
Artikel(double preis, QString name);
Q_INVOKABLE double getPreis() const;
Q_INVOKABLE void setPreis(double value);
Q_INVOKABLE QString getName() const;
Q_INVOKABLE void setName(const QString &value);
};
}
#endif // ARTIKEL_H
example/models/group.cpp
#include "group.h"
#include "models/person.h"
#include "models/group.h"
//#include <QQmlListProperty>
#include <QDebug>
Group::Group() : Entity() {
connect(this, SIGNAL(personsChanged()), this, SLOT(personChangedSlot()));
qDebug() << "Konstruktor!";
persons = QList<Person *>();
persons.append(new Person("Vera", "Geseke", Person::FEMALE, "Vera Geseke.jpg", "", "", QDate::currentDate()));
persons.append(new Person("Harry", "Hirsch", Person::MALE));
persons.append(new Person("Sibylle", "Mentzel", Person::FEMALE, "Sibylle Mentzel.jpg", "", "", QDate::currentDate()));
}
QList<Person *> Group::getPersons() const {
return persons;
}
void Group::setPersons(const QList<Person *> &value) {
qDebug() << "set!!!";
persons = value;
}
void Group::personChangedSlot() {
qDebug() << "changed!";
}
//void Group::appendPerson(QQmlListProperty<Person> *list, Person *p) {
// Group *group = qobject_cast<Group*>(list->object);
// if(group && p) {
// group->addPerson(p);
// emit group->personsChanged();
// }
//}
//int Group::personsCount(QQmlListProperty<Person>*list)
//{
// Group *group = qobject_cast<Group*>(list->object);
// if (group)
// return group->m_persons.count();
// return 0;
//}
//Person* Group::personAt(QQmlListProperty<Person> *list, int i)
//{
// Group *group = qobject_cast<Group*>(list->object);
// if (group)
// return group->m_persons.at(i);
// return 0;
//}
//void Group::personsClear(QQmlListProperty<Person> *list)
//{
// Group *group = qobject_cast<Group*>(list->object);
// if (group) {
// group->m_persons.clear();
// emit group->personsChanged();
// }
//}
example/models/group.h
#ifndef GROUP_H
#define GROUP_H
#define BR_PROPERTY(TYPE,NAME,DEFAULT) \
TYPE NAME; \
TYPE get_##NAME() const { return NAME; } \
void set_##NAME(TYPE the_##NAME) { NAME = the_##NAME; } \
void reset_##NAME() { NAME = DEFAULT; }
#include "models/person.h"
//#include <QQmlListProperty>
#include <QDebug>
#include <QList>
#include <QVariantList>
//#include <QQuickView>
class SeatingPlan;
class Teacher;
class Person;
class Group: public CuteEntityManager::Entity {
Q_OBJECT
//Q_ENUMS(Gender)
//Q_PROPERTY(QList<Person*> persons READ getPersons)
// Q_PROPERTY(QList<Person*> persons READ get_persons WRITE set_persons RESET reset_persons)
// BR_PROPERTY(QList<Person*>, persons, QList<Person*>())
Q_PROPERTY(QList<Person*> persons READ getPersons WRITE setPersons NOTIFY personsChanged)
signals:
void personsChanged();
public slots:
void personChangedSlot();
public:
// constructor
Group();
// getters
// QQmlListProperty <Person> persons();
// static void appendPerson(QQmlListProperty<Person> *list, Person *p);
// static int personsCount(QQmlListProperty<Person>*list);
// static Person* personAt(QQmlListProperty<Person> *list, int i);
// static void personsClear(QQmlListProperty<Person> *list);
QList <Person *> classPrefects() {
return m_classPrefects;
}
QList <Person *> parentSpeakers() {
return m_parentSpeakers;
}
// setters
void removePerson(Person *p) {
persons.removeOne(p);
}
void addClassPrefect(Person *p) {
m_classPrefects.append(p);
}
void removeClassPrefect(Person *p) {
m_classPrefects.removeOne(p);
}
void addParentSpeaker(Person *p) {
m_parentSpeakers.append(p);
}
void removeParentSpeaker(Person *p) {
m_parentSpeakers.removeOne(p);
}
void addPerson(Person *p) {
persons.append(p);
}
QList<Person *> getPersons() const;
void setPersons(const QList<Person *> &value);
protected:
// members
QList<Person*> persons;
QList <Person *> m_classPrefects;
QList <Person *> m_parentSpeakers;
// PersonListModel* m_personListModel;
};
#endif // GROUP_H
example/models/person.cpp
#include "person.h"
QString Person::toString()
{
return Entity::toString() + " " + this->firstName();
}
Person::Person(QObject *parent) : Entity(parent)
{
}
Person::Person(QString firstName,
QString familyName,
Gender gender,
QString customPictureFileName,
QString namePrefix,
QString nickName,
QDate birthday,
QObject *parent): CuteEntityManager::Entity(parent) {
setFirstName(firstName);
setFamilyName(familyName);
setNamePrefix(namePrefix);
setNickName(nickName);
setBirthday(birthday);
setGender(gender);
setCustomPictureFileName(customPictureFileName);
}
example/models/person.h
#ifndef PERSON_H
#define PERSON_H
#include <QDateTime>
#include <QString>
#include <QList>
#include <QObject>
#include "entity.h"
#include <QAbstractListModel>
#include <QDebug>
class Person: public CuteEntityManager::Entity {
Q_OBJECT
Q_ENUMS(Gender)
//[1] We don't want the id to be set from QML
//[2] Notification via inherited signals is not allowed
Q_PROPERTY(QString firstName READ firstName WRITE setFirstName NOTIFY firstNameChanged)
Q_PROPERTY(QString familyName READ familyName WRITE setFamilyName NOTIFY familyNameChanged)
Q_PROPERTY(QString namePrefix READ namePrefix WRITE setNamePrefix NOTIFY namePrefixChanged)
Q_PROPERTY(QString nickName READ nickName WRITE setNickName NOTIFY nickNameChanged)
Q_PROPERTY(QString customPictureFileName READ customPictureFileName WRITE setCustomPictureFileName NOTIFY
customPictureFileNameChanged)
Q_PROPERTY(QDate birthday READ birthday WRITE setBirthday NOTIFY birthdayChanged)
Q_PROPERTY(Gender gender READ gender WRITE setGender NOTIFY genderChanged)
signals:
void firstNameChanged();
void familyNameChanged();
void namePrefixChanged();
void nickNameChanged();
void birthdayChanged();
void genderChanged();
void customPictureFileNameChanged();
public slots:
void testSlot() {
qDebug() << "testslot clicked";
}
public:
QString toString();
enum Gender {MALE, FEMALE, UNKNOWNGENDER};
Person(QObject *parent=0);
Person(QString firstName,
QString familyName,
Gender gender = Person::UNKNOWNGENDER,
QString customPictureFileName = QString(),
QString namePrefix = QString(),
QString nickName = QString(),
QDate birthday = QDate(),
QObject *parent = 0);
bool isPresent(QDateTime date = QDateTime::currentDateTime());
QString fullName();
// getters
QString firstName() const {
return m_firstName;
}
QString familyName() const {
return m_familyName;
}
QString namePrefix() const {
return m_namePrefix;
}
QString nickName() const {
return m_nickName;
}
QDate birthday() const {
return m_birthday;
}
Gender gender() const {
return m_gender;
}
QString customPictureFileName() const {
return m_customPictureFileName;
}
// setters
void setFirstName(QString firstName) {
m_firstName = firstName;
emit firstNameChanged();
}
void setFamilyName(QString familyName) {
m_familyName = familyName;
emit familyNameChanged();
}
void setNamePrefix(QString namePrefix) {
m_namePrefix = namePrefix;
emit namePrefixChanged();
}
void setNickName(QString nickName) {
m_nickName = nickName;
emit nickNameChanged();
}
void setBirthday(QDate birthday) {
m_birthday = birthday;
emit birthdayChanged();
}
void setGender(Gender gender) {
m_gender = gender;
emit genderChanged();
}
void setCustomPictureFileName(QString fileName) {
m_customPictureFileName = fileName;
emit customPictureFileNameChanged();
}
protected:
// members
QString m_firstName;
QString m_familyName;
QString m_namePrefix;
QString m_nickName;
QDate m_birthday;
Gender m_gender;
QString m_customPictureFileName;
};
Q_DECLARE_METATYPE(Person*)
Q_DECLARE_METATYPE(QList<Person*>)
#endif // PERSON_H
src/database.h
bool supportTransactions;
void init();
protected:
// inline QString pgsqlSeqTable();
// inline QString mysqlSeqTable();
// inline QString sqliteSeqTable();
// inline QString sqliteTableList();
// inline QString mysqlTableList();
// inline QString pgsqlTableList();
public:
Database(QSqlDatabase database);
~Database();
......
bool exec(QList<QSqlQuery> queries);
bool select(QSqlQuery &query);
QSqlQuery select(const QString &query);
// bool isSeqTable();
// qint64 getLastId();
// void getTableListFromDatabase();
// void setTableList(QSqlQuery &q);
// void refreshTableList();
// QChar escapeChar();
};
}
#endif // DATABASE_H
src/entity.cpp
using namespace CuteEntityManager;
Entity::Entity() : QObject() {
Entity::Entity(QObject *parent) : QObject(parent) {
this->id = -1;
}
......
this->id = id;
}
QString Entity::toString() {
return this->getTablename()+ ":" + QString::number(this->id);
}
Entity::~Entity() {
}
src/entity.h
class Entity : public QObject {
Q_OBJECT
Q_PROPERTY(qint64 firstName READ getId WRITE setId NOTIFY idChanged)
signals:
void idChanged();
public:
Entity (QObject *parent = 0);
virtual qint64 getId();
virtual void setId(qint64 id);
virtual QString toString();
virtual ~Entity();
virtual QString getTablename();
// virtual QMap<QString, QString> getManyToManyRelations() = 0; //Key = Table, Value = joined Table Column
protected:
Entity();
qint64 id;
};
}
src/entitymanager.cpp
QStringList EntityManager::connectionNames = QStringList();
EntityManager::EntityManager(QSqlDatabase database) {
this->db = new Database(database);
}
//EntityManager::EntityManager(QSqlDatabase database) {
// auto db = new Database(database);
// this->db = QSharedPointer<Database>(db);
EntityManager::EntityManager(const QString &databaseType, QString databasename , QString hostname, QString username,
QString password, QString port) {
this->db = new Database(databaseType, this->createConnection(), hostname, databasename, username, password,
port.toInt());
}
// auto schema = DatabaseType::getSchema(DatabaseType::getDatabaseType(database.driver()),this->db);
// this->schema = QSharedPointer<Schema>(db);
//}
//EntityManager::EntityManager(const QString &databaseType, QString databasename , QString hostname, QString username,
// QString password, QString port) {
// auto db = new Database(databaseType, this->createConnection(), hostname, databasename, username, password,
// port.toInt());
// this->db = QSharedPointer<Database>(db);
// auto schema = new Schema(this->db);
// this->schema = QSharedPointer<Schema>(db);
//}
inline bool EntityManager::checkTable(Entity *entity) {
//inline bool EntityManager::checkTable(Entity *entity) {
// bool rc = true;
// if (!this->db->containsTable(entity->getTablename())) {
// qDebug() << "Tabelle" << entity->getTablename() << "existiert noch nicht.";
......
// }
// }
// return rc;
}
QString EntityManager::createConnection() {
QStringList l = EntityManager::getConnectionNames();
QString conName = "";
bool ok = false;
qint16 i = 0;
while (!ok) {
if (l.contains("con" + QString::number(i))) {
++i;
} else {
l.append("con" + QString::number(i));
ok = true;
conName = "con" + QString::number(i);
EntityManager::setConnectionNames(l);
}
}
return conName;
}
void EntityManager::removeConnectionName(const QString &name) {
EntityManager::connectionNames.removeOne(name);
}
EntityManager::~EntityManager() {
EntityManager::removeConnectionName(this->db->getConnectionName());
delete db;
}
QStringList EntityManager::getConnectionNames() {
return EntityManager::connectionNames;
}
void EntityManager::setConnectionNames(QStringList list) {
EntityManager::connectionNames = list;
}
void EntityManager::bindValues(const QHash<QString, QVariant> *h, QSqlQuery &q, bool ignoreID) {
QHash<QString, QVariant>::const_iterator i = h->constBegin();
while (i != h->constEnd()) {
if (!ignoreID || (ignoreID && !(i.key() == "id"))) {
q.bindValue(":" + i.key(), i.value());
}
++i;
}
}
//qint8 EntityManager::count(Entity* entity, bool ignoreID) {
//}
//QSharedPointer<Database> EntityManager::getDb() const {
// return db;
//}
//void EntityManager::setDb(const QSharedPointer<Database> &value) {
// db = value;
//}
//QSharedPointer<Schema> EntityManager::getSchema() const {
// return schema;
//}
//void EntityManager::setSchema(const QSharedPointer<Schema> &value) {
// schema = value;
//}
//QString EntityManager::createConnection() {
// QStringList l = EntityManager::getConnectionNames();
// QString conName = "";
// bool ok = false;
// qint16 i = 0;
// while (!ok) {
// if (l.contains("con" + QString::number(i))) {
// ++i;
// } else {
// l.append("con" + QString::number(i));
// ok = true;
// conName = "con" + QString::number(i);
// EntityManager::setConnectionNames(l);
// }
// }
// return conName;
//}
//void EntityManager::removeConnectionName(const QString &name) {
// EntityManager::connectionNames.removeOne(name);
//}
//EntityManager::~EntityManager() {
// EntityManager::removeConnectionName(this->db->getConnectionName());
// delete db;
//}
//QStringList EntityManager::getConnectionNames() {
// return EntityManager::connectionNames;
//}
//void EntityManager::bindValues(const QHash<QString, QVariant> *h, QSqlQuery &q, bool ignoreID) {
// QHash<QString, QVariant>::const_iterator i = h->constBegin();
// while (i != h->constEnd()) {
// if (!ignoreID || (ignoreID && !(i.key() == "id"))) {
// q.bindValue(":" + i.key(), i.value());
// }
// ++i;
// }
//}
//qint8 EntityManager::count(Entity *entity, bool ignoreID) {
// qint8 rc = 0;
// QSqlQuery q = this->db->getQuery("SELECT COUNT(*) FROM " + entity->getTablename() + this->where(entity->getAttributeValues(),"AND",ignoreID));
// this->bindValues(entity->getAttributeValues(),q);
// QSqlQuery q = this->db->getQuery("SELECT COUNT(*) FROM " + entity->getTablename() + this->where(
// entity->getAttributeValues(), "AND", ignoreID));
// this->bindValues(entity->getAttributeValues(), q);
// this->db->select(q);
// if(q.next()) {
// if (q.next()) {
// rc = q.value(0).toInt();
// }
// return rc;
//}
//QString EntityManager::buildCreateQuery(QHash<QString,QVariant>::const_iterator i, QHash<QString,QVariant>::const_iterator end, QString &p1, QString &p2) {
//QString EntityManager::buildCreateQuery(QHash<QString, QVariant>::const_iterator i,
// QHash<QString, QVariant>::const_iterator end, QString &p1, QString &p2) {
// bool first = true;
// while(i != end) {
// if(!first) {
// while (i != end) {
// if (!first) {
// p1 += ",";
// p2 += ",";
// } else {
// first = false;
// }
// p1 += i.key();
// p2 += ":"+i.key();
// p2 += ":" + i.key();
// ++i;
// }
// p1 += ")";
......
//bool EntityManager::create(Entity *entity) {
// bool rc = false;
// if(this->checkTable(entity) && this->count(entity) == 0) {
// if (this->checkTable(entity) && this->count(entity) == 0) {
// QSqlQuery q = this->db->getQuery();
// QString p1 = "INSERT INTO " + entity->getTablename() + "(";
// QString p2 = "VALUES(";
// entity->setId(this->db->getLastId());
// if(!entity->getAttributeValues()->isEmpty()) {
// q.prepare(this->buildCreateQuery(entity->getAttributeValues()->constBegin(),entity->getAttributeValues()->constEnd(),p1,p2));
// if (!entity->getAttributeValues()->isEmpty()) {
// q.prepare(this->buildCreateQuery(entity->getAttributeValues()->constBegin(), entity->getAttributeValues()->constEnd(),
// p1, p2));
// }
// this->bindValues(entity->getAttributeValues(),q);
// if(this->db->updateSequenceCounter(q)) {
// this->bindValues(entity->getAttributeValues(), q);
// if (this->db->updateSequenceCounter(q)) {
// entity->setId(this->findId(entity));
// rc = true;
// }
......
// return rc;
//}
//QHash<QString,QVariant> EntityManager::find(qint64 id, QString tblname) {
// QSqlQuery q = this->db->getQuery("SELECT * FROM " + tblname +" WHERE id= :id LIMIT 1;");
// q.bindValue(":id",id);
//QHash<QString, QVariant> EntityManager::find(qint64 id, QString tblname) {
// QSqlQuery q = this->db->getQuery("SELECT * FROM " + tblname + " WHERE id= :id LIMIT 1;");
// q.bindValue(":id", id);
// this->db->select(q);
// QSqlRecord rec = q.record();
// QHash<QString,QVariant> map = QHash<QString, QVariant>();
// if(q.next()) {
// QHash<QString, QVariant> map = QHash<QString, QVariant>();
// if (q.next()) {
// for (int var = 0; var < rec.count(); ++var) {
// map.insert(rec.fieldName(var),q.value(rec.indexOf(rec.fieldName(var)))); // parameters of q.value can maybe replaced with var
// map.insert(rec.fieldName(var), q.value(rec.indexOf(rec.fieldName(
// var)))); // parameters of q.value can maybe replaced with var
// }
// }
// return map;
//}
//QList<QHash <QString,QVariant> > EntityManager::findByAttributes(QHash<QString, QVariant> *m, const QString &tblname, bool ignoreID) {
// QSqlQuery q = this->db->getQuery("SELECT * FROM " + tblname + this->where(m,"AND",ignoreID));
// this->bindValues(m,q,true);
//QList<QHash <QString, QVariant> > EntityManager::findByAttributes(QHash<QString, QVariant> *m, const QString &tblname,
// bool ignoreID) {
// QSqlQuery q = this->db->getQuery("SELECT * FROM " + tblname + this->where(m, "AND", ignoreID));
// this->bindValues(m, q, true);
// return this->convertQueryResult(q);
//}
//QList<QHash<QString, QVariant> > EntityManager::convertQueryResult(QSqlQuery &q) {
// QList<QHash <QString, QVariant> > listmap = QList<QHash <QString,QVariant> >();
// QList<QHash <QString, QVariant> > listmap = QList<QHash <QString, QVariant> >();
// this->db->select(q);
// QSqlRecord rec = q.record();
// QStringList l = QStringList();
......
// for (int var = 0; var < field_count; ++var) {
// l.append(rec.fieldName(var));
// }
// QHash<QString,QVariant> map = QHash<QString, QVariant>();
// while(q.next()) {
// QHash<QString, QVariant> map = QHash<QString, QVariant>();
// while (q.next()) {
// for (int var = 0; var < field_count; ++var) {
// map.insert(l.at(var),q.value(rec.indexOf(l.at(var))));
// map.insert(l.at(var), q.value(rec.indexOf(l.at(var))));
// }
// listmap.append(map);
// }
// return listmap;
//}
//QList<QHash <QString,QVariant> > EntityManager::findAll(QString tblname) {
// QSqlQuery q =this->db->getQuery("SELECT * FROM " + tblname + ";");
//QList<QHash <QString, QVariant> > EntityManager::findAll(QString tblname) {
// QSqlQuery q = this->db->getQuery("SELECT * FROM " + tblname + ";");
// return this->convertQueryResult(q);
//}
//bool EntityManager::merge(Entity *entity) {
// if(this->count(entity) == 0 && entity->getId() != -1) {
// QSqlQuery q = this->db->getQuery("UPDATE " + entity->getTablename() + " SET " +this->attributes(entity->getAttributeValues()) + " WHERE id=:idM;");
// this->bindValues(entity->getAttributeValues(),q);
// q.bindValue(":idM",entity->getId());
// if (this->count(entity) == 0 && entity->getId() != -1) {
// QSqlQuery q = this->db->getQuery("UPDATE " + entity->getTablename() + " SET " + this->attributes(
// entity->getAttributeValues()) + " WHERE id=:idM;");
// this->bindValues(entity->getAttributeValues(), q);
// q.bindValue(":idM", entity->getId());
// return this->db->transaction(q);
// } else {
// return false;
......
//qint64 EntityManager::findId(Entity *entity) {
// qint64 r = -1;
// QSqlQuery q = this->db->getQuery("SELECT id FROM " + entity->getTablename() + this->where(entity->getAttributeValues(),"AND",true) + " LIMIT 1");
// this->bindValues(entity->getAttributeValues(),q);
// QSqlQuery q = this->db->getQuery("SELECT id FROM " + entity->getTablename() + this->where(entity->getAttributeValues(),
// "AND", true) + " LIMIT 1");
// this->bindValues(entity->getAttributeValues(), q);
// this->db->select(q);
// if(q.next()) {
// if (q.next()) {
// r = q.value(0).toInt();
// }
// return r;
......
//QString EntityManager::attributes(QHash<QString, QVariant> *m, QString conjunction, bool ignoreID) {
// QString rc = "";
// if(!m->isEmpty()) {
// if (!m->isEmpty()) {
// QHash<QString, QVariant>::const_iterator i = m->constBegin();
// while(i != m->constEnd()) {
// if(!ignoreID || (ignoreID && !(i.key() == "id"))) {
// if(!(rc == "")) {
// while (i != m->constEnd()) {
// if (!ignoreID || (ignoreID && !(i.key() == "id"))) {
// if (!(rc == "")) {
// rc += " " + conjunction + " ";
// }
// rc += i.key() + "= :" +i.key();
// rc += i.key() + "= :" + i.key();
// }
// ++i;
// }
......
//QString EntityManager::where(QHash<QString, QVariant> *m, QString conjunction, bool ignoreID) {
// if(m->size() == 0 || (ignoreID && m->contains("id") && m->size() == 1)) {
// if (m->size() == 0 || (ignoreID && m->contains("id") && m->size() == 1)) {
// return "";
// }
// return " WHERE " + this->attributes(m,conjunction,ignoreID);
// return " WHERE " + this->attributes(m, conjunction, ignoreID);
//}
//QString EntityManager::where(Entity *entity, QString conjunction, bool ignoreID) {
// return this->where(entity->getAttributeValues(),conjunction,ignoreID);
// return this->where(entity->getAttributeValues(), conjunction, ignoreID);
//}
//QList<QHash <QString,QVariant> > EntityManager::findByAttributes(Entity *entity, bool ignoreID) {
// return this->findByAttributes(entity->getAttributeValues(), entity->getTablename(),ignoreID);
//QList<QHash <QString, QVariant> > EntityManager::findByAttributes(Entity *entity, bool ignoreID) {
// return this->findByAttributes(entity->getAttributeValues(), entity->getTablename(), ignoreID);
//}
//bool EntityManager::save(Entity *entity) {
// if(entity->getId() > -1) {
// if (entity->getId() > -1) {
// return this->merge(entity);
// } else {
// return this->create(entity);
......
//bool EntityManager::remove(Entity *&entity) {
// bool rc = false;
// QSqlQuery q = this->db->getQuery("DELETE FROM " + entity->getTablename() + " WHERE id= :id;");
// q.bindValue(":id",entity->getId());
// if(this->db->transaction(q)) {
// q.bindValue(":id", entity->getId());
// if (this->db->transaction(q)) {
// delete entity;
// entity = 0;
// rc = true;
......
// s.append(c).append(entity->getTablename()).append(c).append("(");
// QHash<QString, QString>::const_iterator i = m.constBegin();
// while (i != m.constEnd()) {
// if(first) {
// if (first) {
// first = false;
// } else {
// s.append(',');
......
//bool EntityManager::createTable(Entity *entity) {
// bool rc = false;
// this->db->containsTable(entity->getTablename()) ? rc = true : rc = false;
// if(!rc) {
// if (!rc) {
// QSqlQuery q = this->db->getQuery(this->createTableQuery(entity));
// if(this->db->transaction(q)) {
// if (this->db->transaction(q)) {
// this->db->refreshTableList();
// rc = true;
// }
src/entitymanager.h
#include <QString>
#include <QStringList>
#include <QDebug>
#include "schema.h"
#include <QtSql/QSqlError>
#include "entity.h"
#include "database.h"
......
class EntityManager {
private:
static QStringList connectionNames;
QSharedPointer<Schema> schema;
static void setConnectionNames(QStringList list);
Database *db;
QSharedPointer<Database> db;
QString createConnection();
QString createTableQuery(Entity *entity);
QString attributes(QHash<QString, QVariant> *m, QString conjunction = ",", bool ignoreID = false);
......
bool removeAll(QString tblname);
bool createTable(Entity *entity);
qint8 count(Entity *entity, bool ignoreID = true);
QSharedPointer<Database> getDb() const;
void setDb(const QSharedPointer<Database> &value);
QSharedPointer<Schema> getSchema() const;
void setSchema(const QSharedPointer<Schema> &value);
};
}
#endif // ENTITYMANAGER_H
src/enums/databasetype.h
#include "../schema/sqliteschema.h"
namespace CuteEntityManager {
class Schema;
class Database;
enum DatabaseType {
SQLITE = 0,
......
MYSQL = 2
};
static const DatabaseType getDatabaseType(QString s) {
static DatabaseType getDatabaseType(QString s) {
if (s == "qmysql") {
return CuteEntityManager::MYSQL;
return DatabaseType::MYSQL;
} else if (s == "qpgsql") {
return CuteEntityManager::PGSQL;
return DatabaseType::PGSQL;
} else {
return CuteEntityManager::SQLITE;
return DatabaseType::SQLITE;
}
}
static const QSharedPointer<Schema> getSchema(int db, QSharedPointer<Database> database) {
static QSharedPointer<Schema> getSchema(int db, QSharedPointer<Database> database) {
switch (db) {
case SQLITE:
return QSharedPointer<Schema>(new SqliteSchema(database));;
src/schema.h
virtual QStringList getTableNames(QString schema = "");
//virtual QueryBuilder getQueryBuilder();
//virtual QueryBuilder createQueryBuilder();
virtual QStringList findUniqueIndexes(TableSchema schema);
virtual QVariant getLastInsertID();
virtual void refresh();
virtual QString getRawTable(QString name);
src/schema/sqliteschema.cpp
}
QHash<QString, QString> *SqliteSchema::getTypeMap() {
/**
this->typeMap.data()->insert("bool", "SMALLINT");
this->typeMap.data()->insert("short", "SMALLINT");
this->typeMap.data()->insert("int", "INTEGER");
this->typeMap.data()->insert("long", "INTEGER");
this->typeMap.data()->insert("long long", "INTEGER");
this->typeMap.data()->insert("float", "FLOAT");
this->typeMap.data()->insert("double", "FLOAT");
this->typeMap.data()->insert("long double", "FLOAT");
this->typeMap.data()->insert("unsigned short", "SMALLINT");
this->typeMap.data()->insert("unsigned int", "INTEGER");
this->typeMap.data()->insert("unsigned long", "INTEGER");
this->typeMap.data()->insert("unsigned long long", "INTEGER");
this->typeMap.data()->insert("std::string", "TEXT");
this->typeMap.data()->insert("std::wstring", "TEXT");
this->typeMap.data()->insert("QString", "TEXT");
this->typeMap.data()->insert("QVariant", "TEXT");
this->typeMap.data()->insert("QUuid", "TEXT");
this->typeMap.data()->insert("QDate", "DATE");
this->typeMap.data()->insert("QTime", "TIME");
this->typeMap.data()->insert("QDateTime", "TIMESTAMP");
this->typeMap.data()->insert("QByteArray", "BLOB");
*/
if (this->typeMap.data()->empty()) {
this->typeMap.data()->insert(TYPE_SMALLINT, "tinyint");
this->typeMap.data()->insert(TYPE_BOOLEAN, "boolean");

Auch abrufbar als: Unified diff