Sha256: 18784959322a97405b7094fc18167757fa69323b1538d517347b2c6a916c164a

Contents?: true

Size: 807 Bytes

Versions: 2

Compression:

Stored size: 807 Bytes

Contents

class Hayabusa::Models::Log_data < Hayabusa::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

2 entries across 2 versions & 1 rubygems

Version Path
hayabusa-0.0.30 lib/models/log_data.rb
hayabusa-0.0.29 lib/models/log_data.rb