Removing copy&paste code, part 2
[framework/web/wrt-commons.git] / modules / db / include / dpl / db / orm.h
index 64c0705..0d851a6 100644 (file)
@@ -632,6 +632,29 @@ public:
     }
 };
 
+namespace {
+class BindVisitor {
+private:
+    DataCommand *m_command;
+public:
+    ArgumentIndex m_bindArgumentIndex;
+
+    BindVisitor(DataCommand *command) :
+        m_command(command),
+        m_bindArgumentIndex(1)
+    {}
+
+    template<typename ColumnType>
+    void Visit(const char*, const ColumnType& value, bool isSet)
+    {
+        if ( isSet )
+        {
+            DataCommandUtils::BindArgument(m_command, m_bindArgumentIndex, value);
+            m_bindArgumentIndex++;
+        }
+    }
+};
+} //anonymous namespace
 template<typename TableDefinition>
 class __attribute__ ((visibility("hidden"))) Insert : public Query<TableDefinition>
 {
@@ -689,27 +712,6 @@ protected:
         }
     }
 
-    class BindVisitor {
-    private:
-        DataCommand *m_command;
-        ArgumentIndex m_bindArgumentIndex;
-    public:
-        BindVisitor(DataCommand *command) :
-            m_command(command),
-            m_bindArgumentIndex(1)
-        {}
-
-        template<typename ColumnType>
-        void Visit(const char*, const ColumnType& value, bool isSet)
-        {
-            if ( isSet )
-            {
-                DataCommandUtils::BindArgument(m_command, m_bindArgumentIndex, value);
-                m_bindArgumentIndex++;
-            }
-        }
-    };
-
     void Bind()
     {
         BindVisitor visitor(this->m_command);
@@ -999,29 +1001,6 @@ protected:
         }
     }
 
-    class BindVisitor {
-    private:
-        DataCommand *m_command;
-
-    public:
-        ArgumentIndex m_bindArgumentIndex;
-
-        BindVisitor(DataCommand *command) :
-            m_command(command),
-            m_bindArgumentIndex(1)
-        {}
-
-        template<typename ColumnType>
-        void Visit(const char*, const ColumnType& value, bool isSet)
-        {
-            if ( isSet )
-            {
-                DataCommandUtils::BindArgument(m_command, m_bindArgumentIndex, value);
-                m_bindArgumentIndex++;
-            }
-        }
-    };
-
     void Bind()
     {
         BindVisitor visitor(this->m_command);