flush
[m6w6/pq-gateway] / lib / pq / Query / ExecutorInterface.php
diff --git a/lib/pq/Query/ExecutorInterface.php b/lib/pq/Query/ExecutorInterface.php
new file mode 100644 (file)
index 0000000..141ac23
--- /dev/null
@@ -0,0 +1,30 @@
+<?php
+
+namespace pq\Query;
+
+/**
+ * An executor of \pq\Query\Writer queries
+ */
+interface ExecutorInterface
+{
+       /**
+        * Get the connection
+        * @return \pq\Connection
+        */
+       function getConnection();
+       
+       /**
+        * Set the connection
+        * @param \pq\Connection $conn
+        * @return \pq\Query\ExecutorInterface
+        */
+       function setConnection(\pq\Connection $conn);
+       
+       /**
+        * Execute the query and return the \pq\Result through $callback
+        * @param \pq\Query\WriterInterface $query
+        * @param callable $callback
+        * @return mixed the result of the callback
+        */
+       function execute(WriterInterface $query, callable $callback);
+}