Sha256: c5bb200f4c6d09566548cd793da855275117da38882022ff365a037a49b565a8

Contents?: true

Size: 816 Bytes

Versions: 24

Compression:

Stored size: 816 Bytes

Contents

class Hayabusa::Models::Log_data < Knj::Datarow
  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
  
  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
  
  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
  
  def links(args = {})
    return ob.list(:Log_data_link, {"data" => self}.merge(args))
  end
end

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
hayabusa-0.0.28 lib/models/log_data.rb
hayabusa-0.0.25 lib/models/log_data.rb
hayabusa-0.0.24 lib/models/log_data.rb
hayabusa-0.0.23 lib/models/log_data.rb
hayabusa-0.0.22 lib/models/log_data.rb
hayabusa-0.0.20 lib/models/log_data.rb
hayabusa-0.0.19 lib/models/log_data.rb
hayabusa-0.0.18 lib/models/log_data.rb
hayabusa-0.0.17 lib/models/log_data.rb
hayabusa-0.0.16 lib/models/log_data.rb
hayabusa-0.0.15 lib/models/log_data.rb
hayabusa-0.0.14 lib/models/log_data.rb
hayabusa-0.0.13 lib/models/log_data.rb
hayabusa-0.0.12 lib/models/log_data.rb
hayabusa-0.0.11 lib/models/log_data.rb
hayabusa-0.0.10 lib/models/log_data.rb
hayabusa-0.0.9 lib/models/log_data.rb
hayabusa-0.0.8 lib/models/log_data.rb
hayabusa-0.0.6 lib/models/log_data.rb
hayabusa-0.0.5 lib/models/log_data.rb