rt_sphinx 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rt_sphinx/query.rb +4 -4
- data/rt_sphinx.gemspec +1 -1
- metadata +1 -1
data/lib/rt_sphinx/query.rb
CHANGED
@@ -7,15 +7,15 @@ module RtSphinx
|
|
7
7
|
@connection = RtSphinx::Connection.instance
|
8
8
|
end
|
9
9
|
|
10
|
-
def select(
|
11
|
-
select_sql = "SELECT * FROM
|
10
|
+
def select(clause)
|
11
|
+
select_sql = "SELECT * FROM rt_logs WHERE #{clause}"
|
12
12
|
@connection.execute_sql(select_sql, 'select')
|
13
13
|
end
|
14
14
|
|
15
|
-
def insert(
|
15
|
+
def insert(*values)
|
16
16
|
item_id = rand(10_000)*rand(9_888)
|
17
17
|
values_str = values.map{|v| "'#{v}'"}.join(', ')
|
18
|
-
insert_sql = "INSERT INTO
|
18
|
+
insert_sql = "INSERT INTO rt_logs (id, timestamp, message, logjson) VALUES (#{item_id}, #{values_str})"
|
19
19
|
@connection.execute_sql(insert_sql, 'insert')
|
20
20
|
end
|
21
21
|
end
|
data/rt_sphinx.gemspec
CHANGED