{
    "content": [
        {
            "type": "text",
            "text": "# CGI::Session::Driver::DBI (perldoc)\n\n## NAME\n\nCGI::Session::Driver::DBI - Base class for native DBI-related CGI::Session drivers\n\n## SYNOPSIS\n\nrequire CGI::Session::Driver::DBI;\n@ISA = qw( CGI::Session::Driver::DBI );\n\n## DESCRIPTION\n\nIn most cases you can create a new DBI-driven CGI::Session driver by simply creating an empty\ndriver file that inherits from CGI::Session::Driver::DBI. That's exactly what sqlite does. The\nonly reason why this class doesn't suit for a valid driver is its name isn't in lowercase. I'm\nserious!\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **STORAGE**\n- **DRIVER ARGUMENTS**\n- **LICENSING**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "CGI::Session::Driver::DBI",
        "section": "",
        "mode": "perldoc",
        "summary": "CGI::Session::Driver::DBI - Base class for native DBI-related CGI::Session drivers",
        "synopsis": "require CGI::Session::Driver::DBI;\n@ISA = qw( CGI::Session::Driver::DBI );",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 13,
                "subsections": []
            },
            {
                "name": "STORAGE",
                "lines": 40,
                "subsections": []
            },
            {
                "name": "DRIVER ARGUMENTS",
                "lines": 25,
                "subsections": []
            },
            {
                "name": "LICENSING",
                "lines": 2,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "CGI::Session::Driver::DBI - Base class for native DBI-related CGI::Session drivers\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "require CGI::Session::Driver::DBI;\n@ISA = qw( CGI::Session::Driver::DBI );\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "In most cases you can create a new DBI-driven CGI::Session driver by simply creating an empty\ndriver file that inherits from CGI::Session::Driver::DBI. That's exactly what sqlite does. The\nonly reason why this class doesn't suit for a valid driver is its name isn't in lowercase. I'm\nserious!\n\nNOTES\nCGI::Session::Driver::DBI defines init() method, which makes DBI handle available for drivers in\n*Handle* - object attribute regardless of what \"\\%dsnargs\" were used in creating session\nobject. Should your driver require non-standard initialization you have to re-define init()\nmethod in your .pm file, but make sure to set 'Handle' - object attribute to database handle\n(returned by DBI->connect(...)) if you wish to inherit any of the methods from\nCGI::Session::Driver::DBI.\n",
                "subsections": []
            },
            "STORAGE": {
                "content": "Before you can use any DBI-based session drivers you need to make sure compatible database table\nis created for CGI::Session to work with. Following command will produce minimal requirements in\nmost SQL databases:\n\nCREATE TABLE sessions (\nid CHAR(32) NOT NULL PRIMARY KEY,\nasession TEXT NOT NULL\n);\n\nYour session table can define additional columns, but the above two are required. Name of the\nsession table is expected to be *sessions* by default. You may use a different name if you wish.\nTo do this you have to pass *TableName* as part of your \" \\%dsnargs \":\n\n$s = CGI::Session->new('driver:sqlite', undef, {TableName=>'mysessions'});\n$s = CGI::Session->new('driver:mysql', undef,\n{\nTableName=>'mysessions',\nDataSource=>'dbi:mysql:shoppingcart'.\n});\n\nTo use different column names, change the 'create table' statement, and then simply do this:\n\n$s = CGI::Session->new('driver:pg', undef,\n{\nTableName=>'session',\nIdColName=>'myid',\nDataColName=>'mydata',\nDataSource=>'dbi:pg:dbname=project',\n});\n\nor\n\n$s = CGI::Session->new('driver:pg', undef,\n{\nTableName=>'session',\nIdColName=>'myid',\nDataColName=>'mydata',\nHandle=>$dbh,\n});\n",
                "subsections": []
            },
            "DRIVER ARGUMENTS": {
                "content": "Following driver arguments are supported:\n\nDataSource\nFirst argument to be passed to DBI->connect(). If the driver makes the database connection\nitself, it will also explicitly disconnect from the database when the driver object is\nDESTROYed.\n\nUser\nUser privileged to connect to the database defined in \"DataSource\".\n\nPassword\nPassword of the *User* privileged to connect to the database defined in \"DataSource\"\n\nHandle\nAn existing DBI database handle object. The handle can be created on demand by providing a\ncode reference as a argument, such as \"<sub{DBI-\"connect}>>. This way, the database\nconnection is only created if it actually needed. This can be useful when combined with a\nframework plugin like CGI::Application::Plugin::Session, which creates a CGI::Session object\non demand as well.\n\n\"Handle\" will override all the above arguments, if any present.\n\nTableName\nName of the table session data will be stored in.\n",
                "subsections": []
            },
            "LICENSING": {
                "content": "For support and licensing information see CGI::Session\n",
                "subsections": []
            }
        }
    }
}