|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r78467 - in sandbox/icl/libs/xplore/br1/sqlbrowser: . Dag
From: afojgo_at_[hidden]
Date: 2012-05-14 03:14:02
Author: jofaber
Date: 2012-05-14 03:14:00 EDT (Mon, 14 May 2012)
New Revision: 78467
URL: http://svn.boost.org/trac/boost/changeset/78467
Log:
Layer started for data access.
Added:
sandbox/icl/libs/xplore/br1/sqlbrowser/Dag/TypeGraph.cpp (contents, props changed)
Text files modified:
sandbox/icl/libs/xplore/br1/sqlbrowser/Dag/TypeGraph.h | 28 ++++++++++++++++++++++++++--
sandbox/icl/libs/xplore/br1/sqlbrowser/sqlbrowser4.pro | 4 ++--
2 files changed, 28 insertions(+), 4 deletions(-)
Added: sandbox/icl/libs/xplore/br1/sqlbrowser/Dag/TypeGraph.cpp
==============================================================================
--- (empty file)
+++ sandbox/icl/libs/xplore/br1/sqlbrowser/Dag/TypeGraph.cpp 2012-05-14 03:14:00 EDT (Mon, 14 May 2012)
@@ -0,0 +1,81 @@
+#include "Dag/TypeGraph.h"
+
+#include <QSqlQuery.h>
+
+
+using namespace dag::db;
+
+void dag::db::getTypeGraph(TypeGraph& tygr, TypeGraphAccessor& accessor)
+{
+ accessor.prepareGet();
+
+ while(accessor.next())
+ tygr.add(accessor.record());
+}
+
+//!
+void dag::db::getTypeGraph(TypeGraph& tygr, Persistor<TypeEdge>& persitor)
+{
+ RecIterator it = persitor.prepareGet();
+
+ while(it != persitor.end())
+ tygr.add(Creator<Persistor<TypeEdge> >::create(it++));
+}
+
+//!
+void dag::db::getTypeGraph(TypeGraph& tygr, Persistor<TypeEdge>& persitor)
+{
+ persitor.prepareGet();
+
+ while(it != persitor.end())
+ tygr.add(Creator<Persistor<TypeEdge> >::create(it++));
+}
+
+
+template<class Object, class Access>
+class Persistor
+{
+public:
+ iterator prepareGet()
+ {
+ // Make a query
+ return Access::makeQuery(m_resultSet);
+ }
+
+ iterator begin()
+ {
+ return m_resultSet.begin();
+ }
+
+ iterator end()
+ {
+ return m_resultSet.end();
+ }
+
+ Object create(iterator it)
+ {
+ return Access::create(it);
+ }
+
+private:
+ Access::ResultSet m_resultSet;
+};
+
+
+
+struct SqlAccess
+{
+ template<class Object> //Iterierbarere Container
+ static inline iterator makeQuery(SqlAccess::Set resultSet)
+ {
+ tString sql = SqlAccess<Object>::makeSql();
+ // Query abschicken.
+ // Results
+ };
+
+ template<class Object>
+ static Object create(iterator it)
+ {
+ ;
+ }
+};
Modified: sandbox/icl/libs/xplore/br1/sqlbrowser/Dag/TypeGraph.h
==============================================================================
--- sandbox/icl/libs/xplore/br1/sqlbrowser/Dag/TypeGraph.h (original)
+++ sandbox/icl/libs/xplore/br1/sqlbrowser/Dag/TypeGraph.h 2012-05-14 03:14:00 EDT (Mon, 14 May 2012)
@@ -10,7 +10,9 @@
#include "Dag/DbType.h"
-namespace dag
+class QSqlQuery;
+
+namespace dag namespace db {
{
@@ -32,5 +34,27 @@
};
-} // dag
+void getTypeGraph(TypeGraph& tygr, const QSqlQuery& query);
+
+//! Data Access layer. May be sql, xml etc.
+class TypeGraphSqlAccessor // implements DataAccessor
+{
+public:
+ // The DataAccessor interface (generic)
+ bool prepareGet();
+ bool next();
+
+ // Interface specific to TypeGraph
+ EdgeType edge();
+
+private:
+ static tString s_aTypeEdgesQuery;
+ static bool m_bInitialized;
+
+ int m_Edge_Key_Idx;
+ int m_Object_Key_Idx;
+};
+
+
+}} // dag::db
Modified: sandbox/icl/libs/xplore/br1/sqlbrowser/sqlbrowser4.pro
==============================================================================
--- sandbox/icl/libs/xplore/br1/sqlbrowser/sqlbrowser4.pro (original)
+++ sandbox/icl/libs/xplore/br1/sqlbrowser/sqlbrowser4.pro 2012-05-14 03:14:00 EDT (Mon, 14 May 2012)
@@ -3,8 +3,8 @@
QT += sql
-#INCLUDEPATH += /cygwin/home/jofa/dev/boost/branches/release
-INCLUDEPATH += C:\NIBuild\3rdparty\boost-1.48.0
+INCLUDEPATH += /cygwin/home/jofa/dev/boost/branches/release
+#INCLUDEPATH += C:\NIBuild\3rdparty\boost-1.48.0
HEADERS = browser.h connectionwidget.h qsqlconnectiondialog.h \
exttableview.h \
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk