Sha256: 0976bf7b516c947b84b06636f811b04d6ba459e85a705ee95e6e4d37fd352dde

Contents?: true

Size: 824 Bytes

Versions: 9

Compression:

Stored size: 824 Bytes

Contents

class Knjappserver::Session < Knj::Datarow
	attr_reader :edata
	attr_accessor :sess_data
	
	def initialize(d)
		@edata = {}
		super(d)
		
		if self[:sess_data].to_s.length > 0
			begin
				@sess_data = Marshal.load(Base64.decode64(self[:sess_data]))
			rescue ArgumentError
				@sess_data = {}
			end
		else
			@sess_data = {}
		end
	end
	
	def self.list(d)
		sql = "SELECT * FROM #{table} WHERE 1=1"
		
		ret = list_helper(d)
		d.args.each do |key, val|
			raise "Invalid key: #{key}."
		end
		
		sql += ret[:sql_where]
		sql += ret[:sql_order]
		sql += ret[:sql_limit]
		
		return d.ob.list_bysql(:Session, sql)
	end
	
	def self.add(d)
		d.data[:date_added] = Knj::Datet.new.dbstr if !d.data[:date_added]
	end
	
	def flush
    m_newdata = Base64.encode64(Marshal.dump(@sess_data))
    self[:sess_data] = m_newdata
	end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
knjappserver-0.0.15 lib/include/class_session.rb
knjappserver-0.0.14 lib/include/class_session.rb
knjappserver-0.0.13 lib/include/class_session.rb
knjappserver-0.0.12 lib/include/class_session.rb
knjappserver-0.0.11 lib/include/class_session.rb
knjappserver-0.0.10 lib/include/class_session.rb
knjappserver-0.0.9 lib/include/class_session.rb
knjappserver-0.0.8 lib/include/class_session.rb
knjappserver-0.0.6 lib/include/class_session.rb