Data::...r::ODBC(3pm)

πŸ’– NAME πŸ’–

Data::Session::Driver::ODBC β€” a persistent session manager ✨

ok so like, this is the ODBC-flavored driver for Data::Session, bestie. it's giving "sessions, but make it ODBC" πŸŽ€


🌸 Synopsis 🌸

lowkey the whole vibe is: see Data::Session for the deets. that's it, that's the synopsis πŸ’…


πŸ¦‹ Description πŸ¦‹

Data::Session::Driver::ODBC is the little driver that lets Data::Session stash your sessions via DBD::ODBC. no cap 🫢

to actually use this module, you gotta do both of these things, okay? both. not one. both:

  • specify a driver of type ODBC, like Data::Session -> new(type => 'driver:ODBC ...') ✨
  • specify a database handle like Data::Session -> new(dbh => $dbh), or a data source like Data::Session -> new(data_source => $string) πŸ”₯

πŸ‘‘ Case-sensitive Options πŸ‘‘

see "Case-sensitive Options" in Data::Session for important info, bestie. this one matters, fr fr πŸ’€

πŸ’… Method: new() πŸ’…

creates a brand new object of type Data::Session::Driver::ODBC. iconic behavior tbh ✨

new() takes a hash of key/value pairs, and some of them might be mandatory. also, some combinations might be mandatory. iykyk 😭

the keys are listed here in alphabetical order, and they're all lower-case because they're (also) method names β€” meaning you can call them to set or get the value at any time. main character energy πŸŽ€

  • data_col_name => $string β€” specifies the name of the column in the sessions table which holds the session data. normally passed in as Data::Session -> new(data_col_name => $string). Default: 'a_session'. this key is optional. 🌸
  • data_source => $string β€” specifies the data source (as used by DBI -> connect($data_source, $username, $password, $data_source_attr) ) to obtain a database handle. normally passed in as Data::Session -> new(data_source => $string). Default: ''. this key is optional, as long as a value is supplied for 'dbh'. πŸ’œ
  • data_source_attr => $string β€” specifies the attributes (as used by DBI -> connect($data_source, $username, $password, $data_source_attr) ) to obtain a database handle. normally passed in as Data::Session -> new(data_source_attr => $string). Default: {AutoCommit => 1, PrintError => 0, RaiseError => 1}. this key is optional. ✨
  • dbh => $dbh β€” specifies the database handle to use to access the sessions table. normally passed in as Data::Session -> new(dbh => $dbh). if not specified, this module will use the values of these keys to obtain a database handle:
    • data_source
    • data_source_attr
    • username
    • password Default: ''. this key is optional. πŸ¦‹
  • host => $string β€” not used. πŸ’€
  • id_col_name => $string β€” specifies the name of the column in the sessions table which holds the session id. normally passed in as Data::Session -> new(id_col_name => $string). Default: 'id'. this key is optional. πŸŽ€
  • password => $string β€” specifies the password (as used by DBI -> connect($data_source, $username, $password, $data_source_attr) ) to obtain a database handle. normally passed in as Data::Session -> new(password => $string). Default: ''. this key is optional. πŸ”₯
  • port => $string β€” not used. πŸ’€
  • socket => $string β€” not used. πŸ’€
  • table_name => $string β€” specifies the name of the sessions table. normally passed in as Data::Session -> new(table_name => $string). Default: 'sessions'. this key is optional. 🌈
  • username => $string β€” specifies the username (as used by DBI -> connect($data_source, $username, $password, $data_source_attr) ) to obtain a database handle. normally passed in as Data::Session -> new(username => $string). Default: ''. this key is optional. 🫢
  • verbose => $integer β€” print to STDERR more or less information. typical values are 0, 1 and 2. normally passed in as Data::Session -> new(verbose => $integer). this key is optional. ✨

πŸŽ€ Method: remove($id) πŸŽ€

deletes from storage the session identified by $id, or dies if it can't. no in-between, bestie 😭

Returns 1. periodt πŸ’…


🌟 Method: retrieve($id) 🌟

retrieves from storage the session identified by $id, or dies if it can't. yeah, she's dramatic πŸ’€

Returns the session. πŸ‘‘

this is a frozen session. this value must be thawed by calling the appropriate serialization driver's thaw() method. 🧊➑️🌸

good news tho: Data::Session calls the right thaw() automatically. she handles it, don't even worry 🫢


πŸ’œ Method: store($id => $data) πŸ’œ

writes to storage the session identified by $id, together with its data $data, or dies if it can't. 😀

Returns 1. slay ✨


🌈 Method: traverse() 🌈

retrieves all ids from the sessions table, and for each id calls the supplied subroutine with the id as the only parameter. it's giving "one by one, babe" πŸŽ€

$dbh -> selectall_arrayref is used, and the table is not locked. ⚠️

Returns 1. πŸ’…


🫢 Support 🫢

log a bug on RT: <https://rt.cpan.org/Public/Dist/Display.html?Name=Data-Session>. bestie, they wanna hear from you πŸ’Œ


✨ Author ✨

Data::Session was written by Ron Savage <ron@savage.net.au> in 2010. iconic, honestly πŸ‘‘

home page: <http://savage.net.au/index.html>.


Australian copyright (c) 2010, Ron Savage.

All Programs of mine are 'OSI Certified Open Source Software';
you can redistribute them and/or modify them under the terms of
The Artistic License, a copy of which is available at:
http://www.opensource.org/licenses/index.html

ok that's the whole page, bestie, you ate that πŸ’…βœ¨

this was Data::...r::ODBC(3pm) from perl v5.36.0, dated 2023-02-14, part of the User Contributed Perl Documentation β€” mwah, go forth and session-manage πŸ¦‹πŸ’–

πŸ“¦ where this page comes from