Class: Knjappserver::Log_data

Inherits:
Knj::Datarow
  • Object
show all
Defined in:
lib/include/class_log_data.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.by_id_hash(d, id_hash) ⇒ Object



18
19
20
21
22
# File 'lib/include/class_log_data.rb', line 18

def self.by_id_hash(d, id_hash)
   data = d.db.query("SELECT * FROM Log_data WHERE id_hash = '#{d.db.esc(id_hash)}' LIMIT 1").fetch
   return data[:id].to_i if data
   return false
end

.force(d, id_hash) ⇒ Object



2
3
4
5
6
7
8
9
10
# File 'lib/include/class_log_data.rb', line 2

def self.force(d, id_hash)
	data_obj = d.ob.get_by(:Log_data, {"id_hash" => id_hash})
	
	if !data_obj
		data_obj = d.ob.add(:Log_data, {"id_hash" => id_hash})
	end
	
	return data_obj
end

.force_id(d, id_hash) ⇒ Object



12
13
14
15
16
# File 'lib/include/class_log_data.rb', line 12

def self.force_id(d, id_hash)
   data = d.db.query("SELECT * FROM Log_data WHERE id_hash = '#{d.db.esc(id_hash)}' LIMIT 1").fetch
   return data[:id].to_i if data
   return d.db.insert(:Log_data, {:id_hash => id_hash}, {:return_id => true}).to_i
end

Instance Method Details



24
25
26
# File 'lib/include/class_log_data.rb', line 24

def links(args = {})
	return ob.list(:Log_data_link, {"data" => self}.merge(args))
end