]> git.mxchange.org Git - hub.git/blobdiff - application/hub/main/database/wrapper/node/class_NodeListDatabaseWrapper.php
Introduced (currently not used as type-hints) new interfaces:
[hub.git] / application / hub / main / database / wrapper / node / class_NodeListDatabaseWrapper.php
index 5f02175068dd72ed10656c3b2ef7820e36cfb215..6d47114467f1e47fbd64e428efd9665795c2b3e6 100644 (file)
@@ -21,7 +21,7 @@
  * You should have received a copy of the GNU General Public License
  * along with this program. If not, see <http://www.gnu.org/licenses/>.
  */
-class NodeListDatabaseWrapper extends BaseDatabaseWrapper implements Registerable {
+class NodeListDatabaseWrapper extends BaseDatabaseWrapper implements NodeListWrapper Registerable {
        // Table names
        const DB_TABLE_NODE_LIST = 'node_list';
 
@@ -97,6 +97,12 @@ class NodeListDatabaseWrapper extends BaseDatabaseWrapper implements Registerabl
                                        $this->debugBackTrace('Unsupported protocol ' . $protocol . ' specified!');
                                        break;
                        } // END - switch
+
+                       // Now put both together
+                       $recipient = $recipientIp . ':' . $recipientPort;
+
+                       // Debug message
+                       $this->debugOutput('DATABASE-WRAPPER: sessionId[' . $protocol . ']=' . $sessionId . ' resolved as recipient=' . $recipient);
                } // END - if
 
                // Return result
@@ -177,6 +183,27 @@ class NodeListDatabaseWrapper extends BaseDatabaseWrapper implements Registerabl
                // Run the "INSERT" query
                $this->queryInsertDataSet($dataSetInstance);
        }
+
+       /**
+        * Updates an existing entry in node list
+        *
+        * @param       $messageData            An array of all message data
+        * @param       $handlerInstance        An instance of a HandleableMessage class
+        * @return      void
+        */
+       public function updateNodeByMessageData (array $messageData, HandleableMessage $handlerInstance) {
+               // Get a data set instance
+               $dataSetInstance = ObjectFactory::createObjectByConfiguredName('dataset_criteria_class', array(self::DB_TABLE_NODE_LIST));
+
+               // Set primary key (session id)
+               $dataSetInstance->setUniqueKey('node_' . XmlAnnouncementTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID);
+
+               // Add all array elements
+               $handlerInstance->addArrayToDataSet($dataSetInstance, $messageData);
+
+               // Run the "UPDATE" query
+               $this->queryUpdateDataSet($dataSetInstance);
+       }
 }
 
 // [EOF]