summaryrefslogtreecommitdiff
path: root/misc/freeswitch/scripts/common
diff options
context:
space:
mode:
authorPeter Kozak <spag@golwen.net>2013-03-23 18:16:28 +0100
committerPeter Kozak <spag@golwen.net>2013-03-23 18:16:28 +0100
commit6d321805cfb14cd0ce58ca2fc641b82e5928b2ef (patch)
tree1c0b999b7df26e9bb427d0b72a0b41987a54d6e2 /misc/freeswitch/scripts/common
parentc60844ed7d0cbc2c1fa417e41d0c7be90adf68cd (diff)
query methods added
Diffstat (limited to 'misc/freeswitch/scripts/common')
-rw-r--r--misc/freeswitch/scripts/common/database.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/misc/freeswitch/scripts/common/database.lua b/misc/freeswitch/scripts/common/database.lua
index 8aed1ac..be32ad7 100644
--- a/misc/freeswitch/scripts/common/database.lua
+++ b/misc/freeswitch/scripts/common/database.lua
@@ -67,6 +67,29 @@ function Database.query_return_value(self, sql_query)
end
+function Database.query_return_first(self, sql_query)
+ local result = nil;
+
+ self.conn:query(sql_query, function(row)
+ result = row;
+ return result;
+ end);
+
+ return result;
+end
+
+
+function Database.query_return_all(self, sql_query)
+ local result = {};
+
+ self.conn:query(sql_query, function(row)
+ table.insert(result, row);
+ end);
+
+ return result;
+end
+
+
function Database.last_insert_id(self)
return self:query_return_value('SELECT LAST_INSERT_ID()');
end