| 49 | | # Compatibility with tables using sessid instead of session_id. |
|---|
| 50 | | def setup_sessid_compatibility! |
|---|
| 51 | | if !@sessid_compatibility_checked |
|---|
| | 49 | def marshal(data) Base64.encode64(Marshal.dump(data)) end |
|---|
| | 50 | def unmarshal(data) Marshal.load(Base64.decode64(data)) end |
|---|
| | 51 | def fingerprint(data) Digest::MD5.hexdigest(data) end |
|---|
| | 52 | |
|---|
| | 53 | def create_table! |
|---|
| | 54 | connection.execute <<-end_sql |
|---|
| | 55 | CREATE TABLE #{table_name} ( |
|---|
| | 56 | id INTEGER PRIMARY KEY, |
|---|
| | 57 | #{connection.quote_column_name('session_id')} TEXT UNIQUE, |
|---|
| | 58 | #{connection.quote_column_name('data')} TEXT |
|---|
| | 59 | ) |
|---|
| | 60 | end_sql |
|---|
| | 61 | end |
|---|
| | 62 | |
|---|
| | 63 | def drop_table! |
|---|
| | 64 | connection.execute "DROP TABLE #{table_name}" |
|---|
| | 65 | end |
|---|
| | 66 | |
|---|
| | 67 | private |
|---|
| | 68 | # Compatibility with tables using sessid instead of session_id. |
|---|
| | 69 | def setup_sessid_compatibility! |
|---|
| | 70 | # Reset column info since it may be stale. |
|---|
| | 71 | reset_column_information |
|---|
| 65 | | @sessid_compatibility_checked = true |
|---|
| 66 | | end |
|---|
| 67 | | end |
|---|
| 68 | | |
|---|
| 69 | | def marshal(data) Base64.encode64(Marshal.dump(data)) end |
|---|
| 70 | | def unmarshal(data) Marshal.load(Base64.decode64(data)) end |
|---|
| 71 | | def fingerprint(data) Digest::MD5.hexdigest(data) end |
|---|
| 72 | | |
|---|
| 73 | | def create_table! |
|---|
| 74 | | connection.execute <<-end_sql |
|---|
| 75 | | CREATE TABLE #{table_name} ( |
|---|
| 76 | | id INTEGER PRIMARY KEY, |
|---|
| 77 | | #{connection.quote_column_name('session_id')} TEXT UNIQUE, |
|---|
| 78 | | #{connection.quote_column_name('data')} TEXT |
|---|
| 79 | | ) |
|---|
| 80 | | end_sql |
|---|
| 81 | | end |
|---|
| 82 | | |
|---|
| 83 | | def drop_table! |
|---|
| 84 | | connection.execute "DROP TABLE #{table_name}" |
|---|
| 85 | | end |
|---|
| | 84 | end |
|---|