lib/include/class_log.rb in knjappserver-0.0.21 vs lib/include/class_log.rb in knjappserver-0.0.22
- old
+ new
@@ -16,17 +16,20 @@
Log_link.object_class_value_id = '#{d.db.esc(data_val.id)}' AND
Log_link.object_id = '#{d.db.esc(d.args["object_lookup"].id)}'
"
end
+ return_sql = false
sql << " WHERE 1=1"
ret = list_helper(d)
d.args.each do |key, val|
case key
when "object_lookup"
sql << " AND Log_link.id IS NOT NULL"
+ when "return_sql"
+ return_sql = true
when "tag"
data_val = d.ob.get_by(:Log_data_value, {"value" => val})
if !data_val
sql << " AND false"
else
@@ -38,9 +41,11 @@
end
sql << ret[:sql_where]
sql << ret[:sql_order]
sql << ret[:sql_limit]
+
+ return sql if return_sql
return d.ob.list_bysql(:Log, sql, &block)
end
def self.add(d)
\ No newline at end of file