{
    "content": [
        {
            "type": "text",
            "text": "# DBI (perldoc)\n\n## NAME\n\nDBI - Database independent interface for Perl\n\n## SYNOPSIS\n\nuse DBI;\n@drivernames = DBI->availabledrivers;\n%drivers      = DBI->installeddrivers;\n@datasources = DBI->datasources($drivername, \\%attr);\n$dbh = DBI->connect($datasource, $username, $auth, \\%attr);\n$rv  = $dbh->do($statement);\n$rv  = $dbh->do($statement, \\%attr);\n$rv  = $dbh->do($statement, \\%attr, @bindvalues);\n$aryref  = $dbh->selectallarrayref($statement);\n$hashref = $dbh->selectallhashref($statement, $keyfield);\n$aryref  = $dbh->selectcolarrayref($statement);\n$aryref  = $dbh->selectcolarrayref($statement, \\%attr);\n@rowary  = $dbh->selectrowarray($statement);\n$aryref  = $dbh->selectrowarrayref($statement);\n$hashref = $dbh->selectrowhashref($statement);\n$sth = $dbh->prepare($statement);\n$sth = $dbh->preparecached($statement);\n$rc = $sth->bindparam($pnum, $bindvalue);\n$rc = $sth->bindparam($pnum, $bindvalue, $bindtype);\n$rc = $sth->bindparam($pnum, $bindvalue, \\%attr);\n$rv = $sth->execute;\n$rv = $sth->execute(@bindvalues);\n$rv = $sth->executearray(\\%attr, ...);\n$rc = $sth->bindcol($colnum, \\$colvariable);\n$rc = $sth->bindcolumns(@listofrefstovarstobind);\n@rowary  = $sth->fetchrowarray;\n$aryref  = $sth->fetchrowarrayref;\n$hashref = $sth->fetchrowhashref;\n$aryref  = $sth->fetchallarrayref;\n$aryref  = $sth->fetchallarrayref( $slice, $maxrows );\n$hashref = $sth->fetchallhashref( $keyfield );\n$rv  = $sth->rows;\n$rc  = $dbh->beginwork;\n$rc  = $dbh->commit;\n$rc  = $dbh->rollback;\n$quotedstring = $dbh->quote($string);\n$rc  = $h->err;\n$str = $h->errstr;\n$rv  = $h->state;\n$rc  = $dbh->disconnect;\n*The synopsis above only lists the major methods and parameters.*\nGETTING HELP\nGeneral\nBefore asking any questions, reread this document, consult the archives and read the DBI FAQ.\nThe archives are listed at the end of this document and on the DBI home page\n<http://dbi.perl.org/support/>\nYou might also like to read the Advanced DBI Tutorial at\n<http://www.slideshare.net/Tim.Bunce/dbi-advanced-tutorial-2007>\nTo help you make the best use of the dbi-users mailing list, and any other lists or forums you\nmay use, I recommend that you read \"Getting Answers\" by Mike Ash:\n<http://mikeash.com/gettinganswers.html>.\nMailing Lists\nIf you have questions about DBI, or DBD driver modules, you can get help from the\n*dbi-users@perl.org* mailing list. This is the best way to get help. You don't have to subscribe\nto the list in order to post, though I'd recommend it. You can get help on subscribing and using\nthe list by emailing *dbi-users-help@perl.org*.\nPlease note that Tim Bunce does not maintain the mailing lists or the web pages (generous\nvolunteers do that). So please don't send mail directly to him; he just doesn't have the time to\nanswer questions personally. The *dbi-users* mailing list has lots of experienced people who\nshould be able to help you if you need it. If you do email Tim he is very likely to just forward\nit to the mailing list.\nIRC\nDBI IRC Channel: #dbi on irc.perl.org (<irc://irc.perl.org/#dbi>)\nOnline\nStackOverflow has a DBI tag <http://stackoverflow.com/questions/tagged/dbi> with over 800\nquestions.\nThe DBI home page at <http://dbi.perl.org/> and the DBI FAQ at <http://faq.dbi-support.com/> may\nbe worth a visit. They include links to other resources, but *are rather out-dated*.\nReporting a Bug\nIf you think you've found a bug then please read \"How to Report Bugs Effectively\" by Simon\nTatham: <http://www.chiark.greenend.org.uk/~sgtatham/bugs.html>.\nIf you think you've found a memory leak then read \"Memory Leaks\".\nYour problem is most likely related to the specific DBD driver module you're using. If that's\nthe case then click on the 'Bugs' link on the <http://metacpan.org> page for your driver. Only\nsubmit a bug report against the DBI itself if you're sure that your issue isn't related to the\ndriver you're using.\nNOTES\nThis is the DBI specification that corresponds to DBI version 1.642 (see DBI::Changes for\ndetails).\nThe DBI is evolving at a steady pace, so it's good to check that you have the latest copy.\nThe significant user-visible changes in each release are documented in the DBI::Changes module\nso you can read them by executing \"perldoc DBI::Changes\".\nSome DBI changes require changes in the drivers, but the drivers can take some time to catch up.\nNewer versions of the DBI have added features that may not yet be supported by the drivers you\nuse. Talk to the authors of your drivers if you need a new feature that is not yet supported.\nFeatures added after DBI 1.21 (February 2002) are marked in the text with the version number of\nthe DBI release they first appeared in.\nExtensions to the DBI API often use the \"DBIx::*\" namespace. See \"Naming Conventions and Name\nSpace\". DBI extension modules can be found at <https://metacpan.org/search?q=DBIx>. And all\nmodules related to the DBI can be found at <https://metacpan.org/search?q=DBI>.\n\n## DESCRIPTION\n\nThe DBI is a database access module for the Perl programming language. It defines a set of\nmethods, variables, and conventions that provide a consistent database interface, independent of\nthe actual database being used.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION** (5 subsections)\n- **THE DBI PACKAGE AND CLASS** (3 subsections)\n- **METHODS COMMON TO ALL HANDLES** (1 subsections)\n- **ATTRIBUTES COMMON TO ALL HANDLES** (3 subsections)\n- **DBI DATABASE HANDLE OBJECTS** (6 subsections)\n- **DBI STATEMENT HANDLE OBJECTS** (7 subsections)\n- **FURTHER INFORMATION** (10 subsections)\n- **TRACING** (8 subsections)\n- **DBI ENVIRONMENT VARIABLES**\n- **WARNING AND ERROR MESSAGES** (1 subsections)\n- **Pure-Perl DBI**\n- **SEE ALSO** (6 subsections)\n- **AUTHORS**\n- **COPYRIGHT**\n- **SUPPORT / WARRANTY** (2 subsections)\n- **ACKNOWLEDGEMENTS**\n- **CONTRIBUTING** (4 subsections)\n- **TRANSLATIONS**\n- **OTHER RELATED WORK AND PERL MODULES**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "DBI",
        "section": "",
        "mode": "perldoc",
        "summary": "DBI - Database independent interface for Perl",
        "synopsis": "use DBI;\n@drivernames = DBI->availabledrivers;\n%drivers      = DBI->installeddrivers;\n@datasources = DBI->datasources($drivername, \\%attr);\n$dbh = DBI->connect($datasource, $username, $auth, \\%attr);\n$rv  = $dbh->do($statement);\n$rv  = $dbh->do($statement, \\%attr);\n$rv  = $dbh->do($statement, \\%attr, @bindvalues);\n$aryref  = $dbh->selectallarrayref($statement);\n$hashref = $dbh->selectallhashref($statement, $keyfield);\n$aryref  = $dbh->selectcolarrayref($statement);\n$aryref  = $dbh->selectcolarrayref($statement, \\%attr);\n@rowary  = $dbh->selectrowarray($statement);\n$aryref  = $dbh->selectrowarrayref($statement);\n$hashref = $dbh->selectrowhashref($statement);\n$sth = $dbh->prepare($statement);\n$sth = $dbh->preparecached($statement);\n$rc = $sth->bindparam($pnum, $bindvalue);\n$rc = $sth->bindparam($pnum, $bindvalue, $bindtype);\n$rc = $sth->bindparam($pnum, $bindvalue, \\%attr);\n$rv = $sth->execute;\n$rv = $sth->execute(@bindvalues);\n$rv = $sth->executearray(\\%attr, ...);\n$rc = $sth->bindcol($colnum, \\$colvariable);\n$rc = $sth->bindcolumns(@listofrefstovarstobind);\n@rowary  = $sth->fetchrowarray;\n$aryref  = $sth->fetchrowarrayref;\n$hashref = $sth->fetchrowhashref;\n$aryref  = $sth->fetchallarrayref;\n$aryref  = $sth->fetchallarrayref( $slice, $maxrows );\n$hashref = $sth->fetchallhashref( $keyfield );\n$rv  = $sth->rows;\n$rc  = $dbh->beginwork;\n$rc  = $dbh->commit;\n$rc  = $dbh->rollback;\n$quotedstring = $dbh->quote($string);\n$rc  = $h->err;\n$str = $h->errstr;\n$rv  = $h->state;\n$rc  = $dbh->disconnect;\n*The synopsis above only lists the major methods and parameters.*\nGETTING HELP\nGeneral\nBefore asking any questions, reread this document, consult the archives and read the DBI FAQ.\nThe archives are listed at the end of this document and on the DBI home page\n<http://dbi.perl.org/support/>\nYou might also like to read the Advanced DBI Tutorial at\n<http://www.slideshare.net/Tim.Bunce/dbi-advanced-tutorial-2007>\nTo help you make the best use of the dbi-users mailing list, and any other lists or forums you\nmay use, I recommend that you read \"Getting Answers\" by Mike Ash:\n<http://mikeash.com/gettinganswers.html>.\nMailing Lists\nIf you have questions about DBI, or DBD driver modules, you can get help from the\n*dbi-users@perl.org* mailing list. This is the best way to get help. You don't have to subscribe\nto the list in order to post, though I'd recommend it. You can get help on subscribing and using\nthe list by emailing *dbi-users-help@perl.org*.\nPlease note that Tim Bunce does not maintain the mailing lists or the web pages (generous\nvolunteers do that). So please don't send mail directly to him; he just doesn't have the time to\nanswer questions personally. The *dbi-users* mailing list has lots of experienced people who\nshould be able to help you if you need it. If you do email Tim he is very likely to just forward\nit to the mailing list.\nIRC\nDBI IRC Channel: #dbi on irc.perl.org (<irc://irc.perl.org/#dbi>)\nOnline\nStackOverflow has a DBI tag <http://stackoverflow.com/questions/tagged/dbi> with over 800\nquestions.\nThe DBI home page at <http://dbi.perl.org/> and the DBI FAQ at <http://faq.dbi-support.com/> may\nbe worth a visit. They include links to other resources, but *are rather out-dated*.\nReporting a Bug\nIf you think you've found a bug then please read \"How to Report Bugs Effectively\" by Simon\nTatham: <http://www.chiark.greenend.org.uk/~sgtatham/bugs.html>.\nIf you think you've found a memory leak then read \"Memory Leaks\".\nYour problem is most likely related to the specific DBD driver module you're using. If that's\nthe case then click on the 'Bugs' link on the <http://metacpan.org> page for your driver. Only\nsubmit a bug report against the DBI itself if you're sure that your issue isn't related to the\ndriver you're using.\nNOTES\nThis is the DBI specification that corresponds to DBI version 1.642 (see DBI::Changes for\ndetails).\nThe DBI is evolving at a steady pace, so it's good to check that you have the latest copy.\nThe significant user-visible changes in each release are documented in the DBI::Changes module\nso you can read them by executing \"perldoc DBI::Changes\".\nSome DBI changes require changes in the drivers, but the drivers can take some time to catch up.\nNewer versions of the DBI have added features that may not yet be supported by the drivers you\nuse. Talk to the authors of your drivers if you need a new feature that is not yet supported.\nFeatures added after DBI 1.21 (February 2002) are marked in the text with the version number of\nthe DBI release they first appeared in.\nExtensions to the DBI API often use the \"DBIx::*\" namespace. See \"Naming Conventions and Name\nSpace\". DBI extension modules can be found at <https://metacpan.org/search?q=DBIx>. And all\nmodules related to the DBI can be found at <https://metacpan.org/search?q=DBI>.",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 127,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 13,
                "subsections": [
                    {
                        "name": "Architecture of a DBI Application",
                        "lines": 23
                    },
                    {
                        "name": "Notation and Conventions",
                        "lines": 17
                    },
                    {
                        "name": "Outline Usage",
                        "lines": 121
                    },
                    {
                        "name": "Naming Conventions and Name Space",
                        "lines": 37
                    },
                    {
                        "name": "Placeholders and Bind Values",
                        "lines": 186
                    }
                ]
            },
            {
                "name": "THE DBI PACKAGE AND CLASS",
                "lines": 204,
                "subsections": [
                    {
                        "name": "connect_cached",
                        "lines": 14
                    },
                    {
                        "name": "connect_cached",
                        "lines": 63
                    },
                    {
                        "name": "data_sources",
                        "lines": 241
                    }
                ]
            },
            {
                "name": "METHODS COMMON TO ALL HANDLES",
                "lines": 14,
                "subsections": [
                    {
                        "name": "state",
                        "lines": 254
                    }
                ]
            },
            {
                "name": "ATTRIBUTES COMMON TO ALL HANDLES",
                "lines": 41,
                "subsections": [
                    {
                        "name": "execute",
                        "lines": 279
                    },
                    {
                        "name": "set_err",
                        "lines": 31
                    },
                    {
                        "name": "set_err",
                        "lines": 401
                    }
                ]
            },
            {
                "name": "DBI DATABASE HANDLE OBJECTS",
                "lines": 2,
                "subsections": [
                    {
                        "name": "Database Handle Methods",
                        "lines": 230
                    },
                    {
                        "name": "fetchall_hashref",
                        "lines": 467
                    },
                    {
                        "name": "table_info",
                        "lines": 47
                    },
                    {
                        "name": "table_info",
                        "lines": 435
                    },
                    {
                        "name": "take_imp_data",
                        "lines": 20
                    },
                    {
                        "name": "Database Handle Attributes",
                        "lines": 118
                    }
                ]
            },
            {
                "name": "DBI STATEMENT HANDLE OBJECTS",
                "lines": 2,
                "subsections": [
                    {
                        "name": "Statement Handle Methods",
                        "lines": 48
                    },
                    {
                        "name": "bind_param",
                        "lines": 152
                    },
                    {
                        "name": "execute",
                        "lines": 96
                    },
                    {
                        "name": "execute_for_fetch",
                        "lines": 117
                    },
                    {
                        "name": "max",
                        "lines": 316
                    },
                    {
                        "name": "Statement Handle Attributes",
                        "lines": 195
                    },
                    {
                        "name": "bind_param",
                        "lines": 70
                    }
                ]
            },
            {
                "name": "FURTHER INFORMATION",
                "lines": 1,
                "subsections": [
                    {
                        "name": "Catalog Methods",
                        "lines": 42
                    },
                    {
                        "name": "Transactions",
                        "lines": 65
                    },
                    {
                        "name": "Simple Examples",
                        "lines": 59
                    },
                    {
                        "name": "Threads and Thread Safety",
                        "lines": 29
                    },
                    {
                        "name": "Signal Handling and Canceling Operations",
                        "lines": 11
                    },
                    {
                        "name": "sigaction",
                        "lines": 116
                    },
                    {
                        "name": "Subclassing the DBI",
                        "lines": 46
                    },
                    {
                        "name": "connect",
                        "lines": 53
                    },
                    {
                        "name": "set_err",
                        "lines": 7
                    },
                    {
                        "name": "Memory Leaks",
                        "lines": 14
                    }
                ]
            },
            {
                "name": "TRACING",
                "lines": 3,
                "subsections": [
                    {
                        "name": "Trace Settings",
                        "lines": 11
                    },
                    {
                        "name": "Trace Levels",
                        "lines": 19
                    },
                    {
                        "name": "Trace Flags",
                        "lines": 20
                    },
                    {
                        "name": "Enabling Trace",
                        "lines": 15
                    },
                    {
                        "name": "Trace Output",
                        "lines": 16
                    },
                    {
                        "name": "Tracing to Layered Filehandles",
                        "lines": 107
                    },
                    {
                        "name": "Trace Content",
                        "lines": 4
                    },
                    {
                        "name": "Tracing Tips",
                        "lines": 15
                    }
                ]
            },
            {
                "name": "DBI ENVIRONMENT VARIABLES",
                "lines": 66,
                "subsections": []
            },
            {
                "name": "WARNING AND ERROR MESSAGES",
                "lines": 1,
                "subsections": [
                    {
                        "name": "Fatal Errors",
                        "lines": 25
                    }
                ]
            },
            {
                "name": "Pure-Perl DBI",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 1,
                "subsections": [
                    {
                        "name": "Driver and Database Documentation",
                        "lines": 30
                    },
                    {
                        "name": "Standards Reference Information",
                        "lines": 11
                    },
                    {
                        "name": "Books and Articles",
                        "lines": 9
                    },
                    {
                        "name": "Perl Modules",
                        "lines": 16
                    },
                    {
                        "name": "Mailing List",
                        "lines": 14
                    },
                    {
                        "name": "Assorted Related Links",
                        "lines": 21
                    }
                ]
            },
            {
                "name": "AUTHORS",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "SUPPORT / WARRANTY",
                "lines": 2,
                "subsections": [
                    {
                        "name": "Support",
                        "lines": 4
                    },
                    {
                        "name": "Sponsor Enhancements",
                        "lines": 7
                    }
                ]
            },
            {
                "name": "ACKNOWLEDGEMENTS",
                "lines": 27,
                "subsections": []
            },
            {
                "name": "CONTRIBUTING",
                "lines": 9,
                "subsections": [
                    {
                        "name": "Browsing the source code repository",
                        "lines": 2
                    },
                    {
                        "name": "How to create a patch using Git",
                        "lines": 33
                    },
                    {
                        "name": "How to create a patch without Git",
                        "lines": 27
                    },
                    {
                        "name": "Speak before you patch",
                        "lines": 8
                    }
                ]
            },
            {
                "name": "TRANSLATIONS",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "OTHER RELATED WORK AND PERL MODULES",
                "lines": 9,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "DBI - Database independent interface for Perl\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use DBI;\n\n@drivernames = DBI->availabledrivers;\n%drivers      = DBI->installeddrivers;\n@datasources = DBI->datasources($drivername, \\%attr);\n\n$dbh = DBI->connect($datasource, $username, $auth, \\%attr);\n\n$rv  = $dbh->do($statement);\n$rv  = $dbh->do($statement, \\%attr);\n$rv  = $dbh->do($statement, \\%attr, @bindvalues);\n\n$aryref  = $dbh->selectallarrayref($statement);\n$hashref = $dbh->selectallhashref($statement, $keyfield);\n\n$aryref  = $dbh->selectcolarrayref($statement);\n$aryref  = $dbh->selectcolarrayref($statement, \\%attr);\n\n@rowary  = $dbh->selectrowarray($statement);\n$aryref  = $dbh->selectrowarrayref($statement);\n$hashref = $dbh->selectrowhashref($statement);\n\n$sth = $dbh->prepare($statement);\n$sth = $dbh->preparecached($statement);\n\n$rc = $sth->bindparam($pnum, $bindvalue);\n$rc = $sth->bindparam($pnum, $bindvalue, $bindtype);\n$rc = $sth->bindparam($pnum, $bindvalue, \\%attr);\n\n$rv = $sth->execute;\n$rv = $sth->execute(@bindvalues);\n$rv = $sth->executearray(\\%attr, ...);\n\n$rc = $sth->bindcol($colnum, \\$colvariable);\n$rc = $sth->bindcolumns(@listofrefstovarstobind);\n\n@rowary  = $sth->fetchrowarray;\n$aryref  = $sth->fetchrowarrayref;\n$hashref = $sth->fetchrowhashref;\n\n$aryref  = $sth->fetchallarrayref;\n$aryref  = $sth->fetchallarrayref( $slice, $maxrows );\n\n$hashref = $sth->fetchallhashref( $keyfield );\n\n$rv  = $sth->rows;\n\n$rc  = $dbh->beginwork;\n$rc  = $dbh->commit;\n$rc  = $dbh->rollback;\n\n$quotedstring = $dbh->quote($string);\n\n$rc  = $h->err;\n$str = $h->errstr;\n$rv  = $h->state;\n\n$rc  = $dbh->disconnect;\n\n*The synopsis above only lists the major methods and parameters.*\n\nGETTING HELP\nGeneral\nBefore asking any questions, reread this document, consult the archives and read the DBI FAQ.\nThe archives are listed at the end of this document and on the DBI home page\n<http://dbi.perl.org/support/>\n\nYou might also like to read the Advanced DBI Tutorial at\n<http://www.slideshare.net/Tim.Bunce/dbi-advanced-tutorial-2007>\n\nTo help you make the best use of the dbi-users mailing list, and any other lists or forums you\nmay use, I recommend that you read \"Getting Answers\" by Mike Ash:\n<http://mikeash.com/gettinganswers.html>.\n\nMailing Lists\nIf you have questions about DBI, or DBD driver modules, you can get help from the\n*dbi-users@perl.org* mailing list. This is the best way to get help. You don't have to subscribe\nto the list in order to post, though I'd recommend it. You can get help on subscribing and using\nthe list by emailing *dbi-users-help@perl.org*.\n\nPlease note that Tim Bunce does not maintain the mailing lists or the web pages (generous\nvolunteers do that). So please don't send mail directly to him; he just doesn't have the time to\nanswer questions personally. The *dbi-users* mailing list has lots of experienced people who\nshould be able to help you if you need it. If you do email Tim he is very likely to just forward\nit to the mailing list.\n\nIRC\nDBI IRC Channel: #dbi on irc.perl.org (<irc://irc.perl.org/#dbi>)\n\nOnline\nStackOverflow has a DBI tag <http://stackoverflow.com/questions/tagged/dbi> with over 800\nquestions.\n\nThe DBI home page at <http://dbi.perl.org/> and the DBI FAQ at <http://faq.dbi-support.com/> may\nbe worth a visit. They include links to other resources, but *are rather out-dated*.\n\nReporting a Bug\nIf you think you've found a bug then please read \"How to Report Bugs Effectively\" by Simon\nTatham: <http://www.chiark.greenend.org.uk/~sgtatham/bugs.html>.\n\nIf you think you've found a memory leak then read \"Memory Leaks\".\n\nYour problem is most likely related to the specific DBD driver module you're using. If that's\nthe case then click on the 'Bugs' link on the <http://metacpan.org> page for your driver. Only\nsubmit a bug report against the DBI itself if you're sure that your issue isn't related to the\ndriver you're using.\n\nNOTES\nThis is the DBI specification that corresponds to DBI version 1.642 (see DBI::Changes for\ndetails).\n\nThe DBI is evolving at a steady pace, so it's good to check that you have the latest copy.\n\nThe significant user-visible changes in each release are documented in the DBI::Changes module\nso you can read them by executing \"perldoc DBI::Changes\".\n\nSome DBI changes require changes in the drivers, but the drivers can take some time to catch up.\nNewer versions of the DBI have added features that may not yet be supported by the drivers you\nuse. Talk to the authors of your drivers if you need a new feature that is not yet supported.\n\nFeatures added after DBI 1.21 (February 2002) are marked in the text with the version number of\nthe DBI release they first appeared in.\n\nExtensions to the DBI API often use the \"DBIx::*\" namespace. See \"Naming Conventions and Name\nSpace\". DBI extension modules can be found at <https://metacpan.org/search?q=DBIx>. And all\nmodules related to the DBI can be found at <https://metacpan.org/search?q=DBI>.\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "The DBI is a database access module for the Perl programming language. It defines a set of\nmethods, variables, and conventions that provide a consistent database interface, independent of\nthe actual database being used.\n\nIt is important to remember that the DBI is just an interface. The DBI is a layer of \"glue\"\nbetween an application and one or more database *driver* modules. It is the driver modules which\ndo most of the real work. The DBI provides a standard interface and framework for the drivers to\noperate within.\n\nThis document often uses terms like *references*, *objects*, *methods*. If you're not familiar\nwith those terms then it would be a good idea to read at least the following perl manuals first:\nperlreftut, perldsc, perllol, and perlboot.\n",
                "subsections": [
                    {
                        "name": "Architecture of a DBI Application",
                        "content": "|<- Scope of DBI ->|\n.-.   .--------------.   .-------------.\n.-------.       | |---| XYZ Driver   |---| XYZ Engine  |\n| Perl  |       | |   `--------------'   `-------------'\n| script|  |A|  |D|   .--------------.   .-------------.\n| using |--|P|--|B|---|Oracle Driver |---|Oracle Engine|\n| DBI   |  |I|  |I|   `--------------'   `-------------'\n| API   |       | |...\n|methods|       | |... Other drivers\n`-------'       | |...\n`-'\n\nThe API, or Application Programming Interface, defines the call interface and variables for Perl\nscripts to use. The API is implemented by the Perl DBI extension.\n\nThe DBI \"dispatches\" the method calls to the appropriate driver for actual execution. The DBI is\nalso responsible for the dynamic loading of drivers, error checking and handling, providing\ndefault implementations for methods, and many other non-database specific duties.\n\nEach driver contains implementations of the DBI methods using the private interface functions of\nthe corresponding database engine. Only authors of sophisticated/multi-database applications or\ngeneric library functions need be concerned with drivers.\n"
                    },
                    {
                        "name": "Notation and Conventions",
                        "content": "The following conventions are used in this document:\n\n$dbh    Database handle object\n$sth    Statement handle object\n$drh    Driver handle object (rarely seen or used in applications)\n$h      Any of the handle types above ($dbh, $sth, or $drh)\n$rc     General Return Code  (boolean: true=ok, false=error)\n$rv     General Return Value (typically an integer)\n@ary    List of values returned from the database, typically a row of data\n$rows   Number of rows processed (if available, else -1)\n$fh     A filehandle\nundef   NULL values are represented by undefined values in Perl\n\\%attr  Reference to a hash of attribute values passed to methods\n\nNote that Perl will automatically destroy database and statement handle objects if all\nreferences to them are deleted.\n"
                    },
                    {
                        "name": "Outline Usage",
                        "content": "To use DBI, first you need to load the DBI module:\n\nuse DBI;\nuse strict;\n\n(The \"use strict;\" isn't required but is strongly recommended.)\n\nThen you need to \"connect\" to your data source and get a *handle* for that connection:\n\n$dbh = DBI->connect($dsn, $user, $password,\n{ RaiseError => 1, AutoCommit => 0 });\n\nSince connecting can be expensive, you generally just connect at the start of your program and\ndisconnect at the end.\n\nExplicitly defining the required \"AutoCommit\" behaviour is strongly recommended and may become\nmandatory in a later version. This determines whether changes are automatically committed to the\ndatabase when executed, or need to be explicitly committed later.\n\nThe DBI allows an application to \"prepare\" statements for later execution. A prepared statement\nis identified by a statement handle held in a Perl variable. We'll call the Perl variable $sth\nin our examples.\n\nThe typical method call sequence for a \"SELECT\" statement is:\n\nprepare,\nexecute, fetch, fetch, ...\nexecute, fetch, fetch, ...\nexecute, fetch, fetch, ...\n\nfor example:\n\n$sth = $dbh->prepare(\"SELECT foo, bar FROM table WHERE baz=?\");\n\n$sth->execute( $baz );\n\nwhile ( @row = $sth->fetchrowarray ) {\nprint \"@row\\n\";\n}\n\nFor queries that are not executed many times at once, it is often cleaner to use the higher\nlevel select wrappers:\n\n$rowhashref = $dbh->selectrowhashref(\"SELECT foo, bar FROM table WHERE baz=?\", undef, $baz);\n\n$arrayrefofrowhashrefs = $dbh->selectallarrayref(\n\"SELECT foo, bar FROM table WHERE baz BETWEEN ? AND ?\",\n{ Slice => {} }, $bazmin, $bazmax);\n\nThe typical method call sequence for a *non*-\"SELECT\" statement is:\n\nprepare,\nexecute,\nexecute,\nexecute.\n\nfor example:\n\n$sth = $dbh->prepare(\"INSERT INTO table(foo,bar,baz) VALUES (?,?,?)\");\n\nwhile(<CSV>) {\nchomp;\nmy ($foo,$bar,$baz) = split /,/;\n$sth->execute( $foo, $bar, $baz );\n}\n\nThe \"do()\" method is a wrapper of prepare and execute that can be simpler for non repeated\n*non*-\"SELECT\" statements (or with drivers that don't support placeholders):\n\n$rowsaffected = $dbh->do(\"UPDATE yourtable SET foo = foo + 1\");\n\n$rowsaffected = $dbh->do(\"DELETE FROM table WHERE foo = ?\", undef, $foo);\n\nTo commit your changes to the database (when \"AutoCommit\" is off):\n\n$dbh->commit;  # or call $dbh->rollback; to undo changes\n\nFinally, when you have finished working with the data source, you should \"disconnect\" from it:\n\n$dbh->disconnect;\n\nGeneral Interface Rules & Caveats\nThe DBI does not have a concept of a \"current session\". Every session has a handle object (i.e.,\na $dbh) returned from the \"connect\" method. That handle object is used to invoke database\nrelated methods.\n\nMost data is returned to the Perl script as strings. (Null values are returned as \"undef\".) This\nallows arbitrary precision numeric data to be handled without loss of accuracy. Beware that Perl\nmay not preserve the same accuracy when the string is used as a number.\n\nDates and times are returned as character strings in the current default format of the\ncorresponding database engine. Time zone effects are database/driver dependent.\n\nPerl supports binary data in Perl strings, and the DBI will pass binary data to and from the\ndriver without change. It is up to the driver implementors to decide how they wish to handle\nsuch binary data.\n\nPerl supports two kinds of strings: Unicode (utf8 internally) and non-Unicode (defaults to\niso-8859-1 if forced to assume an encoding). Drivers should accept both kinds of strings and, if\nrequired, convert them to the character set of the database being used. Similarly, when fetching\nfrom the database character data that isn't iso-8859-1 the driver should convert it into utf8.\n\nMultiple SQL statements may not be combined in a single statement handle ($sth), although some\ndatabases and drivers do support this (notably Sybase and SQL Server).\n\nNon-sequential record reads are not supported in this version of the DBI. In other words,\nrecords can only be fetched in the order that the database returned them, and once fetched they\nare forgotten.\n\nPositioned updates and deletes are not directly supported by the DBI. See the description of the\n\"CursorName\" attribute for an alternative.\n\nIndividual driver implementors are free to provide any private functions and/or handle\nattributes that they feel are useful. Private driver functions can be invoked using the DBI\n\"func()\" method. Private driver attributes are accessed just like standard attributes.\n\nMany methods have an optional \"\\%attr\" parameter which can be used to pass information to the\ndriver implementing the method. Except where specifically documented, the \"\\%attr\" parameter can\nonly be used to pass driver specific hints. In general, you can ignore \"\\%attr\" parameters or\npass it as \"undef\".\n"
                    },
                    {
                        "name": "Naming Conventions and Name Space",
                        "content": "The DBI package and all packages below it (\"DBI::*\") are reserved for use by the DBI. Extensions\nand related modules use the \"DBIx::\" namespace (see\n<http://www.perl.com/CPAN/modules/by-module/DBIx/>). Package names beginning with \"DBD::\" are\nreserved for use by DBI database drivers. All environment variables used by the DBI or by\nindividual DBDs begin with \"\"DBI\"\" or \"\"DBD\"\".\n\nThe letter case used for attribute names is significant and plays an important part in the\nportability of DBI scripts. The case of the attribute name is used to signify who defined the\nmeaning of that name and its values.\n\nCase of name  Has a meaning defined by\n------------  ------------------------\nUPPERCASE    Standards, e.g.,  X/Open, ISO SQL92 etc (portable)\nMixedCase     DBI API (portable), underscores are not used.\nlowercase    Driver or database engine specific (non-portable)\n\nIt is of the utmost importance that Driver developers only use lowercase attribute names when\ndefining private attributes. Private attribute names must be prefixed with the driver name or\nsuitable abbreviation (e.g., \"\"ora\"\" for Oracle, \"\"ing\"\" for Ingres, etc).\n\nSQL - A Query Language\nMost DBI drivers require applications to use a dialect of SQL (Structured Query Language) to\ninteract with the database engine. The \"Standards Reference Information\" section provides links\nto useful information about SQL.\n\nThe DBI itself does not mandate or require any particular language to be used; it is language\nindependent. In ODBC terms, the DBI is in \"pass-thru\" mode, although individual drivers might\nnot be. The only requirement is that queries and other statements must be expressed as a single\nstring of characters passed as the first argument to the \"prepare\" or \"do\" methods.\n\nFor an interesting diversion on the *real* history of RDBMS and SQL, from the people who made it\nhappen, see:\n\nhttp://www.mcjones.org/SystemR/SQLReunion95/sqlr95.html\n\nFollow the \"Full Contents\" then \"Intergalactic dataspeak\" links for the SQL history.\n"
                    },
                    {
                        "name": "Placeholders and Bind Values",
                        "content": "Some drivers support placeholders and bind values. *Placeholders*, also called parameter\nmarkers, are used to indicate values in a database statement that will be supplied later, before\nthe prepared statement is executed. For example, an application might use the following to\ninsert a row of data into the SALES table:\n\nINSERT INTO sales (productcode, qty, price) VALUES (?, ?, ?)\n\nor the following, to select the description for a product:\n\nSELECT description FROM products WHERE productcode = ?\n\nThe \"?\" characters are the placeholders. The association of actual values with placeholders is\nknown as *binding*, and the values are referred to as *bind values*. Note that the \"?\" is not\nenclosed in quotation marks, even when the placeholder represents a string.\n\nSome drivers also allow placeholders like \":\"*name* and \":\"*N* (e.g., \":1\", \":2\", and so on) in\naddition to \"?\", but their use is not portable.\n\nIf the \":\"*N* form of placeholder is supported by the driver you're using, then you should be\nable to use either \"bindparam\" or \"execute\" to bind values. Check your driver documentation.\n\nSome drivers allow you to prevent the recognition of a placeholder by placing a single backslash\ncharacter (\"\\\") immediately before it. The driver will remove the backslash character and ignore\nthe placeholder, passing it unchanged to the backend. If the driver supports this then\n\"getinfo\"(9000) will return true.\n\nWith most drivers, placeholders can't be used for any element of a statement that would prevent\nthe database server from validating the statement and creating a query execution plan for it.\nFor example:\n\n\"SELECT name, age FROM ?\"         # wrong (will probably fail)\n\"SELECT name, ?   FROM people\"    # wrong (but may not 'fail')\n\nAlso, placeholders can only represent single scalar values. For example, the following statement\nwon't work as expected for more than one value:\n\n\"SELECT name, age FROM people WHERE name IN (?)\"    # wrong\n\"SELECT name, age FROM people WHERE name IN (?,?)\"  # two names\n\nWhen using placeholders with the SQL \"LIKE\" qualifier, you must remember that the placeholder\nsubstitutes for the whole string. So you should use \"\"... LIKE ? ...\"\" and include any wildcard\ncharacters in the value that you bind to the placeholder.\n\nNULL Values\n\nUndefined values, or \"undef\", are used to indicate NULL values. You can insert and update\ncolumns with a NULL value as you would a non-NULL value. These examples insert and update the\ncolumn \"age\" with a NULL value:\n\n$sth = $dbh->prepare(qq{\nINSERT INTO people (fullname, age) VALUES (?, ?)\n});\n$sth->execute(\"Joe Bloggs\", undef);\n\n$sth = $dbh->prepare(qq{\nUPDATE people SET age = ? WHERE fullname = ?\n});\n$sth->execute(undef, \"Joe Bloggs\");\n\nHowever, care must be taken when trying to use NULL values in a \"WHERE\" clause. Consider:\n\nSELECT fullname FROM people WHERE age = ?\n\nBinding an \"undef\" (NULL) to the placeholder will *not* select rows which have a NULL \"age\"! At\nleast for database engines that conform to the SQL standard. Refer to the SQL manual for your\ndatabase engine or any SQL book for the reasons for this. To explicitly select NULLs you have to\nsay \"\"WHERE age IS NULL\"\".\n\nA common issue is to have a code fragment handle a value that could be either \"defined\" or\n\"undef\" (non-NULL or NULL) at runtime. A simple technique is to prepare the appropriate\nstatement as needed, and substitute the placeholder for non-NULL cases:\n\n$sqlclause = defined $age? \"age = ?\" : \"age IS NULL\";\n$sth = $dbh->prepare(qq{\nSELECT fullname FROM people WHERE $sqlclause\n});\n$sth->execute(defined $age ? $age : ());\n\nThe following technique illustrates qualifying a \"WHERE\" clause with several columns, whose\nassociated values (\"defined\" or \"undef\") are in a hash %h:\n\nfor my $col (\"age\", \"phone\", \"email\") {\nif (defined $h{$col}) {\npush @sqlqual, \"$col = ?\";\npush @sqlbind, $h{$col};\n}\nelse {\npush @sqlqual, \"$col IS NULL\";\n}\n}\n$sqlclause = join(\" AND \", @sqlqual);\n$sth = $dbh->prepare(qq{\nSELECT fullname FROM people WHERE $sqlclause\n});\n$sth->execute(@sqlbind);\n\nThe techniques above call prepare for the SQL statement with each call to execute. Because calls\nto prepare() can be expensive, performance can suffer when an application iterates many times\nover statements like the above.\n\nA better solution is a single \"WHERE\" clause that supports both NULL and non-NULL comparisons.\nIts SQL statement would need to be prepared only once for all cases, thus improving performance.\nSeveral examples of \"WHERE\" clauses that support this are presented below. But each example\nlacks portability, robustness, or simplicity. Whether an example is supported on your database\nengine depends on what SQL extensions it provides, and where it supports the \"?\" placeholder in\na statement.\n\n0)  age = ?\n1)  NVL(age, xx) = NVL(?, xx)\n2)  ISNULL(age, xx) = ISNULL(?, xx)\n3)  DECODE(age, ?, 1, 0) = 1\n4)  age = ? OR (age IS NULL AND ? IS NULL)\n5)  age = ? OR (age IS NULL AND SPISNULL(?) = 1)\n6)  age = ? OR (age IS NULL AND ? = 1)\n\nStatements formed with the above \"WHERE\" clauses require execute statements as follows. The\narguments are required, whether their values are \"defined\" or \"undef\".\n\n0,1,2,3)  $sth->execute($age);\n4,5)      $sth->execute($age, $age);\n6)        $sth->execute($age, defined($age) ? 0 : 1);\n\nExample 0 should not work (as mentioned earlier), but may work on a few database engines anyway\n(e.g. Sybase). Example 0 is part of examples 4, 5, and 6, so if example 0 works, these other\nexamples may work, even if the engine does not properly support the right hand side of the \"OR\"\nexpression.\n\nExamples 1 and 2 are not robust: they require that you provide a valid column value xx (e.g.\n'~') which is not present in any row. That means you must have some notion of what data won't be\nstored in the column, and expect clients to adhere to that.\n\nExample 5 requires that you provide a stored procedure (SPISNULL in this example) that acts as\na function: it checks whether a value is null, and returns 1 if it is, or 0 if not.\n\nExample 6, the least simple, is probably the most portable, i.e., it should work with most, if\nnot all, database engines.\n\nHere is a table that indicates which examples above are known to work on various database\nengines:\n\n-----Examples------\n0  1  2  3  4  5  6\n-  -  -  -  -  -  -\nOracle 9         N  Y  N  Y  Y  ?  Y\nInformix IDS 9   N  N  N  Y  N  Y  Y\nMS SQL           N  N  Y  N  Y  ?  Y\nSybase           Y  N  N  N  N  N  Y\nAnyData,DBM,CSV  Y  N  N  N  Y  Y* Y\nSQLite 3.3       N  N  N  N  Y  N  N\nMSAccess         N  N  N  N  Y  N  Y\n\n* Works only because Example 0 works.\n\nDBI provides a sample perl script that will test the examples above on your database engine and\ntell you which ones work. It is located in the ex/ subdirectory of the DBI source distribution,\nor here: <https://github.com/perl5-dbi/dbi/blob/master/ex/perldbinullstest.pl> Please use the\nscript to help us fill-in and maintain this table.\n\nPerformance\n\nWithout using placeholders, the insert statement shown previously would have to contain the\nliteral values to be inserted and would have to be re-prepared and re-executed for each row.\nWith placeholders, the insert statement only needs to be prepared once. The bind values for each\nrow can be given to the \"execute\" method each time it's called. By avoiding the need to\nre-prepare the statement for each row, the application typically runs many times faster. Here's\nan example:\n\nmy $sth = $dbh->prepare(q{\nINSERT INTO sales (productcode, qty, price) VALUES (?, ?, ?)\n}) or die $dbh->errstr;\nwhile (<>) {\nchomp;\nmy ($productcode, $qty, $price) = split /,/;\n$sth->execute($productcode, $qty, $price) or die $dbh->errstr;\n}\n$dbh->commit or die $dbh->errstr;\n\nSee \"execute\" and \"bindparam\" for more details.\n\nThe \"q{...}\" style quoting used in this example avoids clashing with quotes that may be used in\nthe SQL statement. Use the double-quote like \"qq{...}\" operator if you want to interpolate\nvariables into the string. See \"Quote and Quote-like Operators\" in perlop for more details.\n\nSee also the \"bindcolumns\" method, which is used to associate Perl variables with the output\ncolumns of a \"SELECT\" statement.\n"
                    }
                ]
            },
            "THE DBI PACKAGE AND CLASS": {
                "content": "In this section, we cover the DBI class methods, utility functions, and the dynamic attributes\nassociated with generic DBI handles.\n\nDBI Constants\nConstants representing the values of the SQL standard types can be imported individually by\nname, or all together by importing the special \":sqltypes\" tag.\n\nThe names and values of all the defined SQL standard types can be produced like this:\n\nforeach (@{ $DBI::EXPORTTAGS{sqltypes} }) {\nprintf \"%s=%d\\n\", $, &{\"DBI::$\"};\n}\n\nThese constants are defined by SQL/CLI, ODBC or both. \"SQLBIGINT\" has conflicting codes in\nSQL/CLI and ODBC, DBI uses the ODBC one.\n\nSee the \"typeinfo\", \"typeinfoall\", and \"bindparam\" methods for possible uses.\n\nNote that just because the DBI defines a named constant for a given data type doesn't mean that\ndrivers will support that data type.\n\nDBI Class Methods\nThe following methods are provided by the DBI class:\n\n\"parsedsn\"\n($scheme, $driver, $attrstring, $attrhash, $driverdsn) = DBI->parsedsn($dsn)\nor die \"Can't parse DBI DSN '$dsn'\";\n\nBreaks apart a DBI Data Source Name (DSN) and returns the individual parts. If $dsn doesn't\ncontain a valid DSN then parsedsn() returns an empty list.\n\n$scheme is the first part of the DSN and is currently always 'dbi'. $driver is the driver name,\npossibly defaulted to $ENV{DBIDRIVER}, and may be undefined. $attrstring is the contents of\nthe optional attribute string, which may be undefined. If $attrstring is not empty then\n$attrhash is a reference to a hash containing the parsed attribute names and values.\n$driverdsn is the last part of the DBI DSN string. For example:\n\n($scheme, $driver, $attrstring, $attrhash, $driverdsn)\n= DBI->parsedsn(\"dbi:MyDriver(RaiseError=>1):db=test;port=42\");\n$scheme      = 'dbi';\n$driver      = 'MyDriver';\n$attrstring = 'RaiseError=>1';\n$attrhash   = { 'RaiseError' => '1' };\n$driverdsn  = 'db=test;port=42';\n\nThe parsedsn() method was added in DBI 1.43.\n\n\"connect\"\n$dbh = DBI->connect($datasource, $username, $password)\nor die $DBI::errstr;\n$dbh = DBI->connect($datasource, $username, $password, \\%attr)\nor die $DBI::errstr;\n\nEstablishes a database connection, or session, to the requested $datasource. Returns a database\nhandle object if the connection succeeds. Use \"$dbh->disconnect\" to terminate the connection.\n\nIf the connect fails (see below), it returns \"undef\" and sets both $DBI::err and $DBI::errstr.\n(It does *not* explicitly set $!.) You should generally test the return status of \"connect\" and\n\"print $DBI::errstr\" if it has failed.\n\nMultiple simultaneous connections to multiple databases through multiple drivers can be made via\nthe DBI. Simply make one \"connect\" call for each database and keep a copy of each returned\ndatabase handle.\n\nThe $datasource value must begin with \"\"dbi:\"*drivername*\":\"\". The *drivername* specifies the\ndriver that will be used to make the connection. (Letter case is significant.)\n\nAs a convenience, if the $datasource parameter is undefined or empty, the DBI will substitute\nthe value of the environment variable \"DBIDSN\". If just the *drivername* part is empty (i.e.,\nthe $datasource prefix is \"\"dbi::\"\"), the environment variable \"DBIDRIVER\" is used. If neither\nvariable is set, then \"connect\" dies.\n\nExamples of $datasource values are:\n\ndbi:DriverName:databasename\ndbi:DriverName:databasename@hostname:port\ndbi:DriverName:database=databasename;host=hostname;port=port\n\nThere is *no standard* for the text following the driver name. Each driver is free to use\nwhatever syntax it wants. The only requirement the DBI makes is that all the information is\nsupplied in a single string. You must consult the documentation for the drivers you are using\nfor a description of the syntax they require.\n\nIt is recommended that drivers support the ODBC style, shown in the last example above. It is\nalso recommended that they support the three common names '\"host\"', '\"port\"', and '\"database\"'\n(plus '\"db\"' as an alias for \"database\"). This simplifies automatic construction of basic DSNs:\n\"dbi:$driver:database=$db;host=$host;port=$port\". Drivers should aim to 'do something\nreasonable' when given a DSN in this form, but if any part is meaningless for that driver (such\nas 'port' for Informix) it should generate an error if that part is not empty.\n\nIf the environment variable \"DBIAUTOPROXY\" is defined (and the driver in $datasource is not\n\"\"Proxy\"\") then the connect request will automatically be changed to:\n\n$ENV{DBIAUTOPROXY};dsn=$datasource\n\n\"DBIAUTOPROXY\" is typically set as \"\"dbi:Proxy:hostname=...;port=...\"\". If $ENV{DBIAUTOPROXY}\ndoesn't begin with '\"dbi:\"' then \"dbi:Proxy:\" will be prepended to it first. See the DBD::Proxy\ndocumentation for more details.\n\nIf $username or $password are undefined (rather than just empty), then the DBI will substitute\nthe values of the \"DBIUSER\" and \"DBIPASS\" environment variables, respectively. The DBI will\nwarn if the environment variables are not defined. However, the everyday use of these\nenvironment variables is not recommended for security reasons. The mechanism is primarily\nintended to simplify testing. See below for alternative way to specify the username and\npassword.\n\n\"DBI->connect\" automatically installs the driver if it has not been installed yet. Driver\ninstallation either returns a valid driver handle, or it *dies* with an error message that\nincludes the string \"\"installdriver\"\" and the underlying problem. So \"DBI->connect\" will die on\na driver installation failure and will only return \"undef\" on a connect failure, in which case\n$DBI::errstr will hold the error message. Use \"eval\" if you need to catch the \"\"installdriver\"\"\nerror.\n\nThe $datasource argument (with the \"\"dbi:...:\"\" prefix removed) and the $username and $password\narguments are then passed to the driver for processing. The DBI does not define any\ninterpretation for the contents of these fields. The driver is free to interpret the\n$datasource, $username, and $password fields in any way, and supply whatever defaults are\nappropriate for the engine being accessed. (Oracle, for example, uses the ORACLESID and\nTWOTASK environment variables if no $datasource is specified.)\n\nThe \"AutoCommit\" and \"PrintError\" attributes for each connection default to \"on\". (See\n\"AutoCommit\" and \"PrintError\" for more information.) However, it is strongly recommended that\nyou explicitly define \"AutoCommit\" rather than rely on the default. The \"PrintWarn\" attribute\ndefaults to true. The \"RaiseWarn\" attribute defaults to false.\n\nThe \"\\%attr\" parameter can be used to alter the default settings of \"PrintError\", \"RaiseError\",\n\"AutoCommit\", and other attributes. For example:\n\n$dbh = DBI->connect($datasource, $user, $pass, {\nPrintError => 0,\nAutoCommit => 0\n});\n\nThe username and password can also be specified using the attributes \"Username\" and \"Password\",\nin which case they take precedence over the $username and $password parameters.\n\nYou can also define connection attribute values within the $datasource parameter. For example:\n\ndbi:DriverName(PrintWarn=>0,PrintError=>0,Taint=>1):...\n\nIndividual attributes values specified in this way take precedence over any conflicting values\nspecified via the \"\\%attr\" parameter to \"connect\".\n\nThe \"dbiconnectmethod\" attribute can be used to specify which driver method should be called\nto establish the connection. The only useful values are 'connect', 'connectcached', or some\nspecialized case like 'Apache::DBI::connect' (which is automatically the default when running\nwithin Apache).\n\nWhere possible, each session ($dbh) is independent from the transactions in other sessions. This\nis useful when you need to hold cursors open across transactions--for example, if you use one\nsession for your long lifespan cursors (typically read-only) and another for your short update\ntransactions.\n\nFor compatibility with old DBI scripts, the driver can be specified by passing its name as the\nfourth argument to \"connect\" (instead of \"\\%attr\"):\n\n$dbh = DBI->connect($datasource, $user, $pass, $driver);\n\nIn this \"old-style\" form of \"connect\", the $datasource should not start with\n\"\"dbi:drivername:\"\". (If it does, the embedded drivername will be ignored). Also note that in\nthis older form of \"connect\", the \"$dbh->{AutoCommit}\" attribute is *undefined*, the\n\"$dbh->{PrintError}\" attribute is off, and the old \"DBIDBNAME\" environment variable is checked\nif \"DBIDSN\" is not defined. Beware that this \"old-style\" \"connect\" will soon be withdrawn in a\nfuture version of DBI.\n\n\"connectcached\"\n$dbh = DBI->connectcached($datasource, $username, $password)\nor die $DBI::errstr;\n$dbh = DBI->connectcached($datasource, $username, $password, \\%attr)\nor die $DBI::errstr;\n\n\"connectcached\" is like \"connect\", except that the database handle returned is also stored in a\nhash associated with the given parameters. If another call is made to \"connectcached\" with the\nsame parameter values, then the corresponding cached $dbh will be returned if it is still valid.\nThe cached database handle is replaced with a new connection if it has been disconnected or if\nthe \"ping\" method fails.\n\nNote that the behaviour of this method differs in several respects from the behaviour of\npersistent connections implemented by Apache::DBI. However, if Apache::DBI is loaded then\n\"connectcached\" will use it.\n\nCaching connections can be useful in some applications, but it can also cause problems, such as\ntoo many connections, and so should be used with care. In particular, avoid changing the\nattributes of a database handle created via connectcached() because it will affect other code\nthat may be using the same handle. When connectcached() returns a handle the attributes will be\nreset to their initial values. This can cause problems, especially with the \"AutoCommit\"\nattribute.\n\nAlso, to ensure that the attributes passed are always the same, avoid passing references inline.\nFor example, the \"Callbacks\" attribute is specified as a hash reference. Be sure to declare it\nexternal to the call to connectcached(), such that the hash reference is not re-created on\nevery call. A package-level lexical works well:\n\npackage MyDBH;\nmy $cb = {\n'connectcached.reused' => sub { delete $[4]->{AutoCommit} },\n};\n\nsub dbh {\nDBI->connectcached( $dsn, $username, $auth, { Callbacks => $cb });\n}\n\nWhere multiple separate parts of a program are using connectcached() to connect to the same\ndatabase with the same (initial) attributes it is a good idea to add a private attribute to the",
                "subsections": [
                    {
                        "name": "connect_cached",
                        "content": "DBI->connectcached(..., { privatefoocachekey => \"Bar\", ... });\n\nHandles returned from that connectcached() call will only be returned by other connectcached()\ncall elsewhere in the code if those other calls also pass in the same attribute values,\nincluding the private one. (I've used \"privatefoocachekey\" here as an example, you can use any\nattribute name with a \"private\" prefix.)\n\nTaking that one step further, you can limit a particular connectcached() call to return handles\nunique to that one place in the code by setting the private attribute to a unique value for that\nplace:\n\nDBI->connectcached(..., { privatefoocachekey => FILE.LINE, ... });\n\nBy using a private attribute you still get connection caching for the individual calls to"
                    },
                    {
                        "name": "connect_cached",
                        "content": "the database handles are isolated from any attribute changes made to other handles.\n\nThe cache can be accessed (and cleared) via the \"CachedKids\" attribute:\n\nmy $CachedKidshashref = $dbh->{Driver}->{CachedKids};\n%$CachedKidshashref = () if $CachedKidshashref;\n\n\"availabledrivers\"\n@ary = DBI->availabledrivers;\n@ary = DBI->availabledrivers($quiet);\n\nReturns a list of all available drivers by searching for \"DBD::*\" modules through the\ndirectories in @INC. By default, a warning is given if some drivers are hidden by others of the\nsame name in earlier directories. Passing a true value for $quiet will inhibit the warning.\n\n\"installeddrivers\"\n%drivers = DBI->installeddrivers();\n\nReturns a list of driver name and driver handle pairs for all drivers 'installed' (loaded) into\nthe current process. The driver name does not include the 'DBD::' prefix.\n\nTo get a list of all drivers available in your perl installation you can use\n\"availabledrivers\".\n\nAdded in DBI 1.49.\n\n\"installedversions\"\nDBI->installedversions;\n@ary  = DBI->installedversions;\n$hash = DBI->installedversions;\n\nCalls availabledrivers() and attempts to load each of them in turn using installdriver(). For\neach load that succeeds the driver name and version number are added to a hash. When running\nunder DBI::PurePerl drivers which appear not be pure-perl are ignored.\n\nWhen called in array context the list of successfully loaded drivers is returned (without the\n'DBD::' prefix).\n\nWhen called in scalar context an extra entry for the \"DBI\" is added (and \"DBI::PurePerl\" if\nappropriate) and a reference to the hash is returned.\n\nWhen called in a void context the installedversions() method will print out a formatted list of\nthe hash contents, one per line, along with some other information about the DBI version and OS.\n\nDue to the potentially high memory cost and unknown risks of loading in an unknown number of\ndrivers that just happen to be installed on the system, this method is not recommended for\ngeneral use. Use availabledrivers() instead.\n\nThe installedversions() method is primarily intended as a quick way to see from the command\nline what's installed. For example:\n\nperl -MDBI -e 'DBI->installedversions'\n\nThe installedversions() method was added in DBI 1.38.\n\n\"datasources\"\n@ary = DBI->datasources($driver);\n@ary = DBI->datasources($driver, \\%attr);\n\nReturns a list of data sources (databases) available via the named driver. If $driver is empty\nor \"undef\", then the value of the \"DBIDRIVER\" environment variable is used.\n\nThe driver will be loaded if it hasn't been already. Note that if the driver loading fails then"
                    },
                    {
                        "name": "data_sources",
                        "content": "underlying problem.\n\nData sources are returned in a form suitable for passing to the \"connect\" method (that is, they\nwill include the \"\"dbi:$driver:\"\" prefix).\n\nNote that many drivers have no way of knowing what data sources might be available for it. These\ndrivers return an empty or incomplete list or may require driver-specific attributes.\n\nThere is also a datasources() method defined for database handles.\n\n\"trace\"\nDBI->trace($tracesetting)\nDBI->trace($tracesetting, $tracefilename)\nDBI->trace($tracesetting, $tracefilehandle)\n$tracesetting = DBI->trace;\n\nThe \"DBI->trace\" method sets the *global default* trace settings and returns the *previous*\ntrace settings. It can also be used to change where the trace output is sent.\n\nThere's a similar method, \"$h->trace\", which sets the trace settings for the specific handle\nit's called on.\n\nSee the \"TRACING\" section for full details about the DBI's powerful tracing facilities.\n\n\"visithandles\"\nDBI->visithandles( $coderef );\nDBI->visithandles( $coderef, $info );\n\nWhere $coderef is a reference to a subroutine and $info is an arbitrary value which, if\nundefined, defaults to a reference to an empty hash. Returns $info.\n\nFor each installed driver handle, if any, $coderef is invoked as:\n\n$coderef->($driverhandle, $info);\n\nIf the execution of $coderef returns a true value then \"visitchildhandles\" is called on that\nchild handle and passed the returned value as $info.\n\nFor example:\n\nmy $info = $dbh->{Driver}->visitchildhandles(sub {\nmy ($h, $info) = @;\n++$info->{ $h->{Type} }; # count types of handles (dr/db/st)\nreturn $info; # visit kids\n});\n\nSee also \"visitchildhandles\".\n\nDBI Utility Functions\nIn addition to the DBI methods listed in the previous section, the DBI package also provides\nseveral utility functions.\n\nThese can be imported into your code by listing them in the \"use\" statement. For example:\n\nuse DBI qw(neat datadiff);\n\nAlternatively, all these utility functions (except hash) can be imported using the \":utils\"\nimport tag. For example:\n\nuse DBI qw(:utils);\n\n\"datastringdesc\"\n$description = datastringdesc($string);\n\nReturns an informal description of the string. For example:\n\nUTF8 off, ASCII, 42 characters 42 bytes\nUTF8 off, non-ASCII, 42 characters 42 bytes\nUTF8 on, non-ASCII, 4 characters 6 bytes\nUTF8 on but INVALID encoding, non-ASCII, 4 characters 6 bytes\nUTF8 off, undef\n\nThe initial \"UTF8\" on/off refers to Perl's internal SvUTF8 flag. If $string has the SvUTF8 flag\nset but the sequence of bytes it contains are not a valid UTF-8 encoding then datastringdesc()\nwill report \"UTF8 on but INVALID encoding\".\n\nThe \"ASCII\" vs \"non-ASCII\" portion shows \"ASCII\" if *all* the characters in the string are ASCII\n(have code points <= 127).\n\nThe datastringdesc() function was added in DBI 1.46.\n\n\"datastringdiff\"\n$diff = datastringdiff($a, $b);\n\nReturns an informal description of the first character difference between the strings. If both\n$a and $b contain the same sequence of characters then datastringdiff() returns an empty\nstring. For example:\n\nParams a & b     Result\n------------     ------\n'aaa', 'aaa'     ''\n'aaa', 'abc'     'Strings differ at index 2: a[2]=a, b[2]=b'\n'aaa', undef     'String b is undef, string a has 3 characters'\n'aaa', 'aa'      'String b truncated after 2 characters'\n\nUnicode characters are reported in \"\\x{XXXX}\" format. Unicode code points in the range U+0800 to\nU+08FF are unassigned and most likely to occur due to double-encoding. Characters in this range\nare reported as \"\\x{08XX}='C'\" where \"C\" is the corresponding latin-1 character.\n\nThe datastringdiff() function only considers logical *characters* and not the underlying\nencoding. See \"datadiff\" for an alternative.\n\nThe datastringdiff() function was added in DBI 1.46.\n\n\"datadiff\"\n$diff = datadiff($a, $b);\n$diff = datadiff($a, $b, $logical);\n\nReturns an informal description of the difference between two strings. It calls\n\"datastringdesc\" and \"datastringdiff\" and returns the combined results as a multi-line\nstring.\n\nFor example, \"datadiff(\"abc\", \"ab\\x{263a}\")\" will return:\n\na: UTF8 off, ASCII, 3 characters 3 bytes\nb: UTF8 on, non-ASCII, 3 characters 5 bytes\nStrings differ at index 2: a[2]=c, b[2]=\\x{263A}\n\nIf $a and $b are identical in both the characters they contain *and* their physical encoding\nthen datadiff() returns an empty string. If $logical is true then physical encoding differences\nare ignored (but are still reported if there is a difference in the characters).\n\nThe datadiff() function was added in DBI 1.46.\n\n\"neat\"\n$str = neat($value);\n$str = neat($value, $maxlen);\n\nReturn a string containing a neat (and tidy) representation of the supplied value.\n\nStrings will be quoted, although internal quotes will *not* be escaped. Values known to be\nnumeric will be unquoted. Undefined (NULL) values will be shown as \"undef\" (without quotes).\n\nIf the string is flagged internally as utf8 then double quotes will be used, otherwise single\nquotes are used and unprintable characters will be replaced by dot (.).\n\nFor result strings longer than $maxlen the result string will be truncated to \"$maxlen-4\" and\n\"\"...'\"\" will be appended. If $maxlen is 0 or \"undef\", it defaults to $DBI::neatmaxlen which,\nin turn, defaults to 400.\n\nThis function is designed to format values for human consumption. It is used internally by the\nDBI for \"trace\" output. It should typically *not* be used for formatting values for database\nuse. (See also \"quote\".)\n\n\"neatlist\"\n$str = neatlist(\\@listref, $maxlen, $fieldsep);\n\nCalls \"neat\" on each element of the list and returns a string containing the results joined with\n$fieldsep. $fieldsep defaults to \", \".\n\n\"lookslikenumber\"\n@bool = lookslikenumber(@array);\n\nReturns true for each element that looks like a number. Returns false for each element that does\nnot look like a number. Returns \"undef\" for each element that is undefined or empty.\n\n\"hash\"\n$hashvalue = DBI::hash($buffer, $type);\n\nReturn a 32-bit integer 'hash' value corresponding to the contents of $buffer. The $type\nparameter selects which kind of hash algorithm should be used.\n\nFor the technically curious, type 0 (which is the default if $type isn't specified) is based on\nthe Perl 5.1 hash except that the value is forced to be negative (for obscure historical\nreasons). Type 1 is the better \"Fowler / Noll / Vo\" (FNV) hash. See\n<http://www.isthe.com/chongo/tech/comp/fnv/> for more information. Both types are implemented in\nC and are very fast.\n\nThis function doesn't have much to do with databases, except that it can sometimes be handy to\nstore such values in a database. It also doesn't have much to do with perl hashes, like %foo.\n\n\"sqltypecast\"\n$sts = DBI::sqltypecast($sv, $sqltype, $flags);\n\nsqltypecast attempts to cast $sv to the SQL type (see DBI Constants) specified in $sqltype.\nAt present only the SQL types \"SQLINTEGER\", \"SQLDOUBLE\" and \"SQLNUMERIC\" are supported.\n\nFor \"SQLINTEGER\" the effect is similar to using the value in an expression that requires an\ninteger. It gives the perl scalar an 'integer aspect'. (Technically the value gains an IV, or\npossibly a UV or NV if the value is too large for an IV.)\n\nFor \"SQLDOUBLE\" the effect is similar to using the value in an expression that requires a\ngeneral numeric value. It gives the perl scalar a 'numeric aspect'. (Technically the value gains\nan NV.)\n\n\"SQLNUMERIC\" is similar to \"SQLINTEGER\" or \"SQLDOUBLE\" but more general and more cautious. It\nwill look at the string first and if it looks like an integer (that will fit in an IV or UV) it\nwill act like \"SQLINTEGER\", if it looks like a floating point value it will act like\n\"SQLDOUBLE\", if it looks like neither then it will do nothing - and thereby avoid the warnings\nthat would be generated by \"SQLINTEGER\" and \"SQLDOUBLE\" when given non-numeric data.\n\n$flags may be:\n\n\"DBIstcfDISCARDSTRING\"\nIf this flag is specified then when the driver successfully casts the bound perl scalar to a\nnon-string type then the string portion of the scalar will be discarded.\n\n\"DBIstcfSTRICT\"\nIf $sv cannot be cast to the requested $sqltype then by default it is left untouched and no\nerror is generated. If you specify \"DBIstcfSTRICT\" and the cast fails, this will generate\nan error.\n\nThe returned $sts value is:\n\n-2 sqltype is not handled\n-1 sv is undef so unchanged\n0 sv could not be cast cleanly and DBIstcfSTRICT was used\n1 sv could not be cast and DBIstcfSTRICT was not used\n2 sv was cast successfully\n\nThis method is exported by the :utils tag and was introduced in DBI 1.611.\n\nDBI Dynamic Attributes\nDynamic attributes are always associated with the *last handle used* (that handle is represented\nby $h in the descriptions below).\n\nWhere an attribute is equivalent to a method call, then refer to the method call for all related\ndocumentation.\n\nWarning: these attributes are provided as a convenience but they do have limitations.\nSpecifically, they have a short lifespan: because they are associated with the last handle used,\nthey should only be used *immediately* after calling the method that \"sets\" them. If in any\ndoubt, use the corresponding method call.\n\n$DBI::err\nEquivalent to \"$h->err\".\n\n$DBI::errstr\nEquivalent to \"$h->errstr\".\n\n$DBI::state\nEquivalent to \"$h->state\".\n\n$DBI::rows\nEquivalent to \"$h->rows\". Please refer to the documentation for the \"rows\" method.\n\n$DBI::lasth\nReturns the DBI object handle used for the most recent DBI method call. If the last DBI method\ncall was a DESTROY then $DBI::lasth will return the handle of the parent of the destroyed\nhandle, if there is one.\n"
                    }
                ]
            },
            "METHODS COMMON TO ALL HANDLES": {
                "content": "The following methods can be used by all types of DBI handles.\n\n\"err\"\n$rv = $h->err;\n\nReturns the *native* database engine error code from the last driver method called. The code is\ntypically an integer but you should not assume that.\n\nThe DBI resets $h->err to undef before almost all DBI method calls, so the value only has a\nshort lifespan. Also, for most drivers, the statement handles share the same error variable as\nthe parent database handle, so calling a method on one handle may reset the error on the related\nhandles.\n\n(Methods which don't reset err before being called include err() and errstr(), obviously,",
                "subsections": [
                    {
                        "name": "state",
                        "content": "STORE() methods.)\n\nIf you need to test for specific error conditions *and* have your program be portable to\ndifferent database engines, then you'll need to determine what the corresponding error codes are\nfor all those engines and test for all of them.\n\nThe DBI uses the value of $DBI::stderr as the \"err\" value for internal errors. Drivers should\nalso do likewise. The default value for $DBI::stderr is 2000000000.\n\nA driver may return 0 from err() to indicate a warning condition after a method call. Similarly,\na driver may return an empty string to indicate a 'success with information' condition. In both\nthese cases the value is false but not undef. The errstr() and state() methods may be used to\nretrieve extra information in these cases.\n\nSee \"seterr\" for more information.\n\n\"errstr\"\n$str = $h->errstr;\n\nReturns the native database engine error message from the last DBI method called. This has the\nsame lifespan issues as the \"err\" method described above.\n\nThe returned string may contain multiple messages separated by newline characters.\n\nThe errstr() method should not be used to test for errors, use err() for that, because drivers\nmay return 'success with information' or warning messages via errstr() for methods that have not\n'failed'.\n\nSee \"seterr\" for more information.\n\n\"state\"\n$str = $h->state;\n\nReturns a state code in the standard SQLSTATE five character format. Note that the specific\nsuccess code 00000 is translated to any empty string (false). If the driver does not support\nSQLSTATE (and most don't), then state() will return \"S1000\" (General Error) for all errors.\n\nThe driver is free to return any value via \"state\", e.g., warning codes, even if it has not\ndeclared an error by returning a true value via the \"err\" method described above.\n\nThe state() method should not be used to test for errors, use err() for that, because drivers\nmay return a 'success with information' or warning state code via state() for methods that have\nnot 'failed'.\n\n\"seterr\"\n$rv = $h->seterr($err, $errstr);\n$rv = $h->seterr($err, $errstr, $state);\n$rv = $h->seterr($err, $errstr, $state, $method);\n$rv = $h->seterr($err, $errstr, $state, $method, $rv);\n\nSet the \"err\", \"errstr\", and \"state\" values for the handle. This method is typically only used\nby DBI drivers and DBI subclasses.\n\nIf the \"HandleSetErr\" attribute holds a reference to a subroutine it is called first. The\nsubroutine can alter the $err, $errstr, $state, and $method values. See \"HandleSetErr\" for full\ndetails. If the subroutine returns a true value then the handle \"err\", \"errstr\", and \"state\"\nvalues are not altered and seterr() returns an empty list (it normally returns $rv which\ndefaults to undef, see below).\n\nSetting \"err\" to a *true* value indicates an error and will trigger the normal DBI error\nhandling mechanisms, such as \"RaiseError\" and \"HandleError\", if they are enabled, when execution\nreturns from the DBI back to the application.\n\nSetting \"err\" to \"\" indicates an 'information' state, and setting it to \"0\" indicates a\n'warning' state. Setting \"err\" to \"undef\" also sets \"errstr\" to undef, and \"state\" to \"\",\nirrespective of the values of the $errstr and $state parameters.\n\nThe $method parameter provides an alternate method name for the\n\"RaiseError\"/\"PrintError\"/\"RaiseWarn\"/\"PrintWarn\" error string instead of the fairly unhelpful\n'\"seterr\"'.\n\nThe \"seterr\" method normally returns undef. The $rv parameter provides an alternate return\nvalue.\n\nSome special rules apply if the \"err\" or \"errstr\" values for the handle are *already* set...\n\nIf \"errstr\" is true then: \"\" [err was %s now %s]\"\" is appended if $err is true and \"err\" is\nalready true and the new err value differs from the original one. Similarly \"\" [state was %s now\n%s]\"\" is appended if $state is true and \"state\" is already true and the new state value differs\nfrom the original one. Finally \"\"\\n\"\" and the new $errstr are appended if $errstr differs from\nthe existing errstr value. Obviously the %s's above are replaced by the corresponding values.\n\nThe handle \"err\" value is set to $err if: $err is true; or handle \"err\" value is undef; or $err\nis defined and the length is greater than the handle \"err\" length. The effect is that an\n'information' state only overrides undef; a 'warning' overrides undef or 'information', and an\n'error' state overrides anything.\n\nThe handle \"state\" value is set to $state if $state is true and the handle \"err\" value was set\n(by the rules above).\n\nSupport for warning and information states was added in DBI 1.41.\n\n\"trace\"\n$h->trace($tracesettings);\n$h->trace($tracesettings, $tracefilename);\n$tracesettings = $h->trace;\n\nThe trace() method is used to alter the trace settings for a handle (and any future children of\nthat handle). It can also be used to change where the trace output is sent.\n\nThere's a similar method, \"DBI->trace\", which sets the global default trace settings.\n\nSee the \"TRACING\" section for full details about the DBI's powerful tracing facilities.\n\n\"tracemsg\"\n$h->tracemsg($messagetext);\n$h->tracemsg($messagetext, $minlevel);\n\nWrites $messagetext to the trace file if the trace level is greater than or equal to $minlevel\n(which defaults to 1). Can also be called as \"DBI->tracemsg($msg)\".\n\nSee \"TRACING\" for more details.\n\n\"func\"\n$h->func(@funcarguments, $funcname) or die ...;\n\nThe \"func\" method can be used to call private non-standard and non-portable methods implemented\nby the driver. Note that the function name is given as the *last* argument.\n\nIt's also important to note that the func() method does not clear a previous error ($DBI::err\netc.) and it does not trigger automatic error detection (RaiseError etc.) so you must check the\nreturn status and/or $h->err to detect errors.\n\n(This method is not directly related to calling stored procedures. Calling stored procedures is\ncurrently not defined by the DBI. Some drivers, such as DBD::Oracle, support it in non-portable\nways. See driver documentation for more details.)\n\nSee also installmethod() in DBI::DBD for how you can avoid needing to use func() and gain\ndirect access to driver-private methods.\n\n\"can\"\n$isimplemented = $h->can($methodname);\n\nReturns true if $methodname is implemented by the driver or a default method is provided by the\nDBI's driver base class. It returns false where a driver hasn't implemented a method and the\ndefault method is provided by the DBI's driver base class is just an empty stub.\n\n\"parsetraceflags\"\n$tracesettingsinteger = $h->parsetraceflags($tracesettings);\n\nParses a string containing trace settings and returns the corresponding integer value used\ninternally by the DBI and drivers.\n\nThe $tracesettings argument is a string containing a trace level between 0 and 15 and/or trace\nflag names separated by vertical bar (\"\"|\"\") or comma (\"\",\"\") characters. For example:\n\"SQL|3|foo\".\n\nIt uses the parsetraceflag() method, described below, to process the individual trace flag\nnames.\n\nThe parsetraceflags() method was added in DBI 1.42.\n\n\"parsetraceflag\"\n$bitflag = $h->parsetraceflag($traceflagname);\n\nReturns the bit flag corresponding to the trace flag name in $traceflagname. Drivers are\nexpected to override this method and check if $traceflagname is a driver specific trace flags\nand, if not, then call the DBI's default parsetraceflag().\n\nThe parsetraceflag() method was added in DBI 1.42.\n\n\"privateattributeinfo\"\n$hashref = $h->privateattributeinfo();\n\nReturns a reference to a hash whose keys are the names of driver-private handle attributes\navailable for the kind of handle (driver, database, statement) that the method was called on.\n\nFor example, the return value when called with a DBD::Sybase $dbh could look like this:\n\n{\nsybdynamicsupported => undef,\nsybocversion => undef,\nsybserverversion => undef,\nsybserverversionstring => undef,\n}\n\nand when called with a DBD::Sybase $sth they could look like this:\n\n{\nsybtypes => undef,\nsybprocstatus => undef,\nsybresulttype => undef,\n}\n\nThe values should be undef. Meanings may be assigned to particular values in future.\n\n\"swapinnerhandle\"\n$rc = $h1->swapinnerhandle( $h2 );\n$rc = $h1->swapinnerhandle( $h2, $allowreparent );\n\nBrain transplants for handles. You don't need to know about this unless you want to become a\nhandle surgeon.\n\nA DBI handle is a reference to a tied hash. A tied hash has an *inner* hash that actually holds\nthe contents. The swapinnerhandle() method swaps the inner hashes between two handles. The $h1\nand $h2 handles still point to the same tied hashes, but what those hashes are tied to has been\nswapped. In effect $h1 *becomes* $h2 and vice-versa. This is powerful stuff, expect problems.\nUse with care.\n\nAs a small safety measure, the two handles, $h1 and $h2, have to share the same parent unless\n$allowreparent is true.\n\nThe swapinnerhandle() method was added in DBI 1.44.\n\nHere's a quick kind of 'diagram' as a worked example to help think about what's happening:\n\nOriginal state:\ndbh1o -> dbh1i\nsthAo -> sthAi(dbh1i)\ndbh2o -> dbh2i\n\nswapinnerhandle dbh1o with dbh2o:\ndbh2o -> dbh1i\nsthAo -> sthAi(dbh1i)\ndbh1o -> dbh2i\n\ncreate new sth from dbh1o:\ndbh2o -> dbh1i\nsthAo -> sthAi(dbh1i)\ndbh1o -> dbh2i\nsthBo -> sthBi(dbh2i)\n\nswapinnerhandle sthAo with sthBo:\ndbh2o -> dbh1i\nsthBo -> sthAi(dbh1i)\ndbh1o -> dbh2i\nsthAo -> sthBi(dbh2i)\n\n\"visitchildhandles\"\n$h->visitchildhandles( $coderef );\n$h->visitchildhandles( $coderef, $info );\n\nWhere $coderef is a reference to a subroutine and $info is an arbitrary value which, if\nundefined, defaults to a reference to an empty hash. Returns $info.\n\nFor each child handle of $h, if any, $coderef is invoked as:\n\n$coderef->($childhandle, $info);\n\nIf the execution of $coderef returns a true value then \"visitchildhandles\" is called on that\nchild handle and passed the returned value as $info.\n\nFor example:\n\n# count database connections with names (DSN) matching a pattern\nmy $connections = 0;\n$dbh->{Driver}->visitchildhandles(sub {\nmy ($h, $info) = @;\n++$connections if $h->{Name} =~ /foo/;\nreturn 0; # don't visit kids\n})\n\nSee also \"visithandles\".\n"
                    }
                ]
            },
            "ATTRIBUTES COMMON TO ALL HANDLES": {
                "content": "These attributes are common to all types of DBI handles.\n\nSome attributes are inherited by child handles. That is, the value of an inherited attribute in\na newly created statement handle is the same as the value in the parent database handle. Changes\nto attributes in the new statement handle do not affect the parent database handle and changes\nto the database handle do not affect existing statement handles, only future ones.\n\nAttempting to set or get the value of an unknown attribute generates a warning, except for\nprivate driver specific attributes (which all have names starting with a lowercase letter).\n\nExample:\n\n$h->{AttributeName} = ...;    # set/write\n... = $h->{AttributeName};    # get/read\n\n\"Warn\"\nType: boolean, inherited\n\nThe \"Warn\" attribute enables useful warnings for certain bad practices. It is enabled by default\nand should only be disabled in rare circumstances. Since warnings are generated using the Perl\n\"warn\" function, they can be intercepted using the Perl $SIG{WARN} hook.\n\nThe \"Warn\" attribute is not related to the \"PrintWarn\" attribute.\n\n\"Active\"\nType: boolean, read-only\n\nThe \"Active\" attribute is true if the handle object is \"active\". This is rarely used in\napplications. The exact meaning of active is somewhat vague at the moment. For a database handle\nit typically means that the handle is connected to a database (\"$dbh->disconnect\" sets \"Active\"\noff). For a statement handle it typically means that the handle is a \"SELECT\" that may have more\ndata to fetch. (Fetching all the data or calling \"$sth->finish\" sets \"Active\" off.)\n\n\"Executed\"\nType: boolean\n\nThe \"Executed\" attribute is true if the handle object has been \"executed\". Currently only the\n$dbh do() method and the $sth execute(), executearray(), and executeforfetch() methods set\nthe \"Executed\" attribute.\n\nWhen it's set on a handle it is also set on the parent handle at the same time. So calling",
                "subsections": [
                    {
                        "name": "execute",
                        "content": "The \"Executed\" attribute for a database handle is cleared by the commit() and rollback() methods\n(even if they fail). The \"Executed\" attribute of a statement handle is not cleared by the DBI\nunder any circumstances and so acts as a permanent record of whether the statement handle was\never used.\n\nThe \"Executed\" attribute was added in DBI 1.41.\n\n\"Kids\"\nType: integer, read-only\n\nFor a driver handle, \"Kids\" is the number of currently existing database handles that were\ncreated from that driver handle. For a database handle, \"Kids\" is the number of currently\nexisting statement handles that were created from that database handle. For a statement handle,\nthe value is zero.\n\n\"ActiveKids\"\nType: integer, read-only\n\nLike \"Kids\", but only counting those that are \"Active\" (as above).\n\n\"CachedKids\"\nType: hash ref\n\nFor a database handle, \"CachedKids\" returns a reference to the cache (hash) of statement handles\ncreated by the \"preparecached\" method. For a driver handle, returns a reference to the cache\n(hash) of database handles created by the \"connectcached\" method.\n\n\"Type\"\nType: scalar, read-only\n\nThe \"Type\" attribute identifies the type of a DBI handle. Returns \"dr\" for driver handles, \"db\"\nfor database handles and \"st\" for statement handles.\n\n\"ChildHandles\"\nType: array ref\n\nThe ChildHandles attribute contains a reference to an array of all the handles created by this\nhandle which are still accessible. The contents of the array are weak-refs and will become undef\nwhen the handle goes out of scope. (They're cleared out occasionally.)\n\n\"ChildHandles\" returns undef if your perl version does not support weak references (check the\nScalar::Util module). The referenced array returned should be treated as read-only.\n\nFor example, to enumerate all driver handles, database handles and statement handles:\n\nsub showchildhandles {\nmy ($h, $level) = @;\nprintf \"%sh %s %s\\n\", $h->{Type}, \"\\t\" x $level, $h;\nshowchildhandles($, $level + 1)\nfor (grep { defined } @{$h->{ChildHandles}});\n}\n\nmy %drivers = DBI->installeddrivers();\nshowchildhandles($, 0) for (values %drivers);\n\n\"CompatMode\"\nType: boolean, inherited\n\nThe \"CompatMode\" attribute is used by emulation layers (such as Oraperl) to enable compatible\nbehaviour in the underlying driver (e.g., DBD::Oracle) for this handle. Not normally set by\napplication code.\n\nIt also has the effect of disabling the 'quick FETCH' of attribute values from the handles\nattribute cache. So all attribute values are handled by the drivers own FETCH method. This makes\nthem slightly slower but is useful for special-purpose drivers like DBD::Multiplex.\n\n\"InactiveDestroy\"\nType: boolean\n\nThe default value, false, means a handle will be fully destroyed as normal when the last\nreference to it is removed, just as you'd expect.\n\nIf set true then the handle will be treated by the DESTROY as if it was no longer Active, and so\nthe *database engine* related effects of DESTROYing a handle will be skipped. Think of the name\nas meaning 'treat the handle as not-Active in the DESTROY method'.\n\nFor a database handle, this attribute does not disable an *explicit* call to the disconnect\nmethod, only the implicit call from DESTROY that happens if the handle is still marked as\n\"Active\".\n\nThis attribute is specifically designed for use in Unix applications that \"fork\" child\nprocesses. For some drivers, when the child process exits the destruction of inherited handles\ncause the corresponding handles in the parent process to cease working.\n\nEither the parent or the child process, but not both, should set \"InactiveDestroy\" true on all\ntheir shared handles. Alternatively, and preferably, the \"AutoInactiveDestroy\" can be set in the\nparent on connect.\n\nTo help tracing applications using fork the process id is shown in the trace log whenever a DBI\nor handle trace() method is called. The process id also shown for *every* method call if the DBI\ntrace level (not handle trace level) is set high enough to show the trace from the DBI's method\ndispatcher, e.g. >= 9.\n\n\"AutoInactiveDestroy\"\nType: boolean, inherited\n\nThe \"InactiveDestroy\" attribute, described above, needs to be explicitly set in the child\nprocess after a fork(), on every active database and statement handle. This is a problem if the\ncode that performs the fork() is not under your control, perhaps in a third-party module. Use\n\"AutoInactiveDestroy\" to get around this situation.\n\nIf set true, the DESTROY method will check the process id of the handle and, if different from\nthe current process id, it will set the *InactiveDestroy* attribute. It is strongly recommended\nthat \"AutoInactiveDestroy\" is enabled on all new code (it's only not enabled by default to avoid\nbackwards compatibility problems).\n\nThis is the example it's designed to deal with:\n\nmy $dbh = DBI->connect(...);\nsomecodethatforks(); # Perhaps without your knowledge\n# Child process dies, destroying the inherited dbh\n$dbh->do(...); # Breaks because parent $dbh is now broken\n\nThe \"AutoInactiveDestroy\" attribute was added in DBI 1.614.\n\n\"PrintWarn\"\nType: boolean, inherited\n\nThe \"PrintWarn\" attribute controls the printing of warnings recorded by the driver. When set to\na true value (the default) the DBI will check method calls to see if a warning condition has\nbeen set. If so, the DBI will effectively do a \"warn(\"$class $method warning: $DBI::errstr\")\"\nwhere $class is the driver class and $method is the name of the method which failed. E.g.,\n\nDBD::Oracle::db execute warning: ... warning text here ...\n\nIf desired, the warnings can be caught and processed using a $SIG{WARN} handler or modules\nlike CGI::Carp and CGI::ErrorWrap.\n\nSee also \"seterr\" for how warnings are recorded and \"HandleSetErr\" for how to influence it.\n\nFetching the full details of warnings can require an extra round-trip to the database server for\nsome drivers. In which case the driver may opt to only fetch the full details of warnings if the\n\"PrintWarn\" attribute is true. If \"PrintWarn\" is false then these drivers should still indicate\nthe fact that there were warnings by setting the warning string to, for example: \"3 warnings\".\n\n\"PrintError\"\nType: boolean, inherited\n\nThe \"PrintError\" attribute can be used to force errors to generate warnings (using \"warn\") in\naddition to returning error codes in the normal way. When set \"on\", any method which results in\nan error occurring will cause the DBI to effectively do a \"warn(\"$class $method failed:\n$DBI::errstr\")\" where $class is the driver class and $method is the name of the method which\nfailed. E.g.,\n\nDBD::Oracle::db prepare failed: ... error text here ...\n\nBy default, \"DBI->connect\" sets \"PrintError\" \"on\".\n\nIf desired, the warnings can be caught and processed using a $SIG{WARN} handler or modules\nlike CGI::Carp and CGI::ErrorWrap.\n\n\"RaiseWarn\"\nType: boolean, inherited\n\nThe \"RaiseWarn\" attribute can be used to force warnings to raise exceptions rather then simply\nprinting them. It is \"off\" by default. When set \"on\", any method which sets warning condition\nwill cause the DBI to effectively do a \"die(\"$class $method warning: $DBI::errstr\")\", where\n$class is the driver class and $method is the name of the method that sets warning condition.\nE.g.,\n\nDBD::Oracle::db execute warning: ... warning text here ...\n\nIf you turn \"RaiseWarn\" on then you'd normally turn \"PrintWarn\" off. If \"PrintWarn\" is also on,\nthen the \"PrintWarn\" is done first (naturally).\n\nThis attribute was added in DBI 1.643.\n\n\"RaiseError\"\nType: boolean, inherited\n\nThe \"RaiseError\" attribute can be used to force errors to raise exceptions rather than simply\nreturn error codes in the normal way. It is \"off\" by default. When set \"on\", any method which\nresults in an error will cause the DBI to effectively do a \"die(\"$class $method failed:\n$DBI::errstr\")\", where $class is the driver class and $method is the name of the method that\nfailed. E.g.,\n\nDBD::Oracle::db prepare failed: ... error text here ...\n\nIf you turn \"RaiseError\" on then you'd normally turn \"PrintError\" off. If \"PrintError\" is also\non, then the \"PrintError\" is done first (naturally).\n\nTypically \"RaiseError\" is used in conjunction with \"eval\", or a module like Try::Tiny or\nTryCatch, to catch the exception that's been thrown and handle it. For example:\n\nuse Try::Tiny;\n\ntry {\n...\n$sth->execute();\n...\n} catch {\n# $sth->err and $DBI::err will be true if error was from DBI\nwarn $; # print the error (which Try::Tiny puts into $)\n... # do whatever you need to deal with the error\n};\n\nIn the catch block the $DBI::lasth variable can be useful for diagnosis and reporting if you\ncan't be sure which handle triggered the error. For example, $DBI::lasth->{Type} and\n$DBI::lasth->{Statement}.\n\nSee also \"Transactions\".\n\nIf you want to temporarily turn \"RaiseError\" off (inside a library function that is likely to\nfail, for example), the recommended way is like this:\n\n{\nlocal $h->{RaiseError};  # localize and turn off for this block\n...\n}\n\nThe original value will automatically and reliably be restored by Perl, regardless of how the\nblock is exited. The same logic applies to other attributes, including \"PrintError\".\n\n\"HandleError\"\nType: code ref, inherited\n\nThe \"HandleError\" attribute can be used to provide your own alternative behaviour in case of\nerrors. If set to a reference to a subroutine then that subroutine is called when an error is\ndetected (at the same point that \"RaiseError\" and \"PrintError\" are handled). It is called also\nwhen \"RaiseWarn\" is enabled and a warning is detected.\n\nThe subroutine is called with three parameters: the error message string that \"RaiseError\",\n\"RaiseWarn\" or \"PrintError\" would use, the DBI handle being used, and the first value being\nreturned by the method that failed (typically undef).\n\nIf the subroutine returns a false value then the \"RaiseError\", \"RaiseWarn\" and/or \"PrintError\"\nattributes are checked and acted upon as normal.\n\nFor example, to \"die\" with a full stack trace for any error:\n\nuse Carp;\n$h->{HandleError} = sub { confess(shift) };\n\nOr to turn errors into exceptions:\n\nuse Exception; # or your own favourite exception module\n$h->{HandleError} = sub { Exception->new('DBI')->raise($[0]) };\n\nIt is possible to 'stack' multiple HandleError handlers by using closures:\n\nsub yoursubroutine {\nmy $previoushandler = $h->{HandleError};\n$h->{HandleError} = sub {\nreturn 1 if $previoushandler and &$previoushandler(@);\n... your code here ...\n};\n}\n\nUsing a \"my\" inside a subroutine to store the previous \"HandleError\" value is important. See\nperlsub and perlref for more information about *closures*.\n\nIt is possible for \"HandleError\" to alter the error message that will be used by \"RaiseError\",\n\"RaiseWarn\" and \"PrintError\" if it returns false. It can do that by altering the value of $[0].\nThis example appends a stack trace to all errors and, unlike the previous example using\nCarp::confess, this will work \"PrintError\" as well as \"RaiseError\":\n\n$h->{HandleError} = sub { $[0]=Carp::longmess($[0]); 0; };\n\nIt is also possible for \"HandleError\" to hide an error, to a limited degree, by using \"seterr\"\nto reset $DBI::err and $DBI::errstr, and altering the return value of the failed method. For\nexample:\n\n$h->{HandleError} = sub {\nreturn 0 unless $[0] =~ /^\\S+ fetchrowarrayref failed:/;\nreturn 0 unless $[1]->err == 1234; # the error to 'hide'\n$h->seterr(undef,undef);   # turn off the error\n$[2] = [ ... ];    # supply alternative return value\nreturn 1;\n};\n\nThis only works for methods which return a single value and is hard to make reliable (avoiding\ninfinite loops, for example) and so isn't recommended for general use! If you find a *good* use\nfor it then please let me know.\n\n\"HandleSetErr\"\nType: code ref, inherited\n\nThe \"HandleSetErr\" attribute can be used to intercept the setting of handle \"err\", \"errstr\", and\n\"state\" values. If set to a reference to a subroutine then that subroutine is called whenever"
                    },
                    {
                        "name": "set_err",
                        "content": "The subroutine is called with five arguments, the first five that were passed to seterr(): the\nhandle, the \"err\", \"errstr\", and \"state\" values being set, and the method name. These can be\naltered by changing the values in the @ array. The return value affects seterr() behaviour,\nsee \"seterr\" for details.\n\nIt is possible to 'stack' multiple HandleSetErr handlers by using closures. See \"HandleError\"\nfor an example.\n\nThe \"HandleSetErr\" and \"HandleError\" subroutines differ in subtle but significant ways.\nHandleError is only invoked at the point where the DBI is about to return to the application\nwith \"err\" set true. It's not invoked by the failure of a method that's been called by another\nDBI method. HandleSetErr, on the other hand, is called whenever seterr() is called with a\ndefined \"err\" value, even if false. So it's not just for errors, despite the name, but also warn\nand info states. The seterr() method, and thus HandleSetErr, may be called multiple times\nwithin a method and is usually invoked from deep within driver code.\n\nIn theory a driver can use the return value from HandleSetErr via seterr() to decide whether to\ncontinue or not. If seterr() returns an empty list, indicating that the HandleSetErr code has\n'handled' the 'error', the driver could then continue instead of failing (if that's a reasonable\nthing to do). This isn't excepted to be common and any such cases should be clearly marked in\nthe driver documentation and discussed on the dbi-dev mailing list.\n\nThe \"HandleSetErr\" attribute was added in DBI 1.41.\n\n\"ErrCount\"\nType: unsigned integer\n\nThe \"ErrCount\" attribute is incremented whenever the seterr() method records an error. It isn't\nincremented by warnings or information states. It is not reset by the DBI at any time.\n\nThe \"ErrCount\" attribute was added in DBI 1.41. Older drivers may not have been updated to use"
                    },
                    {
                        "name": "set_err",
                        "content": "\"ShowErrorStatement\"\nType: boolean, inherited\n\nThe \"ShowErrorStatement\" attribute can be used to cause the relevant Statement text to be\nappended to the error messages generated by the \"RaiseError\", \"PrintError\", \"RaiseWarn\" and\n\"PrintWarn\" attributes. Only applies to errors on statement handles plus the prepare(), do(),\nand the various \"select*()\" database handle methods. (The exact format of the appended text is\nsubject to change.)\n\nIf \"$h->{ParamValues}\" returns a hash reference of parameter (placeholder) values then those are\nformatted and appended to the end of the Statement text in the error message.\n\n\"TraceLevel\"\nType: integer, inherited\n\nThe \"TraceLevel\" attribute can be used as an alternative to the \"trace\" method to set the DBI\ntrace level and trace flags for a specific handle. See \"TRACING\" for more details.\n\nThe \"TraceLevel\" attribute is especially useful combined with \"local\" to alter the trace\nsettings for just a single block of code.\n\n\"FetchHashKeyName\"\nType: string, inherited\n\nThe \"FetchHashKeyName\" attribute is used to specify whether the fetchrowhashref() method should\nperform case conversion on the field names used for the hash keys. For historical reasons it\ndefaults to '\"NAME\"' but it is recommended to set it to '\"NAMElc\"' (convert to lower case) or\n'\"NAMEuc\"' (convert to upper case) according to your preference. It can only be set for driver\nand database handles. For statement handles the value is frozen when prepare() is called.\n\n\"ChopBlanks\"\nType: boolean, inherited\n\nThe \"ChopBlanks\" attribute can be used to control the trimming of trailing space characters from\nfixed width character (CHAR) fields. No other field types are affected, even where field values\nhave trailing spaces.\n\nThe default is false (although it is possible that the default may change). Applications that\nneed specific behaviour should set the attribute as needed.\n\nDrivers are not required to support this attribute, but any driver which does not support it\nmust arrange to return \"undef\" as the attribute value.\n\n\"LongReadLen\"\nType: unsigned integer, inherited\n\nThe \"LongReadLen\" attribute may be used to control the maximum length of 'long' type fields\n(LONG, BLOB, CLOB, MEMO, etc.) which the driver will read from the database automatically when\nit fetches each row of data.\n\nThe \"LongReadLen\" attribute only relates to fetching and reading long values; it is not involved\nin inserting or updating them.\n\nA value of 0 means not to automatically fetch any long data. Drivers may return undef or an\nempty string for long fields when \"LongReadLen\" is 0.\n\nThe default is typically 0 (zero) or 80 bytes but may vary between drivers. Applications\nfetching long fields should set this value to slightly larger than the longest long field value\nto be fetched.\n\nSome databases return some long types encoded as pairs of hex digits. For these types,\n\"LongReadLen\" relates to the underlying data length and not the doubled-up length of the encoded\nstring.\n\nChanging the value of \"LongReadLen\" for a statement handle after it has been \"prepare\"'d will\ntypically have no effect, so it's common to set \"LongReadLen\" on the $dbh before calling\n\"prepare\".\n\nFor most drivers the value used here has a direct effect on the memory used by the statement\nhandle while it's active, so don't be too generous. If you can't be sure what value to use you\ncould execute an extra select statement to determine the longest value. For example:\n\n$dbh->{LongReadLen} = $dbh->selectrowarray(qq{\nSELECT MAX(OCTETLENGTH(longcolumnname))\nFROM table WHERE ...\n});\n$sth = $dbh->prepare(qq{\nSELECT longcolumnname, ... FROM table WHERE ...\n});\n\nYou may need to take extra care if the table can be modified between the first select and the\nsecond being executed. You may also need to use a different function if OCTETLENGTH() does not\nwork for long types in your database. For example, for Sybase use DATALENGTH() and for Oracle\nuse LENGTHB().\n\nSee also \"LongTruncOk\" for information on truncation of long types.\n\n\"LongTruncOk\"\nType: boolean, inherited\n\nThe \"LongTruncOk\" attribute may be used to control the effect of fetching a long field value\nwhich has been truncated (typically because it's longer than the value of the \"LongReadLen\"\nattribute).\n\nBy default, \"LongTruncOk\" is false and so fetching a long value that needs to be truncated will\ncause the fetch to fail. (Applications should always be sure to check for errors after a fetch\nloop in case an error, such as a divide by zero or long field truncation, caused the fetch to\nterminate prematurely.)\n\nIf a fetch fails due to a long field truncation when \"LongTruncOk\" is false, many drivers will\nallow you to continue fetching further rows.\n\nSee also \"LongReadLen\".\n\n\"TaintIn\"\nType: boolean, inherited\n\nIf the \"TaintIn\" attribute is set to a true value *and* Perl is running in taint mode (e.g.,\nstarted with the \"-T\" option), then all the arguments to most DBI method calls are checked for\nbeing tainted. *This may change.*\n\nThe attribute defaults to off, even if Perl is in taint mode. See perlsec for more about taint\nmode. If Perl is not running in taint mode, this attribute has no effect.\n\nWhen fetching data that you trust you can turn off the TaintIn attribute, for that statement\nhandle, for the duration of the fetch loop.\n\nThe \"TaintIn\" attribute was added in DBI 1.31.\n\n\"TaintOut\"\nType: boolean, inherited\n\nIf the \"TaintOut\" attribute is set to a true value *and* Perl is running in taint mode (e.g.,\nstarted with the \"-T\" option), then most data fetched from the database is considered tainted.\n*This may change.*\n\nThe attribute defaults to off, even if Perl is in taint mode. See perlsec for more about taint\nmode. If Perl is not running in taint mode, this attribute has no effect.\n\nWhen fetching data that you trust you can turn off the TaintOut attribute, for that statement\nhandle, for the duration of the fetch loop.\n\nCurrently only fetched data is tainted. It is possible that the results of other DBI method\ncalls, and the value of fetched attributes, may also be tainted in future versions. That change\nmay well break your applications unless you take great care now. If you use DBI Taint mode,\nplease report your experience and any suggestions for changes.\n\nThe \"TaintOut\" attribute was added in DBI 1.31.\n\n\"Taint\"\nType: boolean, inherited\n\nThe \"Taint\" attribute is a shortcut for \"TaintIn\" and \"TaintOut\" (it is also present for\nbackwards compatibility).\n\nSetting this attribute sets both \"TaintIn\" and \"TaintOut\", and retrieving it returns a true\nvalue if and only if \"TaintIn\" and \"TaintOut\" are both set to true values.\n\n\"Profile\"\nType: inherited\n\nThe \"Profile\" attribute enables the collection and reporting of method call timing statistics.\nSee the DBI::Profile module documentation for *much* more detail.\n\nThe \"Profile\" attribute was added in DBI 1.24.\n\n\"ReadOnly\"\nType: boolean, inherited\n\nAn application can set the \"ReadOnly\" attribute of a handle to a true value to indicate that it\nwill not be attempting to make any changes using that handle or any children of it.\n\nNote that the exact definition of 'read only' is rather fuzzy. For more details see the\ndocumentation for the driver you're using.\n\nIf the driver can make the handle truly read-only then it should (unless doing so would have\nunpleasant side effect, like changing the consistency level from per-statement to per-session).\nOtherwise the attribute is simply advisory.\n\nA driver can set the \"ReadOnly\" attribute itself to indicate that the data it is connected to\ncannot be changed for some reason.\n\nIf the driver cannot ensure the \"ReadOnly\" attribute is adhered to it will record a warning. In\nthis case reading the \"ReadOnly\" attribute back after it is set true will return true even if\nthe underlying driver cannot ensure this (so any application knows the application declared\nitself ReadOnly).\n\nLibrary modules and proxy drivers can use the attribute to influence their behavior. For\nexample, the DBD::Gofer driver considers the \"ReadOnly\" attribute when making a decision about\nwhether to retry an operation that failed.\n\nThe attribute should be set to 1 or 0 (or undef). Other values are reserved.\n\n\"Callbacks\"\nType: hash ref\n\nThe DBI callback mechanism lets you intercept, and optionally replace, any method call on a DBI\nhandle. At the extreme, it lets you become a puppet master, deceiving the application in any way\nyou want.\n\nThe \"Callbacks\" attribute is a hash reference where the keys are DBI method names and the values\nare code references. For each key naming a method, the DBI will execute the associated code\nreference before executing the method.\n\nThe arguments to the code reference will be the same as to the method, including the invocant (a\ndatabase handle or statement handle). For example, say that to callback to some code on a call\nto \"prepare()\":\n\n$dbh->{Callbacks} = {\nprepare => sub {\nmy ($dbh, $query, $attrs) = @;\nprint \"Preparing q{$query}\\n\"\n},\n};\n\nThe callback would then be executed when you called the \"prepare()\" method:\n\n$dbh->prepare('SELECT 1');\n\nAnd the output of course would be:\n\nPreparing q{SELECT 1}\n\nBecause callbacks are executed *before* the methods they're associated with, you can modify the\narguments before they're passed on to the method call. For example, to make sure that all calls\nto \"prepare()\" are immediately prepared by DBD::Pg, add a callback that makes sure that the\n\"pgpreparenow\" attribute is always set:\n\nmy $dbh = DBI->connect($dsn, $username, $auth, {\nCallbacks => {\nprepare => sub {\n$[2] ||= {};\n$[2]->{pgpreparenow} = 1;\nreturn; # must return nothing\n},\n}\n});\n\nNote that we are editing the contents of @ directly. In this case we've created the attributes\nhash if it's not passed to the \"prepare\" call.\n\nYou can also prevent the associated method from ever executing. While a callback executes, $\nholds the method name. (This allows multiple callbacks to share the same code reference and\nstill know what method was called.) To prevent the method from executing, simply \"undef $\". For\nexample, if you wanted to disable calls to \"ping()\", you could do this:\n\n$dbh->{Callbacks} = {\nping => sub {\n# tell dispatch to not call the method:\nundef $;\n# return this value instead:\nreturn \"42 bells\";\n}\n};\n\nAs with other attributes, Callbacks can be specified on a handle or via the attributes to\n\"connect()\". Callbacks can also be applied to a statement methods on a statement handle. For\nexample:\n\n$sth->{Callbacks} = {\nexecute => sub {\nprint \"Executing \", shift->{Statement}, \"\\n\";\n}\n};\n\nThe \"Callbacks\" attribute of a database handle isn't copied to any statement handles it creates.\nSo setting callbacks for a statement handle requires you to set the \"Callbacks\" attribute on the\nstatement handle yourself, as in the example above, or use the special \"ChildCallbacks\" key\ndescribed below.\n\nSpecial Keys in Callbacks Attribute\n\nIn addition to DBI handle method names, the \"Callbacks\" hash reference supports four additional\nkeys.\n\nThe first is the \"ChildCallbacks\" key. When a statement handle is created from a database handle\nthe \"ChildCallbacks\" key of the database handle's \"Callbacks\" attribute, if any, becomes the new\n\"Callbacks\" attribute of the statement handle. This allows you to define callbacks for all\nstatement handles created from a database handle. For example, if you wanted to count how many\ntimes \"execute\" was called in your application, you could write:\n\nmy $execcount = 0;\nmy $dbh = DBI->connect( $dsn, $username, $auth, {\nCallbacks => {\nChildCallbacks => {\nexecute => sub { $execcount++; return; }\n}\n}\n});\n\nEND {\nprint \"The execute method was called $execcount times\\n\";\n}\n\nThe other three special keys are \"connectcached.new\", \"connectcached.connected\", and\n\"connectcached.reused\". These keys define callbacks that are called when \"connectcached()\" is\ncalled, but allow different behaviors depending on whether a new handle is created or a handle\nis returned. The callback is invoked with these arguments: \"$dbh, $dsn, $user, $auth, $attr\".\n\nFor example, some applications uses \"connectcached()\" to connect with \"AutoCommit\" enabled and\nthen disable \"AutoCommit\" temporarily for transactions. If \"connectcached()\" is called during a\ntransaction, perhaps in a utility method, then it might select the same cached handle and then\nforce \"AutoCommit\" on, forcing a commit of the transaction. See the \"connectcached\"\ndocumentation for one way to deal with that. Here we'll describe an alternative approach using a\ncallback.\n\nBecause the \"connectcached.new\" and \"connectcached.reused\" callbacks are invoked before\n\"connectcached()\" has applied the connect attributes, you can use them to edit the attributes\nthat will be applied. To prevent a cached handle from having its transactions committed before\nit's returned, you can eliminate the \"AutoCommit\" attribute in a \"connectcached.reused\"\ncallback, like so:\n\nmy $cb = {\n'connectcached.reused' => sub { delete $[4]->{AutoCommit} },\n};\n\nsub dbh {\nmy $self = shift;\nDBI->connectcached( $dsn, $username, $auth, {\nPrintError => 0,\nRaiseError => 1,\nAutoCommit => 1,\nCallbacks  => $cb,\n});\n}\n\nThe upshot is that new database handles are created with \"AutoCommit\" enabled, while cached\ndatabase handles are left in whatever transaction state they happened to be in when retrieved\nfrom the cache.\n\nNote that we've also used a lexical for the callbacks hash reference. This is because\n\"connectcached()\" returns a new database handle if any of the attributes passed to is have\nchanged. If we used an inline hash reference, \"connectcached()\" would return a new database\nhandle every time. Which would rather defeat the purpose.\n\nA more common application for callbacks is setting connection state only when a new connection\nis made (by connect() or connectcached()). Adding a callback to the connected method (when\nusing \"connect\") or via \"connectcached.connected\" (when useing connectcached()>) makes this\neasy. The connected() method is a no-op by default (unless you subclass the DBI and change it).\nThe DBI calls it to indicate that a new connection has been made and the connection attributes\nhave all been set. You can give it a bit of added functionality by applying a callback to it.\nFor example, to make sure that MySQL understands your application's ANSI-compliant SQL, set it\nup like so:\n\nmy $dbh = DBI->connect($dsn, $username, $auth, {\nCallbacks => {\nconnected => sub {\nshift->do(q{\nSET SESSION sqlmode='ansi,stricttranstables,noautovalueonzero';\n});\nreturn;\n},\n}\n});\n\nIf you're using \"connectcached()\", use the \"connectcached.connected\" callback, instead. This\nis because \"connected()\" is called for both new and reused database handles, but you want to\nexecute a callback only the when a new database handle is returned. For example, to set the time\nzone on connection to a PostgreSQL database, try this:\n\nmy $cb = {\n'connectcached.connected' => sub {\nshift->do('SET timezone = UTC');\n}\n};\n\nsub dbh {\nmy $self = shift;\nDBI->connectcached( $dsn, $username, $auth, { Callbacks => $cb });\n}\n\nOne significant limitation with callbacks is that there can only be one per method per handle.\nThis means it's easy for one use of callbacks to interfere with, or typically simply overwrite,\nanother use of callbacks. For this reason modules using callbacks should document the fact\nclearly so application authors can tell if use of callbacks by the module will clash with use of\ncallbacks by the application.\n\nYou might be able to work around this issue by taking a copy of the original callback and\ncalling it within your own. For example:\n\nmy $prevcb = $h->{Callbacks}{methodname};\n$h->{Callbacks}{methodname} = sub {\nif ($prevcb) {\nmy @result = $prevcb->(@);\nreturn @result if not $; # $prevcb vetoed call\n}\n... your callback logic here ...\n};\n\n\"privateyourmodulename*\"\nThe DBI provides a way to store extra information in a DBI handle as \"private\" attributes. The\nDBI will allow you to store and retrieve any attribute which has a name starting with\n\"\"private\"\".\n\nIt is *strongly* recommended that you use just *one* private attribute (e.g., use a hash ref)\n*and* give it a long and unambiguous name that includes the module or application name that the\nattribute relates to (e.g., \"\"privateYourFullModuleNamethingy\"\").\n\nBecause of the way the Perl tie mechanism works you cannot reliably use the \"||=\" operator\ndirectly to initialise the attribute, like this:\n\nmy $foo = $dbh->{privateyourmodnamefoo} ||= { ... }; # WRONG\n\nyou should use a two step approach like this:\n\nmy $foo = $dbh->{privateyourmodnamefoo};\n$foo ||= $dbh->{privateyourmodnamefoo} = { ... };\n\nThis attribute is primarily of interest to people sub-classing DBI, or for applications to\npiggy-back extra information onto DBI handles.\n"
                    }
                ]
            },
            "DBI DATABASE HANDLE OBJECTS": {
                "content": "This section covers the methods and attributes associated with database handles.\n",
                "subsections": [
                    {
                        "name": "Database Handle Methods",
                        "content": "The following methods are specified for DBI database handles:\n\n\"clone\"\n$newdbh = $dbh->clone(\\%attr);\n\nThe \"clone\" method duplicates the $dbh connection by connecting with the same parameters ($dsn,\n$user, $password) as originally used.\n\nThe attributes for the cloned connect are the same as those used for the *original* connect,\nwith any other attributes in \"\\%attr\" merged over them. Effectively the same as doing:\n\n%attributesused = ( %originalattributes, %attr );\n\nIf \\%attr is not given then it defaults to a hash containing all the attributes in the attribute\ncache of $dbh excluding any non-code references, plus the main boolean attributes (RaiseError,\nPrintError, AutoCommit, etc.). *This behaviour is unreliable and so use of clone without an\nargument is deprecated and may cause a warning in a future release.*\n\nThe clone method can be used even if the database handle is disconnected.\n\nThe \"clone\" method was added in DBI 1.33.\n\n\"datasources\"\n@ary = $dbh->datasources();\n@ary = $dbh->datasources(\\%attr);\n\nReturns a list of data sources (databases) available via the $dbh driver's datasources()\nmethod, plus any extra data sources that the driver can discover via the connected $dbh.\nTypically the extra data sources are other databases managed by the same server process that the\n$dbh is connected to.\n\nData sources are returned in a form suitable for passing to the \"connect\" method (that is, they\nwill include the \"\"dbi:$driver:\"\" prefix).\n\nThe datasources() method, for a $dbh, was added in DBI 1.38.\n\n\"do\"\n$rows = $dbh->do($statement)           or die $dbh->errstr;\n$rows = $dbh->do($statement, \\%attr)   or die $dbh->errstr;\n$rows = $dbh->do($statement, \\%attr, @bindvalues) or die ...\n\nPrepare and execute a single statement. Returns the number of rows affected or \"undef\" on error.\nA return value of -1 means the number of rows is not known, not applicable, or not available.\n\nThis method is typically most useful for *non*-\"SELECT\" statements that either cannot be\nprepared in advance (due to a limitation of the driver) or do not need to be executed\nrepeatedly. It should not be used for \"SELECT\" statements because it does not return a statement\nhandle (so you can't fetch any data).\n\nThe default \"do\" method is logically similar to:\n\nsub do {\nmy($dbh, $statement, $attr, @bindvalues) = @;\nmy $sth = $dbh->prepare($statement, $attr) or return undef;\n$sth->execute(@bindvalues) or return undef;\nmy $rows = $sth->rows;\n($rows == 0) ? \"0E0\" : $rows; # always return true if no error\n}\n\nFor example:\n\nmy $rowsdeleted = $dbh->do(q{\nDELETE FROM table\nWHERE status = ?\n}, undef, 'DONE') or die $dbh->errstr;\n\nUsing placeholders and @bindvalues with the \"do\" method can be useful because it avoids the\nneed to correctly quote any variables in the $statement. But if you'll be executing the\nstatement many times then it's more efficient to \"prepare\" it once and call \"execute\" many times\ninstead.\n\nThe \"q{...}\" style quoting used in this example avoids clashing with quotes that may be used in\nthe SQL statement. Use the double-quote-like \"qq{...}\" operator if you want to interpolate\nvariables into the string. See \"Quote and Quote-like Operators\" in perlop for more details.\n\nNote drivers are free to avoid the overhead of creating an DBI statement handle for do(),\nespecially if there are no parameters. In this case error handlers, if invoked during do(), will\nbe passed the database handle.\n\n\"lastinsertid\"\n$rv = $dbh->lastinsertid();\n$rv = $dbh->lastinsertid($catalog, $schema, $table, $field);\n$rv = $dbh->lastinsertid($catalog, $schema, $table, $field, \\%attr);\n\nReturns a value 'identifying' the row just inserted, if possible. Typically this would be a\nvalue assigned by the database server to a column with an *autoincrement* or *serial* type.\nReturns undef if the driver does not support the method or can't determine the value.\n\nThe $catalog, $schema, $table, and $field parameters may be required for some drivers (see\nbelow). If you don't know the parameter values and your driver does not need them, then use\n\"undef\" for each.\n\nThere are several caveats to be aware of with this method if you want to use it for portable\napplications:\n\n* For some drivers the value may only available immediately after the insert statement has\nexecuted (e.g., mysql, Informix).\n\n* For some drivers the $catalog, $schema, $table, and $field parameters are required, for others\nthey are ignored (e.g., mysql).\n\n* Drivers may return an indeterminate value if no insert has been performed yet.\n\n* For some drivers the value may only be available if placeholders have *not* been used (e.g.,\nSybase, MS SQL). In this case the value returned would be from the last non-placeholder insert\nstatement.\n\n* Some drivers may need driver-specific hints about how to get the value. For example, being\ntold the name of the database 'sequence' object that holds the value. Any such hints are passed\nas driver-specific attributes in the \\%attr parameter.\n\n* If the underlying database offers nothing better, then some drivers may attempt to implement\nthis method by executing \"\"select max($field) from $table\"\". Drivers using any approach like\nthis should issue a warning if \"AutoCommit\" is true because it is generally unsafe - another\nprocess may have modified the table between your insert and the select. For situations where you\nknow it is safe, such as when you have locked the table, you can silence the warning by passing\n\"Warn\" => 0 in \\%attr.\n\n* If no insert has been performed yet, or the last insert failed, then the value is\nimplementation defined.\n\nGiven all the caveats above, it's clear that this method must be used with care.\n\nThe \"lastinsertid\" method was added in DBI 1.38.\n\n\"selectrowarray\"\n@rowary = $dbh->selectrowarray($statement);\n@rowary = $dbh->selectrowarray($statement, \\%attr);\n@rowary = $dbh->selectrowarray($statement, \\%attr, @bindvalues);\n\nThis utility method combines \"prepare\", \"execute\" and \"fetchrowarray\" into a single call. If\ncalled in a list context, it returns the first row of data from the statement. The $statement\nparameter can be a previously prepared statement handle, in which case the \"prepare\" is skipped.\n\nIf any method fails, and \"RaiseError\" is not set, \"selectrowarray\" will return an empty list.\n\nIf called in a scalar context for a statement handle that has more than one column, it is\nundefined whether the driver will return the value of the first column or the last. So don't do\nthat. Also, in a scalar context, an \"undef\" is returned if there are no more rows or if an error\noccurred. That \"undef\" can't be distinguished from an \"undef\" returned because the first field\nvalue was NULL. For these reasons you should exercise some caution if you use \"selectrowarray\"\nin a scalar context, or just don't do that.\n\n\"selectrowarrayref\"\n$aryref = $dbh->selectrowarrayref($statement);\n$aryref = $dbh->selectrowarrayref($statement, \\%attr);\n$aryref = $dbh->selectrowarrayref($statement, \\%attr, @bindvalues);\n\nThis utility method combines \"prepare\", \"execute\" and \"fetchrowarrayref\" into a single call. It\nreturns the first row of data from the statement. The $statement parameter can be a previously\nprepared statement handle, in which case the \"prepare\" is skipped.\n\nIf any method fails, and \"RaiseError\" is not set, \"selectrowarrayref\" will return undef.\n\n\"selectrowhashref\"\n$hashref = $dbh->selectrowhashref($statement);\n$hashref = $dbh->selectrowhashref($statement, \\%attr);\n$hashref = $dbh->selectrowhashref($statement, \\%attr, @bindvalues);\n\nThis utility method combines \"prepare\", \"execute\" and \"fetchrowhashref\" into a single call. It\nreturns the first row of data from the statement. The $statement parameter can be a previously\nprepared statement handle, in which case the \"prepare\" is skipped.\n\nIf any method fails, and \"RaiseError\" is not set, \"selectrowhashref\" will return undef.\n\n\"selectallarrayref\"\n$aryref = $dbh->selectallarrayref($statement);\n$aryref = $dbh->selectallarrayref($statement, \\%attr);\n$aryref = $dbh->selectallarrayref($statement, \\%attr, @bindvalues);\n\nThis utility method combines \"prepare\", \"execute\" and \"fetchallarrayref\" into a single call. It\nreturns a reference to an array containing a reference to an array (or hash, see below) for each\nrow of data fetched.\n\nThe $statement parameter can be a previously prepared statement handle, in which case the\n\"prepare\" is skipped. This is recommended if the statement is going to be executed many times.\n\nIf \"RaiseError\" is not set and any method except \"fetchallarrayref\" fails then\n\"selectallarrayref\" will return \"undef\"; if \"fetchallarrayref\" fails then it will return with\nwhatever data has been fetched thus far. You should check \"$dbh->err\" afterwards (or use the\n\"RaiseError\" attribute) to discover if the data is complete or was truncated due to an error.\n\nThe \"fetchallarrayref\" method called by \"selectallarrayref\" supports a $maxrows parameter.\nYou can specify a value for $maxrows by including a '\"MaxRows\"' attribute in \\%attr. In which\ncase finish() is called for you after fetchallarrayref() returns.\n\nThe \"fetchallarrayref\" method called by \"selectallarrayref\" also supports a $slice parameter.\nYou can specify a value for $slice by including a '\"Slice\"' or '\"Columns\"' attribute in \\%attr.\nThe only difference between the two is that if \"Slice\" is not defined and \"Columns\" is an array\nref, then the array is assumed to contain column index values (which count from 1), rather than\nperl array index values. In which case the array is copied and each value decremented before\npassing to \"/fetchallarrayref\".\n\nYou may often want to fetch an array of rows where each row is stored as a hash. That can be\ndone simply using:\n\nmy $emps = $dbh->selectallarrayref(\n\"SELECT ename FROM emp ORDER BY ename\",\n{ Slice => {} }\n);\nforeach my $emp ( @$emps ) {\nprint \"Employee: $emp->{ename}\\n\";\n}\n\nOr, to fetch into an array instead of an array ref:\n\n@result = @{ $dbh->selectallarrayref($sql, { Slice => {} }) };\n\nSee \"fetchallarrayref\" method for more details.\n\n\"selectallarray\"\n@ary = $dbh->selectallarray($statement);\n@ary = $dbh->selectallarray($statement, \\%attr);\n@ary = $dbh->selectallarray($statement, \\%attr, @bindvalues);\n\nThis is a convenience wrapper around selectallarrayref that returns the rows directly as a\nlist, rather than a reference to an array of rows.\n\nNote that if \"RaiseError\" is not set then you can't tell the difference between returning no\nrows and an error. Using RaiseError is best practice.\n\nThe \"selectallarray\" method was added in DBI 1.635.\n\n\"selectallhashref\"\n$hashref = $dbh->selectallhashref($statement, $keyfield);\n$hashref = $dbh->selectallhashref($statement, $keyfield, \\%attr);\n$hashref = $dbh->selectallhashref($statement, $keyfield, \\%attr, @bindvalues);\n\nThis utility method combines \"prepare\", \"execute\" and \"fetchallhashref\" into a single call. It\nreturns a reference to a hash containing one entry, at most, for each row, as returned by"
                    },
                    {
                        "name": "fetchall_hashref",
                        "content": "The $statement parameter can be a previously prepared statement handle, in which case the\n\"prepare\" is skipped. This is recommended if the statement is going to be executed many times.\n\nThe $keyfield parameter defines which column, or columns, are used as keys in the returned\nhash. It can either be the name of a single field, or a reference to an array containing\nmultiple field names. Using multiple names yields a tree of nested hashes.\n\nIf a row has the same key as an earlier row then it replaces the earlier row.\n\nIf any method except \"fetchallhashref\" fails, and \"RaiseError\" is not set, \"selectallhashref\"\nwill return \"undef\". If \"fetchallhashref\" fails and \"RaiseError\" is not set, then it will\nreturn with whatever data it has fetched thus far. $DBI::err should be checked to catch that.\n\nSee fetchallhashref() for more details.\n\n\"selectcolarrayref\"\n$aryref = $dbh->selectcolarrayref($statement);\n$aryref = $dbh->selectcolarrayref($statement, \\%attr);\n$aryref = $dbh->selectcolarrayref($statement, \\%attr, @bindvalues);\n\nThis utility method combines \"prepare\", \"execute\", and fetching one column from all the rows,\ninto a single call. It returns a reference to an array containing the values of the first column\nfrom each row.\n\nThe $statement parameter can be a previously prepared statement handle, in which case the\n\"prepare\" is skipped. This is recommended if the statement is going to be executed many times.\n\nIf any method except \"fetch\" fails, and \"RaiseError\" is not set, \"selectcolarrayref\" will\nreturn \"undef\". If \"fetch\" fails and \"RaiseError\" is not set, then it will return with whatever\ndata it has fetched thus far. $DBI::err should be checked to catch that.\n\nThe \"selectcolarrayref\" method defaults to pushing a single column value (the first) from each\nrow into the result array. However, it can also push another column, or even multiple columns\nper row, into the result array. This behaviour can be specified via a '\"Columns\"' attribute\nwhich must be a ref to an array containing the column number or numbers to use. For example:\n\n# get array of id and name pairs:\nmy $aryref = $dbh->selectcolarrayref(\"select id, name from table\", { Columns=>[1,2] });\nmy %hash = @$aryref; # build hash from key-value pairs so $hash{$id} => name\n\nYou can specify a maximum number of rows to fetch by including a '\"MaxRows\"' attribute in\n\\%attr.\n\n\"prepare\"\n$sth = $dbh->prepare($statement)          or die $dbh->errstr;\n$sth = $dbh->prepare($statement, \\%attr)  or die $dbh->errstr;\n\nPrepares a statement for later execution by the database engine and returns a reference to a\nstatement handle object.\n\nThe returned statement handle can be used to get attributes of the statement and invoke the\n\"execute\" method. See \"Statement Handle Methods\".\n\nDrivers for engines without the concept of preparing a statement will typically just store the\nstatement in the returned handle and process it when \"$sth->execute\" is called. Such drivers are\nunlikely to give much useful information about the statement, such as \"$sth->{NUMOFFIELDS}\",\nuntil after \"$sth->execute\" has been called. Portable applications should take this into\naccount.\n\nIn general, DBI drivers do not parse the contents of the statement (other than simply counting\nany Placeholders). The statement is passed directly to the database engine, sometimes known as\npass-thru mode. This has advantages and disadvantages. On the plus side, you can access all the\nfunctionality of the engine being used. On the downside, you're limited if you're using a simple\nengine, and you need to take extra care if writing applications intended to be portable between\nengines.\n\nPortable applications should not assume that a new statement can be prepared and/or executed\nwhile still fetching results from a previous statement.\n\nSome command-line SQL tools use statement terminators, like a semicolon, to indicate the end of\na statement. Such terminators should not normally be used with the DBI.\n\n\"preparecached\"\n$sth = $dbh->preparecached($statement)\n$sth = $dbh->preparecached($statement, \\%attr)\n$sth = $dbh->preparecached($statement, \\%attr, $ifactive)\n\nLike \"prepare\" except that the statement handle returned will be stored in a hash associated\nwith the $dbh. If another call is made to \"preparecached\" with the same $statement and %attr\nparameter values, then the corresponding cached $sth will be returned without contacting the\ndatabase server. Be sure to understand the cautions and caveats noted below.\n\nThe $ifactive parameter lets you adjust the behaviour if an already cached statement handle is\nstill Active. There are several alternatives:\n\n0: A warning will be generated, and finish() will be called on the statement handle before it is\nreturned. This is the default behaviour if $ifactive is not passed.\n1: finish() will be called on the statement handle, but the warning is suppressed.\n2: Disables any checking.\n3: The existing active statement handle will be removed from the cache and a new statement\nhandle prepared and cached in its place. This is the safest option because it doesn't affect the\nstate of the old handle, it just removes it from the cache. [Added in DBI 1.40]\n\nHere are some examples of \"preparecached\":\n\nsub inserthash {\nmy ($table, $fieldvalues) = @;\n# sort to keep field order, and thus sql, stable for preparecached\nmy @fields = sort keys %$fieldvalues;\nmy @values = @{$fieldvalues}{@fields};\nmy $sql = sprintf \"insert into %s (%s) values (%s)\",\n$table, join(\",\", @fields), join(\",\", (\"?\")x@fields);\nmy $sth = $dbh->preparecached($sql);\nreturn $sth->execute(@values);\n}\n\nsub searchhash {\nmy ($table, $fieldvalues) = @;\n# sort to keep field order, and thus sql, stable for preparecached\nmy @fields = sort keys %$fieldvalues;\nmy @values = @{$fieldvalues}{@fields};\nmy $qualifier = \"\";\n$qualifier = \"where \".join(\" and \", map { \"$=?\" } @fields) if @fields;\n$sth = $dbh->preparecached(\"SELECT * FROM $table $qualifier\");\nreturn $dbh->selectallarrayref($sth, {}, @values);\n}\n\n*Caveat emptor:* This caching can be useful in some applications, but it can also cause problems\nand should be used with care. Here is a contrived case where caching would cause a significant\nproblem:\n\nmy $sth = $dbh->preparecached('SELECT * FROM foo WHERE bar=?');\n$sth->execute(...);\nwhile (my $data = $sth->fetchrowhashref) {\n\n# later, in some other code called within the loop...\nmy $sth2 = $dbh->preparecached('SELECT * FROM foo WHERE bar=?');\n$sth2->execute(...);\nwhile (my $data2 = $sth2->fetchrowarrayref) {\ndostuff(...);\n}\n}\n\nIn this example, since both handles are preparing the exact same statement, $sth2 will not be\nits own statement handle, but a duplicate of $sth returned from the cache. The results will\ncertainly not be what you expect. Typically the inner fetch loop will work normally, fetching\nall the records and terminating when there are no more, but now that $sth is the same as $sth2\nthe outer fetch loop will also terminate.\n\nYou'll know if you run into this problem because preparecached() will generate a warning by\ndefault (when $ifactive is false).\n\nThe cache used by preparecached() is keyed by both the statement and any attributes so you can\nalso avoid this issue by doing something like:\n\n$sth = $dbh->preparecached(\"...\", { dbidummy => FILE.LINE });\n\nwhich will ensure that preparecached only returns statements cached by that line of code in\nthat source file.\n\nAlso, to ensure the attributes passed are always the same, avoid passing references inline. For\nexample, the Slice attribute is specified as a reference. Be sure to declare it external to the\ncall to preparecached(), such that a new hash reference is not created on every call. See\n\"connectcached\" for more details and examples.\n\nIf you'd like the cache to managed intelligently, you can tie the hashref returned by\n\"CachedKids\" to an appropriate caching module, such as Tie::Cache::LRU:\n\nmy $cache;\ntie %$cache, 'Tie::Cache::LRU', 500;\n$dbh->{CachedKids} = $cache;\n\n\"commit\"\n$rc  = $dbh->commit     or die $dbh->errstr;\n\nCommit (make permanent) the most recent series of database changes if the database supports\ntransactions and AutoCommit is off.\n\nIf \"AutoCommit\" is on, then calling \"commit\" will issue a \"commit ineffective with AutoCommit\"\nwarning.\n\nSee also \"Transactions\" in the \"FURTHER INFORMATION\" section below.\n\n\"rollback\"\n$rc  = $dbh->rollback   or die $dbh->errstr;\n\nRollback (undo) the most recent series of uncommitted database changes if the database supports\ntransactions and AutoCommit is off.\n\nIf \"AutoCommit\" is on, then calling \"rollback\" will issue a \"rollback ineffective with\nAutoCommit\" warning.\n\nSee also \"Transactions\" in the \"FURTHER INFORMATION\" section below.\n\n\"beginwork\"\n$rc  = $dbh->beginwork   or die $dbh->errstr;\n\nEnable transactions (by turning \"AutoCommit\" off) until the next call to \"commit\" or \"rollback\".\nAfter the next \"commit\" or \"rollback\", \"AutoCommit\" will automatically be turned on again.\n\nIf \"AutoCommit\" is already off when \"beginwork\" is called then it does nothing except return an\nerror. If the driver does not support transactions then when \"beginwork\" attempts to set\n\"AutoCommit\" off the driver will trigger a fatal error.\n\nSee also \"Transactions\" in the \"FURTHER INFORMATION\" section below.\n\n\"disconnect\"\n$rc = $dbh->disconnect  or warn $dbh->errstr;\n\nDisconnects the database from the database handle. \"disconnect\" is typically only used before\nexiting the program. The handle is of little use after disconnecting.\n\nThe transaction behaviour of the \"disconnect\" method is, sadly, undefined. Some database systems\n(such as Oracle and Ingres) will automatically commit any outstanding changes, but others (such\nas Informix) will rollback any outstanding changes. Applications not using \"AutoCommit\" should\nexplicitly call \"commit\" or \"rollback\" before calling \"disconnect\".\n\nThe database is automatically disconnected by the \"DESTROY\" method if still connected when there\nare no longer any references to the handle. The \"DESTROY\" method for each driver should\nimplicitly call \"rollback\" to undo any uncommitted changes. This is vital behaviour to ensure\nthat incomplete transactions don't get committed simply because Perl calls \"DESTROY\" on every\nobject before exiting. Also, do not rely on the order of object destruction during \"global\ndestruction\", as it is undefined.\n\nGenerally, if you want your changes to be committed or rolled back when you disconnect, then you\nshould explicitly call \"commit\" or \"rollback\" before disconnecting.\n\nIf you disconnect from a database while you still have active statement handles (e.g., SELECT\nstatement handles that may have more data to fetch), you will get a warning. The warning may\nindicate that a fetch loop terminated early, perhaps due to an uncaught error. To avoid the\nwarning call the \"finish\" method on the active handles.\n\n\"ping\"\n$rc = $dbh->ping;\n\nAttempts to determine, in a reasonably efficient way, if the database server is still running\nand the connection to it is still working. Individual drivers should implement this function in\nthe most suitable manner for their database engine.\n\nThe current *default* implementation always returns true without actually doing anything.\nActually, it returns \"\"0 but true\"\" which is true but zero. That way you can tell if the return\nvalue is genuine or just the default. Drivers should override this method with one that does the\nright thing for their type of database.\n\nFew applications would have direct use for this method. See the specialized Apache::DBI module\nfor one example usage.\n\n\"getinfo\"\n$value = $dbh->getinfo( $infotype );\n\nReturns information about the implementation, i.e. driver and data source capabilities,\nrestrictions etc. It returns \"undef\" for unknown or unimplemented information types. For\nexample:\n\n$databaseversion  = $dbh->getinfo(  18 ); # SQLDBMSVER\n$maxselecttables = $dbh->getinfo( 106 ); # SQLMAXIMUMTABLESINSELECT\n\nSee \"Standards Reference Information\" for more detailed information about the information types\nand their meanings and possible return values.\n\nThe DBI::Const::GetInfoType module exports a %GetInfoType hash that can be used to map info type\nnames to numbers. For example:\n\n$databaseversion = $dbh->getinfo( $GetInfoType{SQLDBMSVER} );\n\nThe names are a merging of the ANSI and ODBC standards (which differ in some cases). See\nDBI::Const::GetInfoType for more details.\n\nBecause some DBI methods make use of getinfo(), drivers are strongly encouraged to support *at\nleast* the following very minimal set of information types to ensure the DBI itself works\nproperly:\n\nType  Name                        Example A     Example B\n----  --------------------------  ------------  ----------------\n17  SQLDBMSNAME               'ACCESS'      'Oracle'\n18  SQLDBMSVER                '03.50.0000'  '08.01.0721 ...'\n29  SQLIDENTIFIERQUOTECHAR   '`'           '\"'\n41  SQLCATALOGNAMESEPARATOR  '.'           '@'\n114  SQLCATALOGLOCATION        1             2\n\nValues from 9000 to 9999 for getinfo are officially reserved for use by Perl DBI. Values in\nthat range which have been assigned a meaning are defined here:\n\n9000: true if a backslash character (\"\\\") before placeholder-like text (e.g. \"?\", \":foo\") will\nprevent it being treated as a placeholder by the driver. The backslash will be removed before\nthe text is passed to the backend.\n\n\"tableinfo\"\n$sth = $dbh->tableinfo( $catalog, $schema, $table, $type );\n$sth = $dbh->tableinfo( $catalog, $schema, $table, $type, \\%attr );\n\n# then $sth->fetchallarrayref or $sth->fetchallhashref etc\n\nReturns an active statement handle that can be used to fetch information about tables and views\nthat exist in the database.\n\nThe arguments $catalog, $schema and $table may accept search patterns according to the\ndatabase/driver, for example: $table = '%FOO%'; Remember that the underscore character ('\"\"')\nis a search pattern that means match any character, so 'FOO%' is the same as 'FOO%' and\n'FOOBAR%' will match names like 'FOO1BAR'.\n\nThe value of $type is a comma-separated list of one or more types of tables to be returned in\nthe result set. Each value may optionally be quoted, e.g.:\n\n$type = \"TABLE\";\n$type = \"'TABLE','VIEW'\";\n\nIn addition the following special cases may also be supported by some drivers:\n\n*   If the value of $catalog is '%' and $schema and $table name are empty strings, the result\nset contains a list of catalog names. For example:\n\n$sth = $dbh->tableinfo('%', '', '');\n\n*   If the value of $schema is '%' and $catalog and $table are empty strings, the result set\ncontains a list of schema names.\n\n*   If the value of $type is '%' and $catalog, $schema, and $table are all empty strings, the\nresult set contains a list of table types.\n\nIf your driver doesn't support one or more of the selection filter parameters then you may get\nback more than you asked for and can do the filtering yourself.\n\nThis method can be expensive, and can return a large amount of data. (For example, small Oracle\ninstallation returns over 2000 rows.) So it's a good idea to use the filters to limit the data\nas much as possible.\n\nThe statement handle returned has at least the following fields in the order show below. Other\nfields, after these, may also be present.\n\nTABLECAT: Table catalog identifier. This field is NULL (\"undef\") if not applicable to the data\nsource, which is usually the case. This field is empty if not applicable to the table.\n\nTABLESCHEM: The name of the schema containing the TABLENAME value. This field is NULL\n(\"undef\") if not applicable to data source, and empty if not applicable to the table.\n\nTABLENAME: Name of the table (or view, synonym, etc).\n\nTABLETYPE: One of the following: \"TABLE\", \"VIEW\", \"SYSTEM TABLE\", \"GLOBAL TEMPORARY\", \"LOCAL\nTEMPORARY\", \"ALIAS\", \"SYNONYM\" or a type identifier that is specific to the data source.\n\nREMARKS: A description of the table. May be NULL (\"undef\").\n\nNote that \"tableinfo\" might not return records for all tables. Applications can use any valid\ntable regardless of whether it's returned by \"tableinfo\".\n\nSee also \"tables\", \"Catalog Methods\" and \"Standards Reference Information\".\n\n\"columninfo\"\n$sth = $dbh->columninfo( $catalog, $schema, $table, $column );\n\n# then $sth->fetchallarrayref or $sth->fetchallhashref etc\n\nReturns an active statement handle that can be used to fetch information about columns in\nspecified tables.\n\nThe arguments $schema, $table and $column may accept search patterns according to the\ndatabase/driver, for example: $table = '%FOO%';\n\nNote: The support for the selection criteria is driver specific. If the driver doesn't support\none or more of them then you may get back more than you asked for and can do the filtering\nyourself.\n\nNote: If your driver does not support columninfo an undef is returned. This is distinct from\nasking for something which does not exist in a driver which supports columninfo as a valid\nstatement handle to an empty result-set will be returned in this case.\n\nIf the arguments don't match any tables then you'll still get a statement handle, it'll just\nreturn no rows.\n\nThe statement handle returned has at least the following fields in the order shown below. Other\nfields, after these, may also be present.\n\nTABLECAT: The catalog identifier. This field is NULL (\"undef\") if not applicable to the data\nsource, which is often the case. This field is empty if not applicable to the table.\n\nTABLESCHEM: The schema identifier. This field is NULL (\"undef\") if not applicable to the data\nsource, and empty if not applicable to the table.\n\nTABLENAME: The table identifier. Note: A driver may provide column metadata not only for base\ntables, but also for derived objects like SYNONYMS etc.\n\nCOLUMNNAME: The column identifier.\n\nDATATYPE: The concise data type code.\n\nTYPENAME: A data source dependent data type name.\n\nCOLUMNSIZE: The column size. This is the maximum length in characters for character data types,\nthe number of digits or bits for numeric data types or the length in the representation of\ntemporal types. See the relevant specifications for detailed information.\n\nBUFFERLENGTH: The length in bytes of transferred data.\n\nDECIMALDIGITS: The total number of significant digits to the right of the decimal point.\n\nNUMPRECRADIX: The radix for numeric precision. The value is 10 or 2 for numeric data types and\nNULL (\"undef\") if not applicable.\n\nNULLABLE: Indicates if a column can accept NULLs. The following values are defined:\n\nSQLNONULLS          0\nSQLNULLABLE          1\nSQLNULLABLEUNKNOWN  2\n\nREMARKS: A description of the column.\n\nCOLUMNDEF: The default value of the column, in a format that can be used directly in an SQL\nstatement.\n\nNote that this may be an expression and not simply the text used for the default value in the\noriginal CREATE TABLE statement. For example, given:\n\ncol1 char(30) default currentuser    -- a 'function'\ncol2 char(30) default 'string'        -- a string literal\n\nwhere \"currentuser\" is the name of a function, the corresponding \"COLUMNDEF\" values would be:\n\nDatabase        col1                     col2\n--------        ----                     ----\nOracle:         currentuser             'string'\nPostgres:       \"currentuser\"()         'string'::text\nMS SQL:         (username())            ('string')\n\nSQLDATATYPE: The SQL data type.\n\nSQLDATETIMESUB: The subtype code for datetime and interval data types.\n\nCHAROCTETLENGTH: The maximum length in bytes of a character or binary data type column.\n\nORDINALPOSITION: The column sequence number (starting with 1).\n\nISNULLABLE: Indicates if the column can accept NULLs. Possible values are: 'NO', 'YES' and ''.\n\nSQL/CLI defines the following additional columns:\n\nCHARSETCAT\nCHARSETSCHEM\nCHARSETNAME\nCOLLATIONCAT\nCOLLATIONSCHEM\nCOLLATIONNAME\nUDTCAT\nUDTSCHEM\nUDTNAME\nDOMAINCAT\nDOMAINSCHEM\nDOMAINNAME\nSCOPECAT\nSCOPESCHEM\nSCOPENAME\nMAXCARDINALITY\nDTDIDENTIFIER\nISSELFREF\n\nDrivers capable of supplying any of those values should do so in the corresponding column and\nsupply undef values for the others.\n\nDrivers wishing to provide extra database/driver specific information should do so in extra\ncolumns beyond all those listed above, and use lowercase field names with the driver-specific\nprefix (i.e., 'ora...'). Applications accessing such fields should do so by name and not by\ncolumn number.\n\nThe result set is ordered by TABLECAT, TABLESCHEM, TABLENAME and ORDINALPOSITION.\n\nNote: There is some overlap with statement handle attributes (in perl) and SQLDescribeCol (in\nODBC). However, SQLColumns provides more metadata.\n\nSee also \"Catalog Methods\" and \"Standards Reference Information\".\n\n\"primarykeyinfo\"\n$sth = $dbh->primarykeyinfo( $catalog, $schema, $table );\n\n# then $sth->fetchallarrayref or $sth->fetchallhashref etc\n\nReturns an active statement handle that can be used to fetch information about columns that make\nup the primary key for a table. The arguments don't accept search patterns (unlike"
                    },
                    {
                        "name": "table_info",
                        "content": "The statement handle will return one row per column, ordered by TABLECAT, TABLESCHEM,\nTABLENAME, and KEYSEQ. If there is no primary key then the statement handle will fetch no\nrows.\n\nNote: The support for the selection criteria, such as $catalog, is driver specific. If the\ndriver doesn't support catalogs and/or schemas, it may ignore these criteria.\n\nThe statement handle returned has at least the following fields in the order shown below. Other\nfields, after these, may also be present.\n\nTABLECAT: The catalog identifier. This field is NULL (\"undef\") if not applicable to the data\nsource, which is often the case. This field is empty if not applicable to the table.\n\nTABLESCHEM: The schema identifier. This field is NULL (\"undef\") if not applicable to the data\nsource, and empty if not applicable to the table.\n\nTABLENAME: The table identifier.\n\nCOLUMNNAME: The column identifier.\n\nKEYSEQ: The column sequence number (starting with 1). Note: This field is named\nORDINALPOSITION in SQL/CLI.\n\nPKNAME: The primary key constraint identifier. This field is NULL (\"undef\") if not applicable\nto the data source.\n\nSee also \"Catalog Methods\" and \"Standards Reference Information\".\n\n\"primarykey\"\n@keycolumnnames = $dbh->primarykey( $catalog, $schema, $table );\n\nSimple interface to the primarykeyinfo() method. Returns a list of the column names that\ncomprise the primary key of the specified table. The list is in primary key column sequence\norder. If there is no primary key then an empty list is returned.\n\n\"foreignkeyinfo\"\n$sth = $dbh->foreignkeyinfo( $pkcatalog, $pkschema, $pktable\n, $fkcatalog, $fkschema, $fktable );\n\n$sth = $dbh->foreignkeyinfo( $pkcatalog, $pkschema, $pktable\n, $fkcatalog, $fkschema, $fktable\n, \\%attr );\n\n# then $sth->fetchallarrayref or $sth->fetchallhashref etc\n\nReturns an active statement handle that can be used to fetch information about foreign keys in\nand/or referencing the specified table(s). The arguments don't accept search patterns (unlike"
                    },
                    {
                        "name": "table_info",
                        "content": "$pkcatalog, $pkschema, $pktable identify the primary (unique) key table (PKT).\n\n$fkcatalog, $fkschema, $fktable identify the foreign key table (FKT).\n\nIf both PKT and FKT are given, the function returns the foreign key, if any, in table FKT that\nrefers to the primary (unique) key of table PKT. (Note: In SQL/CLI, the result is\nimplementation-defined.)\n\nIf only PKT is given, then the result set contains the primary key of that table and all foreign\nkeys that refer to it.\n\nIf only FKT is given, then the result set contains all foreign keys in that table and the\nprimary keys to which they refer. (Note: In SQL/CLI, the result includes unique keys too.)\n\nFor example:\n\n$sth = $dbh->foreignkeyinfo( undef, $user, 'master');\n$sth = $dbh->foreignkeyinfo( undef, undef,   undef , undef, $user, 'detail');\n$sth = $dbh->foreignkeyinfo( undef, $user, 'master', undef, $user, 'detail');\n\n# then $sth->fetchallarrayref or $sth->fetchallhashref etc\n\nNote: The support for the selection criteria, such as $catalog, is driver specific. If the\ndriver doesn't support catalogs and/or schemas, it may ignore these criteria.\n\nThe statement handle returned has the following fields in the order shown below. Because ODBC\nnever includes unique keys, they define different columns in the result set than SQL/CLI.\nSQL/CLI column names are shown in parentheses.\n\nPKTABLECAT ( UKTABLECAT ): The primary (unique) key table catalog identifier. This field is\nNULL (\"undef\") if not applicable to the data source, which is often the case. This field is\nempty if not applicable to the table.\n\nPKTABLESCHEM ( UKTABLESCHEM ): The primary (unique) key table schema identifier. This field\nis NULL (\"undef\") if not applicable to the data source, and empty if not applicable to the\ntable.\n\nPKTABLENAME ( UKTABLENAME ): The primary (unique) key table identifier.\n\nPKCOLUMNNAME (UKCOLUMNNAME ): The primary (unique) key column identifier.\n\nFKTABLECAT ( FKTABLECAT ): The foreign key table catalog identifier. This field is NULL\n(\"undef\") if not applicable to the data source, which is often the case. This field is empty if\nnot applicable to the table.\n\nFKTABLESCHEM ( FKTABLESCHEM ): The foreign key table schema identifier. This field is NULL\n(\"undef\") if not applicable to the data source, and empty if not applicable to the table.\n\nFKTABLENAME ( FKTABLENAME ): The foreign key table identifier.\n\nFKCOLUMNNAME ( FKCOLUMNNAME ): The foreign key column identifier.\n\nKEYSEQ ( ORDINALPOSITION ): The column sequence number (starting with 1).\n\nUPDATERULE ( UPDATERULE ): The referential action for the UPDATE rule. The following codes are\ndefined:\n\nCASCADE              0\nRESTRICT             1\nSET NULL             2\nNO ACTION            3\nSET DEFAULT          4\n\nDELETERULE ( DELETERULE ): The referential action for the DELETE rule. The codes are the same\nas for UPDATERULE.\n\nFKNAME ( FKNAME ): The foreign key name.\n\nPKNAME ( UKNAME ): The primary (unique) key name.\n\nDEFERRABILITY ( DEFERABILITY ): The deferrability of the foreign key constraint. The following\ncodes are defined:\n\nINITIALLY DEFERRED   5\nINITIALLY IMMEDIATE  6\nNOT DEFERRABLE       7\n\n( UNIQUEORPRIMARY ): This column is necessary if a driver includes all candidate (i.e.\nprimary and alternate) keys in the result set (as specified by SQL/CLI). The value of this\ncolumn is UNIQUE if the foreign key references an alternate key and PRIMARY if the foreign key\nreferences a primary key, or it may be undefined if the driver doesn't have access to the\ninformation.\n\nSee also \"Catalog Methods\" and \"Standards Reference Information\".\n\n\"statisticsinfo\"\nWarning: This method is experimental and may change.\n\n$sth = $dbh->statisticsinfo( $catalog, $schema, $table, $uniqueonly, $quick );\n\n# then $sth->fetchallarrayref or $sth->fetchallhashref etc\n\nReturns an active statement handle that can be used to fetch statistical information about a\ntable and its indexes.\n\nThe arguments don't accept search patterns (unlike \"tableinfo\").\n\nIf the boolean argument $uniqueonly is true, only UNIQUE indexes will be returned in the result\nset, otherwise all indexes will be returned.\n\nIf the boolean argument $quick is set, the actual statistical information columns (CARDINALITY\nand PAGES) will only be returned if they are readily available from the server, and might not be\ncurrent. Some databases may return stale statistics or no statistics at all with this flag set.\n\nThe statement handle will return at most one row per column name per index, plus at most one row\nfor the entire table itself, ordered by NONUNIQUE, TYPE, INDEXQUALIFIER, INDEXNAME, and\nORDINALPOSITION.\n\nNote: The support for the selection criteria, such as $catalog, is driver specific. If the\ndriver doesn't support catalogs and/or schemas, it may ignore these criteria.\n\nThe statement handle returned has at least the following fields in the order shown below. Other\nfields, after these, may also be present.\n\nTABLECAT: The catalog identifier. This field is NULL (\"undef\") if not applicable to the data\nsource, which is often the case. This field is empty if not applicable to the table.\n\nTABLESCHEM: The schema identifier. This field is NULL (\"undef\") if not applicable to the data\nsource, and empty if not applicable to the table.\n\nTABLENAME: The table identifier.\n\nNONUNIQUE: Unique index indicator. Returns 0 for unique indexes, 1 for non-unique indexes\n\nINDEXQUALIFIER: Index qualifier identifier. The identifier that is used to qualify the index\nname when doing a \"DROP INDEX\"; NULL (\"undef\") is returned if an index qualifier is not\nsupported by the data source. If a non-NULL (defined) value is returned in this column, it must\nbe used to qualify the index name on a \"DROP INDEX\" statement; otherwise, the TABLESCHEM should\nbe used to qualify the index name.\n\nINDEXNAME: The index identifier.\n\nTYPE: The type of information being returned. Can be any of the following values: 'table',\n'btree', 'clustered', 'content', 'hashed', or 'other'.\n\nIn the case that this field is 'table', all fields other than TABLECAT, TABLESCHEM,\nTABLENAME, TYPE, CARDINALITY, and PAGES will be NULL (\"undef\").\n\nORDINALPOSITION: Column sequence number (starting with 1).\n\nCOLUMNNAME: The column identifier.\n\nASCORDESC: Column sort sequence. \"A\" for Ascending, \"D\" for Descending, or NULL (\"undef\") if\nnot supported for this index.\n\nCARDINALITY: Cardinality of the table or index. For indexes, this is the number of unique values\nin the index. For tables, this is the number of rows in the table. If not supported, the value\nwill be NULL (\"undef\").\n\nPAGES: Number of storage pages used by this table or index. If not supported, the value will be\nNULL (\"undef\").\n\nFILTERCONDITION: The index filter condition as a string. If the index is not a filtered index,\nor it cannot be determined whether the index is a filtered index, this value is NULL (\"undef\").\nIf the index is a filtered index, but the filter condition cannot be determined, this value is\nthe empty string ''. Otherwise it will be the literal filter condition as a string, such as\n\"SALARY <= 4500\".\n\nSee also \"Catalog Methods\" and \"Standards Reference Information\".\n\n\"tables\"\n@names = $dbh->tables( $catalog, $schema, $table, $type );\n@names = $dbh->tables;        # deprecated\n\nSimple interface to tableinfo(). Returns a list of matching table names, possibly including a\ncatalog/schema prefix.\n\nSee \"tableinfo\" for a description of the parameters.\n\nIf \"$dbh->getinfo(29)\" returns true (29 is SQLIDENTIFIERQUOTECHAR) then the table names are\nconstructed and quoted by \"quoteidentifier\" to ensure they are usable even if they contain\nwhitespace or reserved words etc. This means that the table names returned will include quote\ncharacters.\n\n\"typeinfoall\"\n$typeinfoall = $dbh->typeinfoall;\n\nReturns a reference to an array which holds information about each data type variant supported\nby the database and driver. The array and its contents should be treated as read-only.\n\nThe first item is a reference to an 'index' hash of \"Name =\"> \"Index\" pairs. The items following\nthat are references to arrays, one per supported data type variant. The leading index hash\ndefines the names and order of the fields within the arrays that follow it. For example:\n\n$typeinfoall = [\n{   TYPENAME         => 0,\nDATATYPE         => 1,\nCOLUMNSIZE       => 2,     # was PRECISION originally\nLITERALPREFIX    => 3,\nLITERALSUFFIX    => 4,\nCREATEPARAMS     => 5,\nNULLABLE          => 6,\nCASESENSITIVE    => 7,\nSEARCHABLE        => 8,\nUNSIGNEDATTRIBUTE=> 9,\nFIXEDPRECSCALE  => 10,    # was MONEY originally\nAUTOUNIQUEVALUE => 11,    # was AUTOINCREMENT originally\nLOCALTYPENAME   => 12,\nMINIMUMSCALE     => 13,\nMAXIMUMSCALE     => 14,\nSQLDATATYPE     => 15,\nSQLDATETIMESUB  => 16,\nNUMPRECRADIX    => 17,\nINTERVALPRECISION=> 18,\n},\n[ 'VARCHAR', SQLVARCHAR,\nundef, \"'\",\"'\", undef,0, 1,1,0,0,0,undef,1,255, undef\n],\n[ 'INTEGER', SQLINTEGER,\nundef,  \"\", \"\", undef,0, 0,1,0,0,0,undef,0,  0, 10\n],\n];\n\nMore than one row may have the same value in the \"DATATYPE\" field if there are different ways\nto spell the type name and/or there are variants of the type with different attributes (e.g.,\nwith and without \"AUTOUNIQUEVALUE\" set, with and without \"UNSIGNEDATTRIBUTE\", etc).\n\nThe rows are ordered by \"DATATYPE\" first and then by how closely each type maps to the\ncorresponding ODBC SQL data type, closest first.\n\nThe meaning of the fields is described in the documentation for the \"typeinfo\" method.\n\nAn 'index' hash is provided so you don't need to rely on index values defined above. However,\nusing DBD::ODBC with some old ODBC drivers may return older names, shown as comments in the\nexample above. Another issue with the index hash is that the lettercase of the keys is not\ndefined. It is usually uppercase, as show here, but drivers may return names with any\nlettercase.\n\nDrivers are also free to return extra driver-specific columns of information - though it's\nrecommended that they start at column index 50 to leave room for expansion of the DBI/ODBC\nspecification.\n\nThe typeinfoall() method is not normally used directly. The \"typeinfo\" method provides a more\nusable and useful interface to the data.\n\n\"typeinfo\"\n@typeinfo = $dbh->typeinfo($datatype);\n\nReturns a list of hash references holding information about one or more variants of $datatype.\nThe list is ordered by \"DATATYPE\" first and then by how closely each type maps to the\ncorresponding ODBC SQL data type, closest first. If called in a scalar context then only the\nfirst (best) element is returned.\n\nIf $datatype is undefined or \"SQLALLTYPES\", then the list will contain hashes for all data\ntype variants supported by the database and driver.\n\nIf $datatype is an array reference then \"typeinfo\" returns the information for the *first*\ntype in the array that has any matches.\n\nThe keys of the hash follow the same letter case conventions as the rest of the DBI (see \"Naming\nConventions and Name Space\"). The following uppercase items should always exist, though may be\nundef:\n\nTYPENAME (string)\nData type name for use in CREATE TABLE statements etc.\n\nDATATYPE (integer)\nSQL data type number.\n\nCOLUMNSIZE (integer)\nFor numeric types, this is either the total number of digits (if the NUMPRECRADIX value is\n10) or the total number of bits allowed in the column (if NUMPRECRADIX is 2).\n\nFor string types, this is the maximum size of the string in characters.\n\nFor date and interval types, this is the maximum number of characters needed to display the\nvalue.\n\nLITERALPREFIX (string)\nCharacters used to prefix a literal. A typical prefix is \"\"'\"\" for characters, or possibly\n\"\"0x\"\" for binary values passed as hexadecimal. NULL (\"undef\") is returned for data types\nfor which this is not applicable.\n\nLITERALSUFFIX (string)\nCharacters used to suffix a literal. Typically \"\"'\"\" for characters. NULL (\"undef\") is\nreturned for data types where this is not applicable.\n\nCREATEPARAMS (string)\nParameter names for data type definition. For example, \"CREATEPARAMS\" for a \"DECIMAL\" would\nbe \"\"precision,scale\"\" if the DECIMAL type should be declared as\n\"DECIMAL(\"*precision,scale*\")\" where *precision* and *scale* are integer values. For a\n\"VARCHAR\" it would be \"\"max length\"\". NULL (\"undef\") is returned for data types for which\nthis is not applicable.\n\nNULLABLE (integer)\nIndicates whether the data type accepts a NULL value: 0 or an empty string = no, 1 = yes, 2\n= unknown.\n\nCASESENSITIVE (boolean)\nIndicates whether the data type is case sensitive in collations and comparisons.\n\nSEARCHABLE (integer)\nIndicates how the data type can be used in a WHERE clause, as follows:\n\n0 - Cannot be used in a WHERE clause\n1 - Only with a LIKE predicate\n2 - All comparison operators except LIKE\n3 - Can be used in a WHERE clause with any comparison operator\n\nUNSIGNEDATTRIBUTE (boolean)\nIndicates whether the data type is unsigned. NULL (\"undef\") is returned for data types for\nwhich this is not applicable.\n\nFIXEDPRECSCALE (boolean)\nIndicates whether the data type always has the same precision and scale (such as a money\ntype). NULL (\"undef\") is returned for data types for which this is not applicable.\n\nAUTOUNIQUEVALUE (boolean)\nIndicates whether a column of this data type is automatically set to a unique value whenever\na new row is inserted. NULL (\"undef\") is returned for data types for which this is not\napplicable.\n\nLOCALTYPENAME (string)\nLocalized version of the \"TYPENAME\" for use in dialog with users. NULL (\"undef\") is\nreturned if a localized name is not available (in which case \"TYPENAME\" should be used).\n\nMINIMUMSCALE (integer)\nThe minimum scale of the data type. If a data type has a fixed scale, then \"MAXIMUMSCALE\"\nholds the same value. NULL (\"undef\") is returned for data types for which this is not\napplicable.\n\nMAXIMUMSCALE (integer)\nThe maximum scale of the data type. If a data type has a fixed scale, then \"MINIMUMSCALE\"\nholds the same value. NULL (\"undef\") is returned for data types for which this is not\napplicable.\n\nSQLDATATYPE (integer)\nThis column is the same as the \"DATATYPE\" column, except for interval and datetime data\ntypes. For interval and datetime data types, the \"SQLDATATYPE\" field will return\n\"SQLINTERVAL\" or \"SQLDATETIME\", and the \"SQLDATETIMESUB\" field below will return the\nsubcode for the specific interval or datetime data type. If this field is NULL, then the\ndriver does not support or report on interval or datetime subtypes.\n\nSQLDATETIMESUB (integer)\nFor interval or datetime data types, where the \"SQLDATATYPE\" field above is \"SQLINTERVAL\"\nor \"SQLDATETIME\", this field will hold the *subcode* for the specific interval or datetime\ndata type. Otherwise it will be NULL (\"undef\").\n\nAlthough not mentioned explicitly in the standards, it seems there is a simple relationship\nbetween these values:\n\nDATATYPE == (10 * SQLDATATYPE) + SQLDATETIMESUB\n\nNUMPRECRADIX (integer)\nThe radix value of the data type. For approximate numeric types, \"NUMPRECRADIX\" contains\nthe value 2 and \"COLUMNSIZE\" holds the number of bits. For exact numeric types,\n\"NUMPRECRADIX\" contains the value 10 and \"COLUMNSIZE\" holds the number of decimal digits.\nNULL (\"undef\") is returned either for data types for which this is not applicable or if the\ndriver cannot report this information.\n\nINTERVALPRECISION (integer)\nThe interval leading precision for interval types. NULL is returned either for data types\nfor which this is not applicable or if the driver cannot report this information.\n\nFor example, to find the type name for the fields in a select statement you can do:\n\n@names = map { scalar $dbh->typeinfo($)->{TYPENAME} } @{ $sth->{TYPE} }\n\nSince DBI and ODBC drivers vary in how they map their types into the ISO standard types you may\nneed to search for more than one type. Here's an example looking for a usable type to store a\ndate:\n\n$mydatetype = $dbh->typeinfo( [ SQLDATE, SQLTIMESTAMP ] );\n\nSimilarly, to more reliably find a type to store small integers, you could use a list starting\nwith \"SQLSMALLINT\", \"SQLINTEGER\", \"SQLDECIMAL\", etc.\n\nSee also \"Standards Reference Information\".\n\n\"quote\"\n$sql = $dbh->quote($value);\n$sql = $dbh->quote($value, $datatype);\n\nQuote a string literal for use as a literal value in an SQL statement, by escaping any special\ncharacters (such as quotation marks) contained within the string and adding the required type of\nouter quotation marks.\n\n$sql = sprintf \"SELECT foo FROM bar WHERE baz = %s\",\n$dbh->quote(\"Don't\");\n\nFor most database types, at least those that conform to SQL standards, quote would return\n'Don''t' (including the outer quotation marks). For others it may return something like 'Don\\'t'\n\nAn undefined $value value will be returned as the string \"NULL\" (without single quotation marks)\nto match how NULLs are represented in SQL.\n\nIf $datatype is supplied, it is used to try to determine the required quoting behaviour by\nusing the information returned by \"typeinfo\". As a special case, the standard numeric types are\noptimized to return $value without calling \"typeinfo\".\n\nQuote will probably *not* be able to deal with all possible input (such as binary data or data\ncontaining newlines), and is not related in any way with escaping or quoting shell\nmeta-characters.\n\nIt is valid for the quote() method to return an SQL expression that evaluates to the desired\nstring. For example:\n\n$quoted = $dbh->quote(\"one\\ntwo\\0three\")\n\nmay return something like:\n\nCONCAT('one', CHAR(12), 'two', CHAR(0), 'three')\n\nThe quote() method should *not* be used with \"Placeholders and Bind Values\".\n\n\"quoteidentifier\"\n$sql = $dbh->quoteidentifier( $name );\n$sql = $dbh->quoteidentifier( $catalog, $schema, $table, \\%attr );\n\nQuote an identifier (table name etc.) for use in an SQL statement, by escaping any special\ncharacters (such as double quotation marks) it contains and adding the required type of outer\nquotation marks.\n\nUndefined names are ignored and the remainder are quoted and then joined together, typically\nwith a dot (\".\") character. For example:\n\n$id = $dbh->quoteidentifier( undef, 'Her schema', 'My table' );\n\nwould, for most database types, return \"Her schema\".\"My table\" (including all the double\nquotation marks).\n\nIf three names are supplied then the first is assumed to be a catalog name and special rules may\nbe applied based on what \"getinfo\" returns for SQLCATALOGNAMESEPARATOR (41) and\nSQLCATALOGLOCATION (114). For example, for Oracle:\n\n$id = $dbh->quoteidentifier( 'link', 'schema', 'table' );\n\nwould return \"schema\".\"table\"@\"link\".\n\n\"takeimpdata\"\n$impdata = $dbh->takeimpdata;\n\nLeaves the $dbh in an almost dead, zombie-like, state and returns a binary string of raw\nimplementation data from the driver which describes the current database connection. Effectively\nit detaches the underlying database API connection data from the DBI handle. After calling"
                    },
                    {
                        "name": "take_imp_data",
                        "content": "Why would you want to do this? You don't, forget I even mentioned it. Unless, that is, you're\nimplementing something advanced like a multi-threaded connection pool. See DBI::Pool.\n\nThe returned $impdata can be passed as a \"dbiimpdata\" attribute to a later connect() call,\neven in a separate thread in the same process, where the driver can use it to 'adopt' the\nexisting connection that the implementation data was taken from.\n\nSome things to keep in mind...\n\n* the $impdata holds the only reference to the underlying database API connection data. That\nconnection is still 'live' and won't be cleaned up properly unless the $impdata is used to\ncreate a new $dbh which is then allowed to disconnect() normally.\n\n* using the same $impdata to create more than one other new $dbh at a time may well lead to\nunpleasant problems. Don't do that.\n\nAny child statement handles are effectively destroyed when takeimpdata() is called.\n\nThe \"takeimpdata\" method was added in DBI 1.36 but wasn't useful till 1.49.\n"
                    },
                    {
                        "name": "Database Handle Attributes",
                        "content": "This section describes attributes specific to database handles.\n\nChanges to these database handle attributes do not affect any other existing or future database\nhandles.\n\nAttempting to set or get the value of an unknown attribute generates a warning, except for\nprivate driver-specific attributes (which all have names starting with a lowercase letter).\n\nExample:\n\n$h->{AutoCommit} = ...;       # set/write\n... = $h->{AutoCommit};       # get/read\n\n\"AutoCommit\"\nType: boolean\n\nIf true, then database changes cannot be rolled-back (undone). If false, then database changes\nautomatically occur within a \"transaction\", which must either be committed or rolled back using\nthe \"commit\" or \"rollback\" methods.\n\nDrivers should always default to \"AutoCommit\" mode (an unfortunate choice largely forced on the\nDBI by ODBC and JDBC conventions.)\n\nAttempting to set \"AutoCommit\" to an unsupported value is a fatal error. This is an important\nfeature of the DBI. Applications that need full transaction behaviour can set\n\"$dbh->{AutoCommit} = 0\" (or set \"AutoCommit\" to 0 via \"connect\") without having to check that\nthe value was assigned successfully.\n\nFor the purposes of this description, we can divide databases into three categories:\n\nDatabases which don't support transactions at all.\nDatabases in which a transaction is always active.\nDatabases in which a transaction must be explicitly started (C<'BEGIN WORK'>).\n\n* Databases which don't support transactions at all\n\nFor these databases, attempting to turn \"AutoCommit\" off is a fatal error. \"commit\" and\n\"rollback\" both issue warnings about being ineffective while \"AutoCommit\" is in effect.\n\n* Databases in which a transaction is always active\n\nThese are typically mainstream commercial relational databases with \"ANSI standard\" transaction\nbehaviour. If \"AutoCommit\" is off, then changes to the database won't have any lasting effect\nunless \"commit\" is called (but see also \"disconnect\"). If \"rollback\" is called then any changes\nsince the last commit are undone.\n\nIf \"AutoCommit\" is on, then the effect is the same as if the DBI called \"commit\" automatically\nafter every successful database operation. So calling \"commit\" or \"rollback\" explicitly while\n\"AutoCommit\" is on would be ineffective because the changes would have already been committed.\n\nChanging \"AutoCommit\" from off to on will trigger a \"commit\".\n\nFor databases which don't support a specific auto-commit mode, the driver has to commit each\nstatement automatically using an explicit \"COMMIT\" after it completes successfully (and roll it\nback using an explicit \"ROLLBACK\" if it fails). The error information reported to the\napplication will correspond to the statement which was executed, unless it succeeded and the\ncommit or rollback failed.\n\n* Databases in which a transaction must be explicitly started\n\nFor these databases, the intention is to have them act like databases in which a transaction is\nalways active (as described above).\n\nTo do this, the driver will automatically begin an explicit transaction when \"AutoCommit\" is\nturned off, or after a \"commit\" or \"rollback\" (or when the application issues the next database\noperation after one of those events).\n\nIn this way, the application does not have to treat these databases as a special case.\n\nSee \"commit\", \"disconnect\" and \"Transactions\" for other important notes about transactions.\n\n\"Driver\"\nType: handle\n\nHolds the handle of the parent driver. The only recommended use for this is to find the name of\nthe driver using:\n\n$dbh->{Driver}->{Name}\n\n\"Name\"\nType: string\n\nHolds the \"name\" of the database. Usually (and recommended to be) the same as the\n\"\"dbi:DriverName:...\"\" string used to connect to the database, but with the leading\n\"\"dbi:DriverName:\"\" removed.\n\n\"Statement\"\nType: string, read-only\n\nReturns the statement string passed to the most recent \"prepare\" or \"do\" method called in this\ndatabase handle, even if that method failed. This is especially useful where \"RaiseError\" is\nenabled and the exception handler checks $@ and sees that a 'prepare' method call failed.\n\n\"RowCacheSize\"\nType: integer\n\nA hint to the driver indicating the size of the local row cache that the application would like\nthe driver to use for future \"SELECT\" statements. If a row cache is not implemented, then\nsetting \"RowCacheSize\" is ignored and getting the value returns \"undef\".\n\nSome \"RowCacheSize\" values have special meaning, as follows:\n\n0 - Automatically determine a reasonable cache size for each C<SELECT>\n1 - Disable the local row cache\n>1 - Cache this many rows\n<0 - Cache as many rows that will fit into this much memory for each C<SELECT>.\n\nNote that large cache sizes may require a very large amount of memory (*cached rows * maximum\nsize of row*). Also, a large cache will cause a longer delay not only for the first fetch, but\nalso whenever the cache needs refilling.\n\nSee also the \"RowsInCache\" statement handle attribute.\n\n\"Username\"\nType: string\n\nReturns the username used to connect to the database.\n"
                    }
                ]
            },
            "DBI STATEMENT HANDLE OBJECTS": {
                "content": "This section lists the methods and attributes associated with DBI statement handles.\n",
                "subsections": [
                    {
                        "name": "Statement Handle Methods",
                        "content": "The DBI defines the following methods for use on DBI statement handles:\n\n\"bindparam\"\n$sth->bindparam($pnum, $bindvalue)\n$sth->bindparam($pnum, $bindvalue, \\%attr)\n$sth->bindparam($pnum, $bindvalue, $bindtype)\n\nThe \"bindparam\" method takes a copy of $bindvalue and associates it (binds it) with a\nplaceholder, identified by $pnum, embedded in the prepared statement. Placeholders are\nindicated with question mark character (\"?\"). For example:\n\n$dbh->{RaiseError} = 1;        # save having to check each method call\n$sth = $dbh->prepare(\"SELECT name, age FROM people WHERE name LIKE ?\");\n$sth->bindparam(1, \"John%\");  # placeholders are numbered from 1\n$sth->execute;\nDBI::dumpresults($sth);\n\nSee \"Placeholders and Bind Values\" for more information.\n\nData Types for Placeholders\n\nThe \"\\%attr\" parameter can be used to hint at the data type the placeholder should have. This is\nrarely needed. Typically, the driver is only interested in knowing if the placeholder should be\nbound as a number or a string.\n\n$sth->bindparam(1, $value, { TYPE => SQLINTEGER });\n\nAs a short-cut for the common case, the data type can be passed directly, in place of the\n\"\\%attr\" hash reference. This example is equivalent to the one above:\n\n$sth->bindparam(1, $value, SQLINTEGER);\n\nThe \"TYPE\" value indicates the standard (non-driver-specific) type for this parameter. To\nspecify the driver-specific type, the driver may support a driver-specific attribute, such as \"{\noratype => 97 }\".\n\nThe SQLINTEGER and other related constants can be imported using\n\nuse DBI qw(:sqltypes);\n\nSee \"DBI Constants\" for more information.\n\nThe data type is 'sticky' in that bind values passed to execute() are bound with the data type\nspecified by earlier bindparam() calls, if any. Portable applications should not rely on being\nable to change the data type after the first \"bindparam\" call.\n\nPerl only has string and number scalar data types. All database types that aren't numbers are\nbound as strings and must be in a format the database will understand except where the"
                    },
                    {
                        "name": "bind_param",
                        "content": "given:\n\n$sth->bindparam(1, $value, SQLDATETIME);\n\nthe driver should expect $value to be in the ODBC standard SQLDATETIME format, which is\n'YYYY-MM-DD HH:MM:SS'. Similarly for SQLDATE, SQLTIME etc.\n\nAs an alternative to specifying the data type in the \"bindparam\" call, you can let the driver\npass the value as the default type (\"VARCHAR\"). You can then use an SQL function to convert the\ntype within the statement. For example:\n\nINSERT INTO price(code, price) VALUES (?, CONVERT(MONEY,?))\n\nThe \"CONVERT\" function used here is just an example. The actual function and syntax will vary\nbetween different databases and is non-portable.\n\nSee also \"Placeholders and Bind Values\" for more information.\n\n\"bindparaminout\"\n$rc = $sth->bindparaminout($pnum, \\$bindvalue, $maxlen)  or die $sth->errstr;\n$rv = $sth->bindparaminout($pnum, \\$bindvalue, $maxlen, \\%attr)     or ...\n$rv = $sth->bindparaminout($pnum, \\$bindvalue, $maxlen, $bindtype) or ...\n\nThis method acts like \"bindparam\", but also enables values to be updated by the statement. The\nstatement is typically a call to a stored procedure. The $bindvalue must be passed as a\nreference to the actual value to be used.\n\nNote that unlike \"bindparam\", the $bindvalue variable is not copied when \"bindparaminout\" is\ncalled. Instead, the value in the variable is read at the time \"execute\" is called.\n\nThe additional $maxlen parameter specifies the minimum amount of memory to allocate to\n$bindvalue for the new value. If the value returned from the database is too big to fit, then\nthe execution should fail. If unsure what value to use, pick a generous length, i.e., a length\nlarger than the longest value that would ever be returned. The only cost of using a larger value\nthan needed is wasted memory.\n\nUndefined values or \"undef\" are used to indicate null values. See also \"Placeholders and Bind\nValues\" for more information.\n\n\"bindparamarray\"\n$rc = $sth->bindparamarray($pnum, $arrayreforvalue)\n$rc = $sth->bindparamarray($pnum, $arrayreforvalue, \\%attr)\n$rc = $sth->bindparamarray($pnum, $arrayreforvalue, $bindtype)\n\nThe \"bindparamarray\" method is used to bind an array of values to a placeholder embedded in\nthe prepared statement which is to be executed with \"executearray\". For example:\n\n$dbh->{RaiseError} = 1;        # save having to check each method call\n$sth = $dbh->prepare(\"INSERT INTO staff (firstname, lastname, dept) VALUES(?, ?, ?)\");\n$sth->bindparamarray(1, [ 'John', 'Mary', 'Tim' ]);\n$sth->bindparamarray(2, [ 'Booth', 'Todd', 'Robinson' ]);\n$sth->bindparamarray(3, \"SALES\"); # scalar will be reused for each row\n$sth->executearray( { ArrayTupleStatus => \\my @tuplestatus } );\n\nThe %attr ($bindtype) argument is the same as defined for \"bindparam\". Refer to \"bindparam\"\nfor general details on using placeholders.\n\n(Note that bindparamarray() can *not* be used to expand a placeholder into a list of values\nfor a statement like \"SELECT foo WHERE bar IN (?)\". A placeholder can only ever represent one\nvalue per execution.)\n\nScalar values, including \"undef\", may also be bound by \"bindparamarray\". In which case the\nsame value will be used for each \"execute\" call. Driver-specific implementations may behave\ndifferently, e.g., when binding to a stored procedure call, some databases may permit mixing\nscalars and arrays as arguments.\n\nThe default implementation provided by DBI (for drivers that have not implemented array binding)\nis to iteratively call \"execute\" for each parameter tuple provided in the bound arrays. Drivers\nmay provide more optimized implementations using whatever bulk operation support the database\nAPI provides. The default driver behaviour should match the default DBI behaviour, but always\nconsult your driver documentation as there may be driver specific issues to consider.\n\nNote that the default implementation currently only supports non-data returning statements\n(INSERT, UPDATE, but not SELECT). Also, \"bindparamarray\" and \"bindparam\" cannot be mixed in\nthe same statement execution, and \"bindparamarray\" must be used with \"executearray\"; using\n\"bindparamarray\" will have no effect for \"execute\".\n\nThe \"bindparamarray\" method was added in DBI 1.22.\n\n\"execute\"\n$rv = $sth->execute                or die $sth->errstr;\n$rv = $sth->execute(@bindvalues)  or die $sth->errstr;\n\nPerform whatever processing is necessary to execute the prepared statement. An \"undef\" is\nreturned if an error occurs. A successful \"execute\" always returns true regardless of the number\nof rows affected, even if it's zero (see below). It is always important to check the return\nstatus of \"execute\" (and most other DBI methods) for errors if you're not using \"RaiseError\".\n\nFor a *non*-\"SELECT\" statement, \"execute\" returns the number of rows affected, if known. If no\nrows were affected, then \"execute\" returns \"0E0\", which Perl will treat as 0 but will regard as\ntrue. Note that it is *not* an error for no rows to be affected by a statement. If the number of\nrows affected is not known, then \"execute\" returns -1.\n\nFor \"SELECT\" statements, execute simply \"starts\" the query within the database engine. Use one\nof the fetch methods to retrieve the data after calling \"execute\". The \"execute\" method does\n*not* return the number of rows that will be returned by the query (because most databases can't\ntell in advance), it simply returns a true value.\n\nYou can tell if the statement was a \"SELECT\" statement by checking if \"$sth->{NUMOFFIELDS}\" is\ngreater than zero after calling \"execute\".\n\nIf any arguments are given, then \"execute\" will effectively call \"bindparam\" for each value\nbefore executing the statement. Values bound in this way are usually treated as \"SQLVARCHAR\"\ntypes unless the driver can determine the correct type (which is rare), or unless \"bindparam\"\n(or \"bindparaminout\") has already been used to specify the type.\n\nNote that passing \"execute\" an empty array is the same as passing no arguments at all, which\nwill execute the statement with previously bound values. That's probably not what you want.\n\nIf execute() is called on a statement handle that's still active ($sth->{Active} is true) then\nit should effectively call finish() to tidy up the previous execution results before starting\nthis new execution.\n\n\"executearray\"\n$tuples = $sth->executearray(\\%attr) or die $sth->errstr;\n$tuples = $sth->executearray(\\%attr, @bindvalues) or die $sth->errstr;\n\n($tuples, $rows) = $sth->executearray(\\%attr) or die $sth->errstr;\n($tuples, $rows) = $sth->executearray(\\%attr, @bindvalues) or die $sth->errstr;\n\nExecute the prepared statement once for each parameter tuple (group of values) provided either\nin the @bindvalues, or by prior calls to \"bindparamarray\", or via a reference passed in\n\\%attr.\n\nWhen called in scalar context the executearray() method returns the number of tuples executed,\nor \"undef\" if an error occurred. Like execute(), a successful executearray() always returns\ntrue regardless of the number of tuples executed, even if it's zero. If there were any errors\nthe ArrayTupleStatus array can be used to discover which tuples failed and with what errors.\n\nWhen called in list context the executearray() method returns two scalars; $tuples is the same\nas calling executearray() in scalar context and $rows is the number of rows affected for each\ntuple, if available or -1 if the driver cannot determine this. NOTE, some drivers cannot\ndetermine the number of rows affected per tuple but can provide the number of rows affected for\nthe batch. If you are doing an update operation the returned rows affected may not be what you\nexpect if, for instance, one or more of the tuples affected the same row multiple times. Some\ndrivers may not yet support list context, in which case $rows will be undef, or may not be able\nto provide the number of rows affected when performing this batch operation, in which case $rows\nwill be -1.\n\nBind values for the tuples to be executed may be supplied row-wise by an \"ArrayTupleFetch\"\nattribute, or else column-wise in the @bindvalues argument, or else column-wise by prior calls\nto \"bindparamarray\".\n\nWhere column-wise binding is used (via the @bindvalues argument or calls to bindparamarray())\nthe maximum number of elements in any one of the bound value arrays determines the number of\ntuples executed. Placeholders with fewer values in their parameter arrays are treated as if\npadded with undef (NULL) values.\n\nIf a scalar value is bound, instead of an array reference, it is treated as a *variable* length\narray with all elements having the same value. It does not influence the number of tuples\nexecuted, so if all bound arrays have zero elements then zero tuples will be executed. If *all*\nbound values are scalars then one tuple will be executed, making executearray() act just like"
                    },
                    {
                        "name": "execute",
                        "content": "The \"ArrayTupleFetch\" attribute can be used to specify a reference to a subroutine that will be\ncalled to provide the bind values for each tuple execution. The subroutine should return an\nreference to an array which contains the appropriate number of bind values, or return an undef\nif there is no more data to execute.\n\nAs a convenience, the \"ArrayTupleFetch\" attribute can also be used to specify a statement\nhandle. In which case the fetchrowarrayref() method will be called on the given statement\nhandle in order to provide the bind values for each tuple execution.\n\nThe values specified via bindparamarray() or the @bindvalues parameter may be either scalars,\nor arrayrefs. If any @bindvalues are given, then \"executearray\" will effectively call\n\"bindparamarray\" for each value before executing the statement. Values bound in this way are\nusually treated as \"SQLVARCHAR\" types unless the driver can determine the correct type (which\nis rare), or unless \"bindparam\", \"bindparaminout\", \"bindparamarray\", or\n\"bindparaminoutarray\" has already been used to specify the type. See \"bindparamarray\" for\ndetails.\n\nThe \"ArrayTupleStatus\" attribute can be used to specify a reference to an array which will\nreceive the execute status of each executed parameter tuple. Note the \"ArrayTupleStatus\"\nattribute was mandatory until DBI 1.38.\n\nFor tuples which are successfully executed, the element at the same ordinal position in the\nstatus array is the resulting rowcount (or -1 if unknown). If the execution of a tuple causes an\nerror, then the corresponding status array element will be set to a reference to an array\ncontaining \"err\", \"errstr\" and \"state\" set by the failed execution.\n\nIf any tuple execution returns an error, \"executearray\" will return \"undef\". In that case, the\napplication should inspect the status array to determine which parameter tuples failed. Some\ndatabases may not continue executing tuples beyond the first failure. In this case the status\narray will either hold fewer elements, or the elements beyond the failure will be undef.\n\nIf all parameter tuples are successfully executed, \"executearray\" returns the number tuples\nexecuted. If no tuples were executed, then executearray() returns \"0E0\", just like execute()\ndoes, which Perl will treat as 0 but will regard as true.\n\nFor example:\n\n$sth = $dbh->prepare(\"INSERT INTO staff (firstname, lastname) VALUES (?, ?)\");\nmy $tuples = $sth->executearray(\n{ ArrayTupleStatus => \\my @tuplestatus },\n\\@firstnames,\n\\@lastnames,\n);\nif ($tuples) {\nprint \"Successfully inserted $tuples records\\n\";\n}\nelse {\nfor my $tuple (0..@lastnames-1) {\nmy $status = $tuplestatus[$tuple];\n$status = [0, \"Skipped\"] unless defined $status;\nnext unless ref $status;\nprintf \"Failed to insert (%s, %s): %s\\n\",\n$firstnames[$tuple], $lastnames[$tuple], $status->[1];\n}\n}\n\nSupport for data returning statements such as SELECT is driver-specific and subject to change.\nAt present, the default implementation provided by DBI only supports non-data returning\nstatements.\n\nTransaction semantics when using array binding are driver and database specific. If \"AutoCommit\"\nis on, the default DBI implementation will cause each parameter tuple to be individually\ncommitted (or rolled back in the event of an error). If \"AutoCommit\" is off, the application is\nresponsible for explicitly committing the entire set of bound parameter tuples. Note that\ndifferent drivers and databases may have different behaviours when some parameter tuples cause\nfailures. In some cases, the driver or database may automatically rollback the effect of all\nprior parameter tuples that succeeded in the transaction; other drivers or databases may retain\nthe effect of prior successfully executed parameter tuples. Be sure to check your driver and\ndatabase for its specific behaviour.\n\nNote that, in general, performance will usually be better with \"AutoCommit\" turned off, and\nusing explicit \"commit\" after each \"executearray\" call.\n\nThe \"executearray\" method was added in DBI 1.22, and ArrayTupleFetch was added in 1.36.\n\n\"executeforfetch\"\n$tuples = $sth->executeforfetch($fetchtuplesub);\n$tuples = $sth->executeforfetch($fetchtuplesub, \\@tuplestatus);\n\n($tuples, $rows) = $sth->executeforfetch($fetchtuplesub);\n($tuples, $rows) = $sth->executeforfetch($fetchtuplesub, \\@tuplestatus);\n\nThe executeforfetch() method is used to perform bulk operations and although it is most often\nused via the executearray() method you can use it directly. The main difference between\nexecutearray and executeforfetch is the former does column or row-wise binding and the latter\nuses row-wise binding.\n\nThe fetch subroutine, referenced by $fetchtuplesub, is expected to return a reference to an\narray (known as a 'tuple') or undef.\n\nThe executeforfetch() method calls $fetchtuplesub, without any parameters, until it returns\na false value. Each tuple returned is used to provide bind values for an $sth->execute(@$tuple)\ncall.\n\nIn scalar context executeforfetch() returns \"undef\" if there were any errors and the number of\ntuples executed otherwise. Like execute() and executearray() a zero is returned as \"0E0\" so"
                    },
                    {
                        "name": "execute_for_fetch",
                        "content": "be used to discover which tuples failed and with what errors.\n\nWhen called in list context executeforfetch() returns two scalars; $tuples is the same as\ncalling executeforfetch() in scalar context and $rows is the sum of the number of rows\naffected for each tuple, if available or -1 if the driver cannot determine this. If you are\ndoing an update operation the returned rows affected may not be what you expect if, for\ninstance, one or more of the tuples affected the same row multiple times. Some drivers may not\nyet support list context, in which case $rows will be undef, or may not be able to provide the\nnumber of rows affected when performing this batch operation, in which case $rows will be -1.\n\nIf \\@tuplestatus is passed then the executeforfetch method uses it to return status\ninformation. The tuplestatus array holds one element per tuple. If the corresponding execute()\ndid not fail then the element holds the return value from execute(), which is typically a row\ncount. If the execute() did fail then the element holds a reference to an array containing\n($sth->err, $sth->errstr, $sth->state).\n\nIf the driver detects an error that it knows means no further tuples can be executed then it may\nreturn, with an error status, even though $fetchtuplesub may still have more tuples to be\nexecuted.\n\nAlthough each tuple returned by $fetchtuplesub is effectively used to call\n$sth->execute(@$tuplearrayref) the exact timing may vary. Drivers are free to accumulate sets\nof tuples to pass to the database server in bulk group operations for more efficient execution.\nHowever, the $fetchtuplesub is specifically allowed to return the same array reference each\ntime (which is what fetchrowarrayref() usually does).\n\nFor example:\n\nmy $sel = $dbh1->prepare(\"select foo, bar from table1\");\n$sel->execute;\n\nmy $ins = $dbh2->prepare(\"insert into table2 (foo, bar) values (?,?)\");\nmy $fetchtuplesub = sub { $sel->fetchrowarrayref };\n\nmy @tuplestatus;\n$rc = $ins->executeforfetch($fetchtuplesub, \\@tuplestatus);\nmy @errors = grep { ref $ } @tuplestatus;\n\nSimilarly, if you already have an array containing the data rows to be processed you'd use a\nsubroutine to shift off and return each array ref in turn:\n\n$ins->executeforfetch( sub { shift @arrayofarrays }, \\@tuplestatus);\n\nThe \"executeforfetch\" method was added in DBI 1.38.\n\n\"lastinsertid\"\n$rv = $sth->lastinsertid();\n$rv = $sth->lastinsertid($catalog, $schema, $table, $field);\n$rv = $sth->lastinsertid($catalog, $schema, $table, $field, \\%attr);\n\nReturns a value 'identifying' the row inserted by last execution of the statement $sth, if\npossible.\n\nFor some drivers the value may be 'identifying' the row inserted by the last executed statement,\nnot by $sth.\n\nSee database handle method lastinsertid for all details.\n\nThe \"lastinsertid\" statement method was added in DBI 1.642.\n\n\"fetchrowarrayref\"\n$aryref = $sth->fetchrowarrayref;\n$aryref = $sth->fetch;    # alias\n\nFetches the next row of data and returns a reference to an array holding the field values. Null\nfields are returned as \"undef\" values in the array. This is the fastest way to fetch data,\nparticularly if used with \"$sth->bindcolumns\".\n\nIf there are no more rows or if an error occurs, then \"fetchrowarrayref\" returns an \"undef\".\nYou should check \"$sth->err\" afterwards (or use the \"RaiseError\" attribute) to discover if the\n\"undef\" returned was due to an error.\n\nNote that the same array reference is returned for each fetch, so don't store the reference and\nthen use it after a later fetch. Also, the elements of the array are also reused for each row,\nso take care if you want to take a reference to an element. See also \"bindcolumns\".\n\n\"fetchrowarray\"\n@ary = $sth->fetchrowarray;\n\nAn alternative to \"fetchrowarrayref\". Fetches the next row of data and returns it as a list\ncontaining the field values. Null fields are returned as \"undef\" values in the list.\n\nIf there are no more rows or if an error occurs, then \"fetchrowarray\" returns an empty list.\nYou should check \"$sth->err\" afterwards (or use the \"RaiseError\" attribute) to discover if the\nempty list returned was due to an error.\n\nIf called in a scalar context for a statement handle that has more than one column, it is\nundefined whether the driver will return the value of the first column or the last. So don't do\nthat. Also, in a scalar context, an \"undef\" is returned if there are no more rows or if an error\noccurred. That \"undef\" can't be distinguished from an \"undef\" returned because the first field\nvalue was NULL. For these reasons you should exercise some caution if you use \"fetchrowarray\"\nin a scalar context.\n\n\"fetchrowhashref\"\n$hashref = $sth->fetchrowhashref;\n$hashref = $sth->fetchrowhashref($name);\n\nAn alternative to \"fetchrowarrayref\". Fetches the next row of data and returns it as a\nreference to a hash containing field name and field value pairs. Null fields are returned as\n\"undef\" values in the hash.\n\nIf there are no more rows or if an error occurs, then \"fetchrowhashref\" returns an \"undef\". You\nshould check \"$sth->err\" afterwards (or use the \"RaiseError\" attribute) to discover if the\n\"undef\" returned was due to an error.\n\nThe optional $name parameter specifies the name of the statement handle attribute. For\nhistorical reasons it defaults to \"\"NAME\"\", however using either \"\"NAMElc\"\" or \"\"NAMEuc\"\" is\nrecommended for portability.\n\nThe keys of the hash are the same names returned by \"$sth->{$name}\". If more than one field has\nthe same name, there will only be one entry in the returned hash for those fields, so statements\nlike \"\"select foo, foo from bar\"\" will return only a single key from \"fetchrowhashref\". In\nthese cases use column aliases or \"fetchrowarrayref\". Note that it is the database server (and\nnot the DBD implementation) which provides the *name* for fields containing functions like\n\"count(*)\" or \"\"max(cfoo)\"\" and they may clash with existing column names (most databases don't\ncare about duplicate column names in a result-set). If you want these to return as unique names\nthat are the same across databases, use *aliases*, as in \"\"select count(*) as cnt\"\" or \"\"select"
                    },
                    {
                        "name": "max",
                        "content": "Because of the extra work \"fetchrowhashref\" and Perl have to perform, it is not as efficient as\n\"fetchrowarrayref\" or \"fetchrowarray\".\n\nBy default a reference to a new hash is returned for each row. It is likely that a future\nversion of the DBI will support an attribute which will enable the same hash to be reused for\neach row. This will give a significant performance boost, but it won't be enabled by default\nbecause of the risk of breaking old code.\n\n\"fetchallarrayref\"\n$tblaryref = $sth->fetchallarrayref;\n$tblaryref = $sth->fetchallarrayref( $slice );\n$tblaryref = $sth->fetchallarrayref( $slice, $maxrows  );\n\nThe \"fetchallarrayref\" method can be used to fetch all the data to be returned from a prepared\nand executed statement handle. It returns a reference to an array that contains one reference\nper row.\n\nIf called on an *inactive* statement handle, \"fetchallarrayref\" returns undef.\n\nIf there are no rows left to return from an *active* statement handle, \"fetchallarrayref\"\nreturns a reference to an empty array. If an error occurs, \"fetchallarrayref\" returns the data\nfetched thus far, which may be none. You should check \"$sth->err\" afterwards (or use the\n\"RaiseError\" attribute) to discover if the data is complete or was truncated due to an error.\n\nIf $slice is an array reference, \"fetchallarrayref\" uses \"fetchrowarrayref\" to fetch each row\nas an array ref. If the $slice array is not empty then it is used as a slice to select\nindividual columns by perl array index number (starting at 0, unlike column and parameter\nnumbers which start at 1).\n\nWith no parameters, or if $slice is undefined, \"fetchallarrayref\" acts as if passed an empty\narray ref.\n\nFor example, to fetch just the first column of every row:\n\n$tblaryref = $sth->fetchallarrayref([0]);\n\nTo fetch the second to last and last column of every row:\n\n$tblaryref = $sth->fetchallarrayref([-2,-1]);\n\nThose two examples both return a reference to an array of array refs.\n\nIf $slice is a hash reference, \"fetchallarrayref\" fetches each row as a hash reference. If the\n$slice hash is empty then the keys in the hashes have whatever name lettercase is returned by\ndefault. (See \"FetchHashKeyName\" attribute.) If the $slice hash is *not* empty, then it is used\nas a slice to select individual columns by name. The values of the hash should be set to 1. The\nkey names of the returned hashes match the letter case of the names in the parameter hash,\nregardless of the \"FetchHashKeyName\" attribute.\n\nFor example, to fetch all fields of every row as a hash ref:\n\n$tblaryref = $sth->fetchallarrayref({});\n\nTo fetch only the fields called \"foo\" and \"bar\" of every row as a hash ref (with keys named\n\"foo\" and \"BAR\", regardless of the original capitalization):\n\n$tblaryref = $sth->fetchallarrayref({ foo=>1, BAR=>1 });\n\nThose two examples both return a reference to an array of hash refs.\n\nIf $slice is a *reference to a hash reference*, that hash is used to select and rename columns.\nThe keys are 0-based column index numbers and the values are the corresponding keys for the\nreturned row hashes.\n\nFor example, to fetch only the first and second columns of every row as a hash ref (with keys\nnamed \"k\" and \"v\" regardless of their original names):\n\n$tblaryref = $sth->fetchallarrayref( \\{ 0 => 'k', 1 => 'v' } );\n\nIf $maxrows is defined and greater than or equal to zero then it is used to limit the number of\nrows fetched before returning. fetchallarrayref() can then be called again to fetch more rows.\nThis is especially useful when you need the better performance of fetchallarrayref() but don't\nhave enough memory to fetch and return all the rows in one go.\n\nHere's an example (assumes RaiseError is enabled):\n\nmy $rows = []; # cache for batches of rows\nwhile( my $row = ( shift(@$rows) || # get row from cache, or reload cache:\nshift(@{$rows=$sth->fetchallarrayref(undef,10000)||[]}) )\n) {\n...\n}\n\nThat *might* be the fastest way to fetch and process lots of rows using the DBI, but it depends\non the relative cost of method calls vs memory allocation.\n\nA standard \"while\" loop with column binding is often faster because the cost of allocating\nmemory for the batch of rows is greater than the saving by reducing method calls. It's possible\nthat the DBI may provide a way to reuse the memory of a previous batch in future, which would\nthen shift the balance back towards fetchallarrayref().\n\n\"fetchallhashref\"\n$hashref = $sth->fetchallhashref($keyfield);\n\nThe \"fetchallhashref\" method can be used to fetch all the data to be returned from a prepared\nand executed statement handle. It returns a reference to a hash containing a key for each\ndistinct value of the $keyfield column that was fetched. For each key the corresponding value\nis a reference to a hash containing all the selected columns and their values, as returned by\n\"fetchrowhashref()\".\n\nIf there are no rows to return, \"fetchallhashref\" returns a reference to an empty hash. If an\nerror occurs, \"fetchallhashref\" returns the data fetched thus far, which may be none. You\nshould check \"$sth->err\" afterwards (or use the \"RaiseError\" attribute) to discover if the data\nis complete or was truncated due to an error.\n\nThe $keyfield parameter provides the name of the field that holds the value to be used for the\nkey for the returned hash. For example:\n\n$dbh->{FetchHashKeyName} = 'NAMElc';\n$sth = $dbh->prepare(\"SELECT FOO, BAR, ID, NAME, BAZ FROM TABLE\");\n$sth->execute;\n$hashref = $sth->fetchallhashref('id');\nprint \"Name for id 42 is $hashref->{42}->{name}\\n\";\n\nThe $keyfield parameter can also be specified as an integer column number (counting from 1). If\n$keyfield doesn't match any column in the statement, as a name first then as a number, then an\nerror is returned.\n\nFor queries returning more than one 'key' column, you can specify multiple column names by\npassing $keyfield as a reference to an array containing one or more key column names (or index\nnumbers). For example:\n\n$sth = $dbh->prepare(\"SELECT foo, bar, baz FROM table\");\n$sth->execute;\n$hashref = $sth->fetchallhashref( [ qw(foo bar) ] );\nprint \"For foo 42 and bar 38, baz is $hashref->{42}->{38}->{baz}\\n\";\n\nThe fetchallhashref() method is normally used only where the key fields values for each row are\nunique. If multiple rows are returned with the same values for the key fields then later rows\noverwrite earlier ones.\n\n\"finish\"\n$rc  = $sth->finish;\n\nIndicate that no more data will be fetched from this statement handle before it is either\nexecuted again or destroyed. You almost certainly do *not* need to call this method.\n\nAdding calls to \"finish\" after loop that fetches all rows is a common mistake, don't do it, it\ncan mask genuine problems like uncaught fetch errors.\n\nWhen all the data has been fetched from a \"SELECT\" statement, the driver will automatically call\n\"finish\" for you. So you should *not* call it explicitly *except* when you know that you've not\nfetched all the data from a statement handle *and* the handle won't be destroyed soon.\n\nThe most common example is when you only want to fetch just one row, but in that case the\n\"selectrow*\" methods are usually better anyway.\n\nConsider a query like:\n\nSELECT foo FROM table WHERE bar=? ORDER BY baz\n\non a very large table. When executed, the database server will have to use temporary buffer\nspace to store the sorted rows. If, after executing the handle and selecting just a few rows,\nthe handle won't be re-executed for some time and won't be destroyed, the \"finish\" method can be\nused to tell the server that the buffer space can be freed.\n\nCalling \"finish\" resets the \"Active\" attribute for the statement. It may also make some\nstatement handle attributes (such as \"NAME\" and \"TYPE\") unavailable if they have not already\nbeen accessed (and thus cached).\n\nThe \"finish\" method does not affect the transaction status of the database connection. It has\nnothing to do with transactions. It's mostly an internal \"housekeeping\" method that is rarely\nneeded. See also \"disconnect\" and the \"Active\" attribute.\n\nThe \"finish\" method should have been called \"discardpendingrows\".\n\n\"rows\"\n$rv = $sth->rows;\n\nReturns the number of rows affected by the last row affecting command, or -1 if the number of\nrows is not known or not available.\n\nGenerally, you can only rely on a row count after a *non*-\"SELECT\" \"execute\" (for some specific\noperations like \"UPDATE\" and \"DELETE\"), or after fetching all the rows of a \"SELECT\" statement.\n\nFor \"SELECT\" statements, it is generally not possible to know how many rows will be returned\nexcept by fetching them all. Some drivers will return the number of rows the application has\nfetched so far, but others may return -1 until all rows have been fetched. So use of the \"rows\"\nmethod or $DBI::rows with \"SELECT\" statements is not recommended.\n\nOne alternative method to get a row count for a \"SELECT\" is to execute a \"SELECT COUNT(*) FROM\n...\" SQL statement with the same \"...\" as your query and then fetch the row count from that.\n\n\"bindcol\"\n$rc = $sth->bindcol($columnnumber, \\$vartobind);\n$rc = $sth->bindcol($columnnumber, \\$vartobind, \\%attr );\n$rc = $sth->bindcol($columnnumber, \\$vartobind, $bindtype );\n\nBinds a Perl variable and/or some attributes to an output column (field) of a \"SELECT\"\nstatement. Column numbers count up from 1. You do not need to bind output columns in order to\nfetch data. For maximum portability between drivers, bindcol() should be called after execute()\nand not before. See also \"bindcolumns\" for an example.\n\nThe binding is performed at a low level using Perl aliasing. Whenever a row is fetched from the\ndatabase $vartobind appears to be automatically updated simply because it now refers to the\nsame memory location as the corresponding column value. This makes using bound variables very\nefficient. Binding a tied variable doesn't work, currently.\n\nThe \"bindparam\" method performs a similar, but opposite, function for input variables.\n\nData Types for Column Binding\n\nThe \"\\%attr\" parameter can be used to hint at the data type formatting the column should have.\nFor example, you can use:\n\n$sth->bindcol(1, undef, { TYPE => SQLDATETIME });\n\nto specify that you'd like the column (which presumably is some kind of datetime type) to be\nreturned in the standard format for SQLDATETIME, which is 'YYYY-MM-DD HH:MM:SS', rather than\nthe native formatting the database would normally use.\n\nThere's no $vartobind in that example to emphasize the point that bindcol() works on the\nunderlying column and not just a particular bound variable.\n\nAs a short-cut for the common case, the data type can be passed directly, in place of the\n\"\\%attr\" hash reference. This example is equivalent to the one above:\n\n$sth->bindcol(1, undef, SQLDATETIME);\n\nThe \"TYPE\" value indicates the standard (non-driver-specific) type for this parameter. To\nspecify the driver-specific type, the driver may support a driver-specific attribute, such as \"{\noratype => 97 }\".\n\nThe SQLDATETIME and other related constants can be imported using\n\nuse DBI qw(:sqltypes);\n\nSee \"DBI Constants\" for more information.\n\nFew drivers support specifying a data type via a \"bindcol\" call (most will simply ignore the\ndata type). Fewer still allow the data type to be altered once set. If you do set a column type\nthe type should remain sticky through further calls to bindcol for the same column if the type\nis not overridden (this is important for instance when you are using a slice in\nfetchallarrayref).\n\nThe TYPE attribute for bindcol() was first specified in DBI 1.41.\n\nFrom DBI 1.611, drivers can use the \"TYPE\" attribute to attempt to cast the bound scalar to a\nperl type which more closely matches \"TYPE\". At present DBI supports \"SQLINTEGER\", \"SQLDOUBLE\"\nand \"SQLNUMERIC\". See \"sqltypecast\" for details of how types are cast.\n\nOther attributes for Column Binding\n\nThe \"\\%attr\" parameter may also contain the following attributes:\n\n\"StrictlyTyped\"\nIf a \"TYPE\" attribute is passed to bindcol, then the driver will attempt to change the\nbound perl scalar to match the type more closely. If the bound value cannot be cast to the\nrequested \"TYPE\" then by default it is left untouched and no error is generated. If you\nspecify \"StrictlyTyped\" as 1 and the cast fails, this will generate an error.\n\nThis attribute was first added in DBI 1.611. When 1.611 was released few drivers actually\nsupported this attribute but DBD::Oracle and DBD::ODBC should from versions 1.24.\n\n\"DiscardString\"\nWhen the \"TYPE\" attribute is passed to \"bindcol\" and the driver successfully casts the\nbound perl scalar to a non-string type then if \"DiscardString\" is set to 1, the string\nportion of the scalar will be discarded. By default, \"DiscardString\" is not set.\n\nThis attribute was first added in DBI 1.611. When 1.611 was released few drivers actually\nsupported this attribute but DBD::Oracle and DBD::ODBC should from versions 1.24.\n\n\"bindcolumns\"\n$rc = $sth->bindcolumns(@listofrefstovarstobind);\n\nCalls \"bindcol\" for each column of the \"SELECT\" statement.\n\nThe list of references should have the same number of elements as the number of columns in the\n\"SELECT\" statement. If it doesn't then \"bindcolumns\" will bind the elements given, up to the\nnumber of columns, and then return an error.\n\nFor maximum portability between drivers, bindcolumns() should be called after execute() and not\nbefore.\n\nFor example:\n\n$dbh->{RaiseError} = 1; # do this, or check every call for errors\n$sth = $dbh->prepare(q{ SELECT region, sales FROM salesbyregion });\n$sth->execute;\nmy ($region, $sales);\n\n# Bind Perl variables to columns:\n$rv = $sth->bindcolumns(\\$region, \\$sales);\n\n# you can also use Perl's \\(...) syntax (see perlref docs):\n#     $sth->bindcolumns(\\($region, $sales));\n\n# Column binding is the most efficient way to fetch data\nwhile ($sth->fetch) {\nprint \"$region: $sales\\n\";\n}\n\nFor compatibility with old scripts, the first parameter will be ignored if it is \"undef\" or a\nhash reference.\n\nHere's a more fancy example that binds columns to the values *inside* a hash (thanks to H.Merijn\nBrand):\n\n$sth->execute;\nmy %row;\n$sth->bindcolumns( \\( @row{ @{$sth->{NAMElc} } } ));\nwhile ($sth->fetch) {\nprint \"$row{region}: $row{sales}\\n\";\n}\n\n\"dumpresults\"\n$rows = $sth->dumpresults($maxlen, $lsep, $fsep, $fh);\n\nFetches all the rows from $sth, calls \"DBI::neatlist\" for each row, and prints the results to\n$fh (defaults to \"STDOUT\") separated by $lsep (default \"\\n\"). $fsep defaults to \", \" and $maxlen\ndefaults to 35.\n\nThis method is designed as a handy utility for prototyping and testing queries. Since it uses\n\"neatlist\" to format and edit the string for reading by humans, it is not recommended for data\ntransfer applications.\n"
                    },
                    {
                        "name": "Statement Handle Attributes",
                        "content": "This section describes attributes specific to statement handles. Most of these attributes are\nread-only.\n\nChanges to these statement handle attributes do not affect any other existing or future\nstatement handles.\n\nAttempting to set or get the value of an unknown attribute generates a warning, except for\nprivate driver specific attributes (which all have names starting with a lowercase letter).\n\nExample:\n\n... = $h->{NUMOFFIELDS};    # get/read\n\nSome drivers cannot provide valid values for some or all of these attributes until after\n\"$sth->execute\" has been successfully called. Typically the attribute will be \"undef\" in these\nsituations.\n\nSome attributes, like NAME, are not appropriate to some types of statement, like SELECT.\nTypically the attribute will be \"undef\" in these situations.\n\nFor drivers which support stored procedures and multiple result sets (see \"moreresults\") these\nattributes relate to the *current* result set.\n\nSee also \"finish\" to learn more about the effect it may have on some attributes.\n\n\"NUMOFFIELDS\"\nType: integer, read-only\n\nNumber of fields (columns) in the data the prepared statement may return. Statements that don't\nreturn rows of data, like \"DELETE\" and \"CREATE\" set \"NUMOFFIELDS\" to 0 (though it may be undef\nin some drivers).\n\n\"NUMOFPARAMS\"\nType: integer, read-only\n\nThe number of parameters (placeholders) in the prepared statement. See SUBSTITUTION VARIABLES\nbelow for more details.\n\n\"NAME\"\nType: array-ref, read-only\n\nReturns a reference to an array of field names for each column. The names may contain spaces but\nshould not be truncated or have any trailing space. Note that the names have the letter case\n(upper, lower or mixed) as returned by the driver being used. Portable applications should use\n\"NAMElc\" or \"NAMEuc\".\n\nprint \"First column name: $sth->{NAME}->[0]\\n\";\n\nAlso note that the name returned for (aggregate) functions like count(*) or \"max(cfoo)\" is\ndetermined by the database server and not by \"DBI\" or the \"DBD\" backend.\n\n\"NAMElc\"\nType: array-ref, read-only\n\nLike \"/NAME\" but always returns lowercase names.\n\n\"NAMEuc\"\nType: array-ref, read-only\n\nLike \"/NAME\" but always returns uppercase names.\n\n\"NAMEhash\"\nType: hash-ref, read-only\n\n\"NAMElchash\"\nType: hash-ref, read-only\n\n\"NAMEuchash\"\nType: hash-ref, read-only\n\nThe \"NAMEhash\", \"NAMElchash\", and \"NAMEuchash\" attributes return column name information as\na reference to a hash.\n\nThe keys of the hash are the names of the columns. The letter case of the keys corresponds to\nthe letter case returned by the \"NAME\", \"NAMElc\", and \"NAMEuc\" attributes respectively (as\ndescribed above).\n\nThe value of each hash entry is the perl index number of the corresponding column (counting from\n0). For example:\n\n$sth = $dbh->prepare(\"select Id, Name from table\");\n$sth->execute;\n@row = $sth->fetchrowarray;\nprint \"Name $row[ $sth->{NAMElchash}{name} ]\\n\";\n\n\"TYPE\"\nType: array-ref, read-only\n\nReturns a reference to an array of integer values for each column. The value indicates the data\ntype of the corresponding column.\n\nThe values correspond to the international standards (ANSI X3.135 and ISO/IEC 9075) which, in\ngeneral terms, means ODBC. Driver-specific types that don't exactly match standard types should\ngenerally return the same values as an ODBC driver supplied by the makers of the database. That\nmight include private type numbers in ranges the vendor has officially registered with the ISO\nworking group:\n\nftp://sqlstandards.org/SC32/SQLRegistry/\n\nWhere there's no vendor-supplied ODBC driver to be compatible with, the DBI driver can use type\nnumbers in the range that is now officially reserved for use by the DBI: -9999 to -9000.\n\nAll possible values for \"TYPE\" should have at least one entry in the output of the\n\"typeinfoall\" method (see \"typeinfoall\").\n\n\"PRECISION\"\nType: array-ref, read-only\n\nReturns a reference to an array of integer values for each column.\n\nFor numeric columns, the value is the maximum number of digits (without considering a sign\ncharacter or decimal point). Note that the \"display size\" for floating point types (REAL, FLOAT,\nDOUBLE) can be up to 7 characters greater than the precision (for the sign + decimal point + the\nletter E + a sign + 2 or 3 digits).\n\nFor any character type column the value is the OCTETLENGTH, in other words the number of bytes,\nnot characters.\n\n(More recent standards refer to this as COLUMNSIZE but we stick with PRECISION for backwards\ncompatibility.)\n\n\"SCALE\"\nType: array-ref, read-only\n\nReturns a reference to an array of integer values for each column. NULL (\"undef\") values\nindicate columns where scale is not applicable.\n\n\"NULLABLE\"\nType: array-ref, read-only\n\nReturns a reference to an array indicating the possibility of each column returning a null.\nPossible values are 0 (or an empty string) = no, 1 = yes, 2 = unknown.\n\nprint \"First column may return NULL\\n\" if $sth->{NULLABLE}->[0];\n\n\"CursorName\"\nType: string, read-only\n\nReturns the name of the cursor associated with the statement handle, if available. If not\navailable or if the database driver does not support the \"where current of ...\" SQL syntax, then\nit returns \"undef\".\n\n\"Database\"\nType: dbh, read-only\n\nReturns the parent $dbh of the statement handle.\n\n\"Statement\"\nType: string, read-only\n\nReturns the statement string passed to the \"prepare\" method.\n\n\"ParamValues\"\nType: hash ref, read-only\n\nReturns a reference to a hash containing the values currently bound to placeholders. The keys of\nthe hash are the 'names' of the placeholders, typically integers starting at 1. Returns undef if\nnot supported by the driver.\n\nSee \"ShowErrorStatement\" for an example of how this is used.\n\n* Keys:\n\nIf the driver supports \"ParamValues\" but no values have been bound yet then the driver should\nreturn a hash with placeholders names in the keys but all the values undef, but some drivers may\nreturn a ref to an empty hash because they can't pre-determine the names.\n\nIt is possible that the keys in the hash returned by \"ParamValues\" are not exactly the same as\nthose implied by the prepared statement. For example, DBD::Oracle translates '\"?\"' placeholders\ninto '\":pN\"' where N is a sequence number starting at 1.\n\n* Values:\n\nIt is possible that the values in the hash returned by \"ParamValues\" are not *exactly* the same\nas those passed to bindparam() or execute(). The driver may have slightly modified values in\nsome way based on the TYPE the value was bound with. For example a floating point value bound as\nan SQLINTEGER type may be returned as an integer. The values returned by \"ParamValues\" can be\npassed to another bindparam() method with the same TYPE and will be seen by the database as the\nsame value. See also \"ParamTypes\" below.\n\nThe \"ParamValues\" attribute was added in DBI 1.28.\n\n\"ParamTypes\"\nType: hash ref, read-only\n\nReturns a reference to a hash containing the type information currently bound to placeholders.\nReturns undef if not supported by the driver.\n\n* Keys:\n\nSee \"ParamValues\" above.\n\n* Values:\n\nThe hash values are hashrefs of type information in the same form as that passed to the various"
                    },
                    {
                        "name": "bind_param",
                        "content": "It is possible that the values in the hash returned by \"ParamTypes\" are not exactly the same as\nthose passed to bindparam() or execute(). Param attributes specified using the abbreviated\nform, like this:\n\n$sth->bindparam(1, SQLINTEGER);\n\nare returned in the expanded form, as if called like this:\n\n$sth->bindparam(1, { TYPE => SQLINTEGER });\n\nThe driver may have modified the type information in some way based on the bound values, other\nhints provided by the prepare()'d SQL statement, or alternate type mappings required by the\ndriver or target database system. The driver may also add private keys (with names beginning\nwith the drivers reserved prefix, e.g., odbcxxx).\n\n* Example:\n\nThe keys and values in the returned hash can be passed to the various bindparam() methods to\neffectively reproduce a previous param binding. For example:\n\n# assuming $sth1 is a previously prepared statement handle\nmy $sth2 = $dbh->prepare( $sth1->{Statement} );\nmy $ParamValues = $sth1->{ParamValues} || {};\nmy $ParamTypes  = $sth1->{ParamTypes}  || {};\n$sth2->bindparam($, $ParamValues->{$}, $ParamTypes->{$})\nfor keys %{ {%$ParamValues, %$ParamTypes} };\n$sth2->execute();\n\nThe \"ParamTypes\" attribute was added in DBI 1.49. Implementation is the responsibility of\nindividual drivers; the DBI layer default implementation simply returns undef.\n\n\"ParamArrays\"\nType: hash ref, read-only\n\nReturns a reference to a hash containing the values currently bound to placeholders with\n\"executearray\" or \"bindparamarray\". The keys of the hash are the 'names' of the placeholders,\ntypically integers starting at 1. Returns undef if not supported by the driver or no arrays of\nparameters are bound.\n\nEach key value is an array reference containing a list of the bound parameters for that column.\n\nFor example:\n\n$sth = $dbh->prepare(\"INSERT INTO staff (id, name) values (?,?)\");\n$sth->executearray({},[1,2], ['fred','dave']);\nif ($sth->{ParamArrays}) {\nforeach $param (keys %{$sth->{ParamArrays}}) {\nprintf \"Parameters for %s : %s\\n\", $param,\njoin(\",\", @{$sth->{ParamArrays}->{$param}});\n}\n}\n\nIt is possible that the values in the hash returned by \"ParamArrays\" are not *exactly* the same\nas those passed to \"bindparamarray\" or \"executearray\". The driver may have slightly modified\nvalues in some way based on the TYPE the value was bound with. For example a floating point\nvalue bound as an SQLINTEGER type may be returned as an integer.\n\nIt is also possible that the keys in the hash returned by \"ParamArrays\" are not exactly the same\nas those implied by the prepared statement. For example, DBD::Oracle translates '\"?\"'\nplaceholders into '\":pN\"' where N is a sequence number starting at 1.\n\n\"RowsInCache\"\nType: integer, read-only\n\nIf the driver supports a local row cache for \"SELECT\" statements, then this attribute holds the\nnumber of un-fetched rows in the cache. If the driver doesn't, then it returns \"undef\". Note\nthat some drivers pre-fetch rows on execute, whereas others wait till the first fetch.\n\nSee also the \"RowCacheSize\" database handle attribute.\n"
                    }
                ]
            },
            "FURTHER INFORMATION": {
                "content": "",
                "subsections": [
                    {
                        "name": "Catalog Methods",
                        "content": "An application can retrieve metadata information from the DBMS by issuing appropriate queries on\nthe views of the Information Schema. Unfortunately, \"INFORMATIONSCHEMA\" views are seldom\nsupported by the DBMS. Special methods (catalog methods) are available to return result sets for\na small but important portion of that metadata:\n\ncolumninfo\nforeignkeyinfo\nprimarykeyinfo\ntableinfo\nstatisticsinfo\n\nAll catalog methods accept arguments in order to restrict the result sets. Passing \"undef\" to an\noptional argument does not constrain the search for that argument. However, an empty string ('')\nis treated as a regular search criteria and will only match an empty value.\n\nNote: SQL/CLI and ODBC differ in the handling of empty strings. An empty string will not\nrestrict the result set in SQL/CLI.\n\nMost arguments in the catalog methods accept only *ordinary values*, e.g. the arguments of\n\"primarykeyinfo()\". Such arguments are treated as a literal string, i.e. the case is\nsignificant and quote characters are taken literally.\n\nSome arguments in the catalog methods accept *search patterns* (strings containing '' and/or\n'%'), e.g. the $table argument of \"columninfo()\". Passing '%' is equivalent to leaving the\nargument \"undef\".\n\nCaveat: The underscore ('') is valid and often used in SQL identifiers. Passing such a value to\na search pattern argument may return more rows than expected! To include pattern characters as\nliterals, they must be preceded by an escape character which can be achieved with\n\n$esc = $dbh->getinfo( 14 );  # SQLSEARCHPATTERNESCAPE\n$searchpattern =~ s/([%])/$esc$1/g;\n\nThe ODBC and SQL/CLI specifications define a way to change the default behaviour described\nabove: All arguments (except *list value arguments*) are treated as *identifier* if the\n\"SQLATTRMETADATAID\" attribute is set to \"SQLTRUE\". *Quoted identifiers* are very similar to\n*ordinary values*, i.e. their body (the string within the quotes) is interpreted literally.\n*Unquoted identifiers* are compared in UPPERCASE.\n\nThe DBI (currently) does not support the \"SQLATTRMETADATAID\" attribute, i.e. it behaves like\nan ODBC driver where \"SQLATTRMETADATAID\" is set to \"SQLFALSE\".\n"
                    },
                    {
                        "name": "Transactions",
                        "content": "Transactions are a fundamental part of any robust database system. They protect against errors\nand database corruption by ensuring that sets of related changes to the database take place in\natomic (indivisible, all-or-nothing) units.\n\nThis section applies to databases that support transactions and where \"AutoCommit\" is off. See\n\"AutoCommit\" for details of using \"AutoCommit\" with various types of databases.\n\nThe recommended way to implement robust transactions in Perl applications is to enable\n\"RaiseError\" and catch the error that's 'thrown' as an exception. For example, using Try::Tiny:\n\nuse Try::Tiny;\n$dbh->{AutoCommit} = 0;  # enable transactions, if possible\n$dbh->{RaiseError} = 1;\ntry {\nfoo(...)        # do lots of work here\nbar(...)        # including inserts\nbaz(...)        # and updates\n$dbh->commit;   # commit the changes if we get this far\n} catch {\nwarn \"Transaction aborted because $\"; # Try::Tiny copies $@ into $\n# now rollback to undo the incomplete changes\n# but do it in an eval{} as it may also fail\neval { $dbh->rollback };\n# add other application on-error-clean-up code here\n};\n\nIf the \"RaiseError\" attribute is not set, then DBI calls would need to be manually checked for\nerrors, typically like this:\n\n$h->method(@args) or die $h->errstr;\n\nWith \"RaiseError\" set, the DBI will automatically \"die\" if any DBI method call on that handle\n(or a child handle) fails, so you don't have to test the return value of each method call. See\n\"RaiseError\" for more details.\n\nA major advantage of the \"eval\" approach is that the transaction will be properly rolled back if\n*any* code (not just DBI calls) in the inner application dies for any reason. The major\nadvantage of using the \"$h->{RaiseError}\" attribute is that all DBI calls will be checked\nautomatically. Both techniques are strongly recommended.\n\nAfter calling \"commit\" or \"rollback\" many drivers will not let you fetch from a previously\nactive \"SELECT\" statement handle that's a child of the same database handle. A typical way round\nthis is to connect the the database twice and use one connection for \"SELECT\" statements.\n\nSee \"AutoCommit\" and \"disconnect\" for other important information about transactions.\n\nHandling BLOB / LONG / Memo Fields\nMany databases support \"blob\" (binary large objects), \"long\", or similar datatypes for holding\nvery long strings or large amounts of binary data in a single field. Some databases support\nvariable length long values over 2,000,000,000 bytes in length.\n\nSince values of that size can't usually be held in memory, and because databases can't usually\nknow in advance the length of the longest long that will be returned from a \"SELECT\" statement\n(unlike other data types), some special handling is required.\n\nIn this situation, the value of the \"$h->{LongReadLen}\" attribute is used to determine how much\nbuffer space to allocate when fetching such fields. The \"$h->{LongTruncOk}\" attribute is used to\ndetermine how to behave if a fetched value can't fit into the buffer.\n\nSee the description of \"LongReadLen\" for more information.\n\nWhen trying to insert long or binary values, placeholders should be used since there are often\nlimits on the maximum size of an \"INSERT\" statement and the \"quote\" method generally can't cope\nwith binary data. See \"Placeholders and Bind Values\".\n"
                    },
                    {
                        "name": "Simple Examples",
                        "content": "Here's a complete example program to select and fetch some data:\n\nmy $datasource = \"dbi::DriverName:dbname\";\nmy $dbh = DBI->connect($datasource, $user, $password)\nor die \"Can't connect to $datasource: $DBI::errstr\";\n\nmy $sth = $dbh->prepare( q{\nSELECT name, phone\nFROM mytelbook\n}) or die \"Can't prepare statement: $DBI::errstr\";\n\nmy $rc = $sth->execute\nor die \"Can't execute statement: $DBI::errstr\";\n\nprint \"Query will return $sth->{NUMOFFIELDS} fields.\\n\\n\";\nprint \"Field names: @{ $sth->{NAME} }\\n\";\n\nwhile (($name, $phone) = $sth->fetchrowarray) {\nprint \"$name: $phone\\n\";\n}\n# check for problems which may have terminated the fetch early\ndie $sth->errstr if $sth->err;\n\n$dbh->disconnect;\n\nHere's a complete example program to insert some data from a file. (This example uses\n\"RaiseError\" to avoid needing to check each call).\n\nmy $dbh = DBI->connect(\"dbi:DriverName:dbname\", $user, $password, {\nRaiseError => 1, AutoCommit => 0\n});\n\nmy $sth = $dbh->prepare( q{\nINSERT INTO table (name, phone) VALUES (?, ?)\n});\n\nopen FH, \"<phone.csv\" or die \"Unable to open phone.csv: $!\";\nwhile (<FH>) {\nchomp;\nmy ($name, $phone) = split /,/;\n$sth->execute($name, $phone);\n}\nclose FH;\n\n$dbh->commit;\n$dbh->disconnect;\n\nHere's how to convert fetched NULLs (undefined values) into empty strings:\n\nwhile($row = $sth->fetchrowarrayref) {\n# this is a fast and simple way to deal with nulls:\nforeach (@$row) { $ = '' unless defined }\nprint \"@$row\\n\";\n}\n\nThe \"q{...}\" style quoting used in these examples avoids clashing with quotes that may be used\nin the SQL statement. Use the double-quote like \"qq{...}\" operator if you want to interpolate\nvariables into the string. See \"Quote and Quote-like Operators\" in perlop for more details.\n"
                    },
                    {
                        "name": "Threads and Thread Safety",
                        "content": "Perl 5.7 and later support a new threading model called iThreads. (The old \"5.005 style\" threads\nare not supported by the DBI.)\n\nIn the iThreads model each thread has its own copy of the perl interpreter. When a new thread is\ncreated the original perl interpreter is 'cloned' to create a new copy for the new thread.\n\nIf the DBI and drivers are loaded and handles created before the thread is created then it will\nget a cloned copy of the DBI, the drivers and the handles.\n\nHowever, the internal pointer data within the handles will refer to the DBI and drivers in the\noriginal interpreter. Using those handles in the new interpreter thread is not safe, so the DBI\ndetects this and croaks on any method call using handles that don't belong to the current thread\n(except for DESTROY).\n\nBecause of this (possibly temporary) restriction, newly created threads must make their own\nconnections to the database. Handles can't be shared across threads.\n\nBut BEWARE, some underlying database APIs (the code the DBD driver uses to talk to the database,\noften supplied by the database vendor) are not thread safe. If it's not thread safe, then\nallowing more than one thread to enter the code at the same time may cause subtle/serious\nproblems. In some cases allowing more than one thread to enter the code, even if *not* at the\nsame time, can cause problems. You have been warned.\n\nUsing DBI with perl threads is not yet recommended for production environments. For more\ninformation see <http://www.perlmonks.org/index.pl?nodeid=288022>\n\nNote: There is a bug in perl 5.8.2 when configured with threads and debugging enabled (bug\n#24463) which causes a DBI test to fail.\n"
                    },
                    {
                        "name": "Signal Handling and Canceling Operations",
                        "content": "[The following only applies to systems with unix-like signal handling. I'd welcome additions for\nother systems, especially Windows.]\n\nThe first thing to say is that signal handling in Perl versions less than 5.8 is *not* safe.\nThere is always a small risk of Perl crashing and/or core dumping when, or after, handling a\nsignal because the signal could arrive and be handled while internal data structures are being\nchanged. If the signal handling code used those same internal data structures it could cause all\nmanner of subtle and not-so-subtle problems. The risk was reduced with 5.4.4 but was still\npresent in all perls up through 5.8.0.\n\nBeginning in perl 5.8.0 perl implements 'safe' signal handling if your system has the POSIX"
                    },
                    {
                        "name": "sigaction",
                        "content": "run the %SIG handler. The handling is 'deferred' until a 'safe' moment.\n\nAlthough this change made signal handling safe, it also lead to a problem with signals being\ndeferred for longer than you'd like. If a signal arrived while executing a system call, such as\nwaiting for data on a network connection, the signal is noted and then the system call that was\nexecuting returns with an EINTR error code to indicate that it was interrupted. All fine so far.\n\nThe problem comes when the code that made the system call sees the EINTR code and decides it's\ngoing to call it again. Perl doesn't do that, but database code sometimes does. If that happens\nthen the signal handler doesn't get called until later. Maybe much later.\n\nFortunately there are ways around this which we'll discuss below. Unfortunately they make\nsignals unsafe again.\n\nThe two most common uses of signals in relation to the DBI are for canceling operations when the\nuser types Ctrl-C (interrupt), and for implementing a timeout using \"alarm()\" and $SIG{ALRM}.\n\nCancel\nThe DBI provides a \"cancel\" method for statement handles. The \"cancel\" method should abort\nthe current operation and is designed to be called from a signal handler. For example:\n\n$SIG{INT} = sub { $sth->cancel };\n\nHowever, few drivers implement this (the DBI provides a default method that just returns\n\"undef\") and, even if implemented, there is still a possibility that the statement handle,\nand even the parent database handle, will not be usable afterwards.\n\nIf \"cancel\" returns true, then it has successfully invoked the database engine's own cancel\nfunction. If it returns false, then \"cancel\" failed. If it returns \"undef\", then the\ndatabase driver does not have cancel implemented - very few do.\n\nTimeout\nThe traditional way to implement a timeout is to set $SIG{ALRM} to refer to some code that\nwill be executed when an ALRM signal arrives and then to call alarm($seconds) to schedule an\nALRM signal to be delivered $seconds in the future. For example:\n\nmy $failed;\neval {\nlocal $SIG{ALRM} = sub { die \"TIMEOUT\\n\" }; # N.B. \\n required\neval {\nalarm($seconds);\n... code to execute with timeout here (which may die) ...\n1;\n} or $failed = 1;\n# outer eval catches alarm that might fire JUST before this alarm(0)\nalarm(0);  # cancel alarm (if code ran fast)\ndie \"$@\" if $failed;\n1;\n} or $failed = 1;\nif ( $failed ) {\nif ( defined $@ and $@ eq \"TIMEOUT\\n\" ) { ... }\nelse { ... } # some other error\n}\n\nThe first (outer) eval is used to avoid the unlikely but possible chance that the \"code to\nexecute\" dies and the alarm fires before it is cancelled. Without the outer eval, if this\nhappened your program will die if you have no ALRM handler or a non-local alarm handler will\nbe called.\n\nUnfortunately, as described above, this won't always work as expected, depending on your\nperl version and the underlying database code.\n\nWith Oracle for instance (DBD::Oracle), if the system which hosts the database is down the\nDBI->connect() call will hang for several minutes before returning an error.\n\nThe solution on these systems is to use the \"POSIX::sigaction()\" routine to gain low level\naccess to how the signal handler is installed.\n\nThe code would look something like this (for the DBD-Oracle connect()):\n\nuse POSIX qw(:signalh);\n\nmy $mask = POSIX::SigSet->new( SIGALRM ); # signals to mask in the handler\nmy $action = POSIX::SigAction->new(\nsub { die \"connect timeout\\n\" },        # the handler code ref\n$mask,\n# not using (perl 5.8.2 and later) 'safe' switch or saflags\n);\nmy $oldaction = POSIX::SigAction->new();\nsigaction( SIGALRM, $action, $oldaction );\nmy $dbh;\nmy $failed;\neval {\neval {\nalarm(5); # seconds before time out\n$dbh = DBI->connect(\"dbi:Oracle:$dsn\" ... );\n1;\n} or $failed = 1;\nalarm(0); # cancel alarm (if connect worked fast)\ndie \"$@\\n\" if $failed; # connect died\n1;\n} or $failed = 1;\nsigaction( SIGALRM, $oldaction );  # restore original signal handler\nif ( $failed ) {\nif ( defined $@ and $@ eq \"connect timeout\\n\" ) {...}\nelse { # connect died }\n}\n\nSee previous example for the reasoning around the double eval.\n\nSimilar techniques can be used for canceling statement execution.\n\nUnfortunately, this solution is somewhat messy, and it does *not* work with perl versions less\nthan perl 5.8 where \"POSIX::sigaction()\" appears to be broken.\n\nFor a cleaner implementation that works across perl versions, see Lincoln Baxter's\nSys::SigAction module at Sys::SigAction. The documentation for Sys::SigAction includes an longer\ndiscussion of this problem, and a DBD::Oracle test script.\n\nBe sure to read all the signal handling sections of the perlipc manual.\n\nAnd finally, two more points to keep firmly in mind. Firstly, remember that what we've done here\nis essentially revert to old style *unsafe* handling of these signals. So do as little as\npossible in the handler. Ideally just die(). Secondly, the handles in use at the time the signal\nis handled may not be safe to use afterwards.\n"
                    },
                    {
                        "name": "Subclassing the DBI",
                        "content": "DBI can be subclassed and extended just like any other object oriented module. Before we talk\nabout how to do that, it's important to be clear about the various DBI classes and how they work\ntogether.\n\nBy default \"$dbh = DBI->connect(...)\" returns a $dbh blessed into the \"DBI::db\" class. And the\n\"$dbh->prepare\" method returns an $sth blessed into the \"DBI::st\" class (actually it simply\nchanges the last four characters of the calling handle class to be \"::st\").\n\nThe leading '\"DBI\"' is known as the 'root class' and the extra '\"::db\"' or '\"::st\"' are the\n'handle type suffixes'. If you want to subclass the DBI you'll need to put your overriding\nmethods into the appropriate classes. For example, if you want to use a root class of \"MySubDBI\"\nand override the do(), prepare() and execute() methods, then your do() and prepare() methods\nshould be in the \"MySubDBI::db\" class and the execute() method should be in the \"MySubDBI::st\"\nclass.\n\nTo setup the inheritance hierarchy the @ISA variable in \"MySubDBI::db\" should include \"DBI::db\"\nand the @ISA variable in \"MySubDBI::st\" should include \"DBI::st\". The \"MySubDBI\" root class\nitself isn't currently used for anything visible and so, apart from setting @ISA to include\n\"DBI\", it can be left empty.\n\nSo, having put your overriding methods into the right classes, and setup the inheritance\nhierarchy, how do you get the DBI to use them? You have two choices, either a static method call\nusing the name of your subclass:\n\n$dbh = MySubDBI->connect(...);\n\nor specifying a \"RootClass\" attribute:\n\n$dbh = DBI->connect(..., { RootClass => 'MySubDBI' });\n\nIf both forms are used then the attribute takes precedence.\n\nThe only differences between the two are that using an explicit RootClass attribute will a) make\nthe DBI automatically attempt to load a module by that name if the class doesn't exist, and b)\nwon't call your MySubDBI::connect() method, if you have one.\n\nWhen subclassing is being used then, after a successful new connect, the DBI->connect method\nautomatically calls:\n\n$dbh->connected($dsn, $user, $pass, \\%attr);\n\nThe default method does nothing. The call is made just to simplify any post-connection setup\nthat your subclass may want to perform. The parameters are the same as passed to DBI->connect.\nIf your subclass supplies a connected method, it should be part of the MySubDBI::db package.\n\nOne more thing to note: you must let the DBI do the handle creation. If you want to override the"
                    },
                    {
                        "name": "connect",
                        "content": "work with. Similarly, an overridden prepare() method in *::db must still call SUPER::prepare to\nget a $sth. If you try to create your own handles using bless() then you'll find the DBI will\nreject them with an \"is not a DBI handle (has no magic)\" error.\n\nHere's a brief example of a DBI subclass. A more thorough example can be found in t/subclass.t\nin the DBI distribution.\n\npackage MySubDBI;\n\nuse strict;\n\nuse DBI;\nuse vars qw(@ISA);\n@ISA = qw(DBI);\n\npackage MySubDBI::db;\nuse vars qw(@ISA);\n@ISA = qw(DBI::db);\n\nsub prepare {\nmy ($dbh, @args) = @;\nmy $sth = $dbh->SUPER::prepare(@args)\nor return;\n$sth->{privatemysubdbiinfo} = { foo => 'bar' };\nreturn $sth;\n}\n\npackage MySubDBI::st;\nuse vars qw(@ISA);\n@ISA = qw(DBI::st);\n\nsub fetch {\nmy ($sth, @args) = @;\nmy $row = $sth->SUPER::fetch(@args)\nor return;\ndosomethingmagicalwithrowdata($row)\nor return $sth->seterr(1234, \"The magic failed\", undef, \"fetch\");\nreturn $row;\n}\n\nWhen calling a SUPER::method that returns a handle, be careful to check the return value before\ntrying to do other things with it in your overridden method. This is especially important if you\nwant to set a hash attribute on the handle, as Perl's autovivification will bite you by\n(in)conveniently creating an unblessed hashref, which your method will then return with usually\nbaffling results later on like the error \"dbihgetcom handle HASH(0xa4451a8) is not a DBI handle\n(has no magic\". It's best to check right after the call and return undef immediately on error,\njust like DBI would and just like the example above.\n\nIf your method needs to record an error it should call the seterr() method with the error code\nand error string, as shown in the example above. The error code and error string will be\nrecorded in the handle and available via \"$h->err\" and $DBI::errstr etc. The seterr() method\nalways returns an undef or empty list as appropriate. Since your method should nearly always\nreturn an undef or empty list as soon as an error is detected it's handy to simply return what"
                    },
                    {
                        "name": "set_err",
                        "content": "If the handle has \"RaiseError\", \"PrintError\", or \"HandleError\" etc. set then the seterr()\nmethod will honour them. This means that if \"RaiseError\" is set then seterr() won't return in\nthe normal way but will 'throw an exception' that can be caught with an \"eval\" block.\n\nYou can stash private data into DBI handles via \"$h->{private...*}\". See the entry under\n\"ATTRIBUTES COMMON TO ALL HANDLES\" for info and important caveats.\n"
                    },
                    {
                        "name": "Memory Leaks",
                        "content": "When tracking down memory leaks using tools like Devel::Leak you'll find that some DBI internals\nare reported as 'leaking' memory. This is very unlikely to be a real leak. The DBI has various\ncaches to improve performance and the apparrent leaks are simply the normal operation of these\ncaches.\n\nThe most frequent sources of the apparrent leaks are \"ChildHandles\", \"preparecached\" and\n\"connectcached\".\n\nFor example http://stackoverflow.com/questions/13338308/perl-dbi-memory-leak\n\nGiven how widely the DBI is used, you can rest assured that if a new release of the DBI did have\na real leak it would be discovered, reported, and fixed immediately. The leak you're looking for\nis probably elsewhere. Good luck!\n"
                    }
                ]
            },
            "TRACING": {
                "content": "The DBI has a powerful tracing mechanism built in. It enables you to see what's going on 'behind\nthe scenes', both within the DBI and the drivers you're using.\n",
                "subsections": [
                    {
                        "name": "Trace Settings",
                        "content": "Which details are written to the trace output is controlled by a combination of a *trace level*,\nan integer from 0 to 15, and a set of *trace flags* that are either on or off. Together these\nare known as the *trace settings* and are stored together in a single integer. For normal use\nyou only need to set the trace level, and generally only to a value between 1 and 4.\n\nEach handle has its own trace settings, and so does the DBI. When you call a method the DBI\nmerges the handles settings into its own for the duration of the call: the trace flags of the\nhandle are OR'd into the trace flags of the DBI, and if the handle has a higher trace level then\nthe DBI trace level is raised to match it. The previous DBI trace settings are restored when the\ncalled method returns.\n"
                    },
                    {
                        "name": "Trace Levels",
                        "content": "Trace *levels* are as follows:\n\n0 - Trace disabled.\n1 - Trace top-level DBI method calls returning with results or errors.\n2 - As above, adding tracing of top-level method entry with parameters.\n3 - As above, adding some high-level information from the driver\nand some internal information from the DBI.\n4 - As above, adding more detailed information from the driver.\nThis is the first level to trace all the rows being fetched.\n5 to 15 - As above but with more and more internal information.\n\nTrace level 1 is best for a simple overview of what's happening. Trace levels 2 thru 4 a good\nchoice for general purpose tracing. Levels 5 and above are best reserved for investigating a\nspecific problem, when you need to see \"inside\" the driver and DBI.\n\nThe trace output is detailed and typically very useful. Much of the trace output is formatted\nusing the \"neat\" function, so strings in the trace output may be edited and truncated by that\nfunction.\n"
                    },
                    {
                        "name": "Trace Flags",
                        "content": "Trace *flags* are used to enable tracing of specific activities within the DBI and drivers. The\nDBI defines some trace flags and drivers can define others. DBI trace flag names begin with a\ncapital letter and driver specific names begin with a lowercase letter, as usual.\n\nCurrently the DBI defines these trace flags:\n\nALL - turn on all DBI and driver flags (not recommended)\nSQL - trace SQL statements executed\n(not yet implemented in DBI but implemented in some DBDs)\nCON - trace connection process\nENC - trace encoding (unicode translations etc)\n(not yet implemented in DBI but implemented in some DBDs)\nDBD - trace only DBD messages\n(not implemented by all DBDs yet)\nTXN - trace transactions\n(not implemented in all DBDs yet)\n\nThe \"parsetraceflags\" and \"parsetraceflag\" methods are used to convert trace flag names into\nthe corresponding integer bit flags.\n"
                    },
                    {
                        "name": "Enabling Trace",
                        "content": "The \"$h->trace\" method sets the trace settings for a handle and \"DBI->trace\" does the same for\nthe DBI.\n\nIn addition to the \"trace\" method, you can enable the same trace information, and direct the\noutput to a file, by setting the \"DBITRACE\" environment variable before starting Perl. See\n\"DBITRACE\" for more information.\n\nFinally, you can set, or get, the trace settings for a handle using the \"TraceLevel\" attribute.\n\nAll of those methods use parsetraceflags() and so allow you set both the trace level and\nmultiple trace flags by using a string containing the trace level and/or flag names separated by\nvertical bar (\"\"|\"\") or comma (\"\",\"\") characters. For example:\n\nlocal $h->{TraceLevel} = \"3|SQL|foo\";\n"
                    },
                    {
                        "name": "Trace Output",
                        "content": "Initially trace output is written to \"STDERR\". Both the \"$h->trace\" and \"DBI->trace\" methods\ntake an optional $tracefile parameter, which may be either the name of a file to be opened by\nDBI in append mode, or a reference to an existing writable (possibly layered) filehandle. If\n$tracefile is a filename, and can be opened in append mode, or $tracefile is a writable\nfilehandle, then *all* trace output (currently including that from other handles) is redirected\nto that file. A warning is generated if $tracefile can't be opened or is not writable.\n\nFurther calls to trace() without $tracefile do not alter where the trace output is sent. If\n$tracefile is undefined, then trace output is sent to \"STDERR\" and, if the prior trace was\nopened with $tracefile as a filename, the previous trace file is closed; if $tracefile was a\nfilehandle, the filehandle is not closed.\n\nNOTE: If $tracefile is specified as a filehandle, the filehandle should not be closed until all\nDBI operations are completed, or the application has reset the trace file via another call to\n\"trace()\" that changes the trace file.\n"
                    },
                    {
                        "name": "Tracing to Layered Filehandles",
                        "content": "NOTE:\n\n*   Tied filehandles are not currently supported, as tie operations are not available to the\nPerlIO methods used by the DBI.\n\n*   PerlIO layer support requires Perl version 5.8 or higher.\n\nAs of version 5.8, Perl provides the ability to layer various \"disciplines\" on an open\nfilehandle via the PerlIO module.\n\nA simple example of using PerlIO layers is to use a scalar as the output:\n\nmy $scalar = '';\nopen( my $fh, \"+>:scalar\", \\$scalar );\n$dbh->trace( 2, $fh );\n\nNow all trace output is simply appended to $scalar.\n\nA more complex application of tracing to a layered filehandle is the use of a custom layer\n(*Refer to *Perlio::via *for details on creating custom PerlIO layers.*). Consider an\napplication with the following logger module:\n\npackage MyFancyLogger;\n\nsub new\n{\nmy $self = {};\nmy $fh;\nopen $fh, '>', 'fancylog.log';\n$self->{fh} = $fh;\n$self->{buf} = '';\nreturn bless $self, shift;\n}\n\nsub log\n{\nmy $self = shift;\nreturn unless exists $self->{fh};\nmy $fh = $self->{fh};\n$self->{buf} .= shift;\n#\n# DBI feeds us pieces at a time, so accumulate a complete line\n# before outputting\n#\nprint $fh \"At \", scalar localtime(), ':', $self->{buf}, \"\\n\" and\n$self->{buf} = ''\nif $self->{buf}=~tr/\\n//;\n}\n\nsub close {\nmy $self = shift;\nreturn unless exists $self->{fh};\nmy $fh = $self->{fh};\nprint $fh \"At \", scalar localtime(), ':', $self->{buf}, \"\\n\" and\n$self->{buf} = ''\nif $self->{buf};\nclose $fh;\ndelete $self->{fh};\n}\n\n1;\n\nTo redirect DBI traces to this logger requires creating a package for the layer:\n\npackage PerlIO::via::MyFancyLogLayer;\n\nsub PUSHED\n{\nmy ($class,$mode,$fh) = @;\nmy $logger;\nreturn bless \\$logger,$class;\n}\n\nsub OPEN {\nmy ($self, $path, $mode, $fh) = @;\n#\n# $path is actually our logger object\n#\n$$self = $path;\nreturn 1;\n}\n\nsub WRITE\n{\nmy ($self, $buf, $fh) = @;\n$$self->log($buf);\nreturn length($buf);\n}\n\nsub CLOSE {\nmy $self = shift;\n$$self->close();\nreturn 0;\n}\n\n1;\n\nThe application can then cause DBI traces to be routed to the logger using\n\nuse PerlIO::via::MyFancyLogLayer;\n\nopen my $fh, '>:via(MyFancyLogLayer)', MyFancyLogger->new();\n\n$dbh->trace('SQL', $fh);\n\nNow all trace output will be processed by MyFancyLogger's log() method.\n"
                    },
                    {
                        "name": "Trace Content",
                        "content": "Many of the values embedded in trace output are formatted using the neat() utility function.\nThis means they may be quoted, sanitized, and possibly truncated if longer than\n$DBI::neatmaxlen. See \"neat\" for more details.\n"
                    },
                    {
                        "name": "Tracing Tips",
                        "content": "You can add tracing to your own application code using the \"tracemsg\" method.\n\nIt can sometimes be handy to compare trace files from two different runs of the same script.\nHowever using a tool like \"diff\" on the original log output doesn't work well because the trace\nfile is full of object addresses that may differ on each run.\n\nThe DBI includes a handy utility called dbilogstrip that can be used to 'normalize' the log\ncontent. It can be used as a filter like this:\n\nDBITRACE=2 perl yourscript.pl ...args1... 2>&1 | dbilogstrip > dbitrace1.log\nDBITRACE=2 perl yourscript.pl ...args2... 2>&1 | dbilogstrip > dbitrace2.log\ndiff -u dbitrace1.log dbitrace2.log\n\nSee dbilogstrip for more information.\n"
                    }
                ]
            },
            "DBI ENVIRONMENT VARIABLES": {
                "content": "The DBI module recognizes a number of environment variables, but most of them should not be used\nmost of the time. It is better to be explicit about what you are doing to avoid the need for\nenvironment variables, especially in a web serving system where web servers are stingy about\nwhich environment variables are available.\n\nDBIDSN\nThe DBIDSN environment variable is used by DBI->connect if you do not specify a data source\nwhen you issue the connect. It should have a format such as \"dbi:Driver:databasename\".\n\nDBIDRIVER\nThe DBIDRIVER environment variable is used to fill in the database driver name in DBI->connect\nif the data source string starts \"dbi::\" (thereby omitting the driver). If DBIDSN omits the\ndriver name, DBIDRIVER can fill the gap.\n\nDBIAUTOPROXY\nThe DBIAUTOPROXY environment variable takes a string value that starts \"dbi:Proxy:\" and is\ntypically followed by \"hostname=...;port=...\". It is used to alter the behaviour of\nDBI->connect. For full details, see DBI::Proxy documentation.\n\nDBIUSER\nThe DBIUSER environment variable takes a string value that is used as the user name if the\nDBI->connect call is given undef (as distinct from an empty string) as the username argument. Be\nwary of the security implications of using this.\n\nDBIPASS\nThe DBIPASS environment variable takes a string value that is used as the password if the\nDBI->connect call is given undef (as distinct from an empty string) as the password argument. Be\nextra wary of the security implications of using this.\n\nDBIDBNAME (obsolete)\nThe DBIDBNAME environment variable takes a string value that is used only when the obsolescent\nstyle of DBI->connect (with driver name as fourth parameter) is used, and when no value is\nprovided for the first (database name) argument.\n\nDBITRACE\nThe DBITRACE environment variable specifies the global default trace settings for the DBI at\nstartup. Can also be used to direct trace output to a file. When the DBI is loaded it does:\n\nDBI->trace(split /=/, $ENV{DBITRACE}, 2) if $ENV{DBITRACE};\n\nSo if \"DBITRACE\" contains an \"\"=\"\" character then what follows it is used as the name of the\nfile to append the trace to.\n\noutput appended to that file. If the name begins with a number followed by an equal sign (\"=\"),\nthen the number and the equal sign are stripped off from the name, and the number is used to set\nthe trace level. For example:\n\nDBITRACE=1=dbitrace.log perl yourtestscript.pl\n\nOn Unix-like systems using a Bourne-like shell, you can do this easily on the command line:\n\nDBITRACE=2 perl yourtestscript.pl\n\nSee \"TRACING\" for more information.\n\nPERLDBIDEBUG (obsolete)\nAn old variable that should no longer be used; equivalent to DBITRACE.\n\nDBIPROFILE\nThe DBIPROFILE environment variable can be used to enable profiling of DBI method calls. See\nDBI::Profile for more information.\n\nDBIPUREPERL\nThe DBIPUREPERL environment variable can be used to enable the use of DBI::PurePerl. See\nDBI::PurePerl for more information.\n",
                "subsections": []
            },
            "WARNING AND ERROR MESSAGES": {
                "content": "",
                "subsections": [
                    {
                        "name": "Fatal Errors",
                        "content": "Can't call method \"prepare\" without a package or object reference\nThe $dbh handle you're using to call \"prepare\" is probably undefined because the preceding\n\"connect\" failed. You should always check the return status of DBI methods, or use the\n\"RaiseError\" attribute.\n\nCan't call method \"execute\" without a package or object reference\nThe $sth handle you're using to call \"execute\" is probably undefined because the preceding\n\"prepare\" failed. You should always check the return status of DBI methods, or use the\n\"RaiseError\" attribute.\n\nDBI/DBD internal version mismatch\nThe DBD driver module was built with a different version of DBI than the one currently being\nused. You should rebuild the DBD module under the current version of DBI.\n\n(Some rare platforms require \"static linking\". On those platforms, there may be an old DBI\nor DBD driver version actually embedded in the Perl executable being used.)\n\nDBD driver has not implemented the AutoCommit attribute\nThe DBD driver implementation is incomplete. Consult the author.\n\nCan't [sg]et %s->{%s}: unrecognised attribute\nYou attempted to set or get an unknown attribute of a handle. Make sure you have spelled the\nattribute name correctly; case is significant (e.g., \"Autocommit\" is not the same as\n\"AutoCommit\").\n"
                    }
                ]
            },
            "Pure-Perl DBI": {
                "content": "A pure-perl emulation of the DBI is included in the distribution for people using pure-perl\ndrivers who, for whatever reason, can't install the compiled DBI. See DBI::PurePerl.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "",
                "subsections": [
                    {
                        "name": "Driver and Database Documentation",
                        "content": "Refer to the documentation for the DBD driver that you are using.\n\nRefer to the SQL Language Reference Manual for the database engine that you are using.\n\nODBC and SQL/CLI Standards Reference Information\nMore detailed information about the semantics of certain DBI methods that are based on ODBC and\nSQL/CLI standards is available on-line via microsoft.com, for ODBC, and www.jtc1sc32.org for the\nSQL/CLI standard:\n\nDBI method        ODBC function     SQL/CLI Working Draft\n----------        -------------     ---------------------\ncolumninfo       SQLColumns        Page 124\nforeignkeyinfo  SQLForeignKeys    Page 163\ngetinfo          SQLGetInfo        Page 214\nprimarykeyinfo  SQLPrimaryKeys    Page 254\ntableinfo        SQLTables         Page 294\ntypeinfo         SQLGetTypeInfo    Page 239\nstatisticsinfo   SQLStatistics\n\nTo find documentation on the ODBC function you can use the MSDN search facility at:\n\nhttp://msdn.microsoft.com/Search\n\nand search for something like \"SQLColumns returns\".\n\nAnd for SQL/CLI standard information on SQLColumns you'd read page 124 of the (very large)\nSQL/CLI Working Draft available from:\n\nhttp://jtc1sc32.org/doc/N0701-0750/32N0744T.pdf\n"
                    },
                    {
                        "name": "Standards Reference Information",
                        "content": "A hyperlinked, browsable version of the BNF syntax for SQL92 (plus Oracle 7 SQL and PL/SQL) is\navailable here:\n\nhttp://cui.unige.ch/db-research/Enseignement/analyseinfo/SQL92/BNFindex.html\n\nYou can find more information about SQL standards online by searching for the appropriate\nstandard names and numbers. For example, searching for \"ANSI/ISO/IEC International Standard (IS)\nDatabase Language SQL - Part 1: SQL/Framework\" you'll find a copy at:\n\nftp://ftp.iks-jena.de/mitarb/lutz/standards/sql/ansi-iso-9075-1-1999.pdf\n"
                    },
                    {
                        "name": "Books and Articles",
                        "content": "Programming the Perl DBI, by Alligator Descartes and Tim Bunce. <http://books.perl.org/book/154>\n\nProgramming Perl 3rd Ed. by Larry Wall, Tom Christiansen & Jon Orwant.\n<http://books.perl.org/book/134>\n\nLearning Perl by Randal Schwartz. <http://books.perl.org/book/101>\n\nDetails of many other books related to perl can be found at <http://books.perl.org>\n"
                    },
                    {
                        "name": "Perl Modules",
                        "content": "Index of DBI related modules available from CPAN:\n\nL<https://metacpan.org/search?q=DBD%3A%3A>\nL<https://metacpan.org/search?q=DBIx%3A%3A>\nL<https://metacpan.org/search?q=DBI>\n\nFor a good comparison of RDBMS-OO mappers and some OO-RDBMS mappers (including Class::DBI,\nAlzabo, and DBIx::RecordSet in the former category and Tangram and SPOPS in the latter) see the\nPerl Object-Oriented Persistence project pages at:\n\nhttp://poop.sourceforge.net\n\nA similar page for Java toolkits can be found at:\n\nhttp://c2.com/cgi-bin/wiki?ObjectRelationalToolComparison\n"
                    },
                    {
                        "name": "Mailing List",
                        "content": "The *dbi-users* mailing list is the primary means of communication among users of the DBI and\nits related modules. For details send email to:\n\nL<dbi-users-help@perl.org>\n\nThere are typically between 700 and 900 messages per month. You have to subscribe in order to be\nable to post. However you can opt for a 'post-only' subscription.\n\nMailing list archives (of variable quality) are held at:\n\nhttp://groups.google.com/groups?group=perl.dbi.users\nhttp://www.xray.mpe.mpg.de/mailing-lists/dbi/\nhttp://www.mail-archive.com/dbi-users%40perl.org/\n"
                    },
                    {
                        "name": "Assorted Related Links",
                        "content": "The DBI \"Home Page\":\n\nhttp://dbi.perl.org/\n\nOther DBI related links:\n\nhttp://www.perlmonks.org/?node=DBI%20recipes\nhttp://www.perlmonks.org/?node=Speeding%20up%20the%20DBI\n\nOther database related links:\n\nhttp://www.connectionstrings.com/\n\nSecurity, especially the \"SQL Injection\" attack:\n\nhttp://bobby-tables.com/\nhttp://online.securityfocus.com/infocus/1644\n\nFAQ\nSee <http://faq.dbi-support.com/>\n"
                    }
                ]
            },
            "AUTHORS": {
                "content": "DBI by Tim Bunce, <http://www.tim.bunce.name>\n\nThis pod text by Tim Bunce, J. Douglas Dunlop, Jonathan Leffler and others. Perl by Larry Wall\nand the \"perl5-porters\".\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "The DBI module is Copyright (c) 1994-2012 Tim Bunce. Ireland. All rights reserved.\n\nYou may distribute under the terms of either the GNU General Public License or the Artistic\nLicense, as specified in the Perl 5.10.0 README file.\n",
                "subsections": []
            },
            "SUPPORT / WARRANTY": {
                "content": "The DBI is free Open Source software. IT COMES WITHOUT WARRANTY OF ANY KIND.\n",
                "subsections": [
                    {
                        "name": "Support",
                        "content": "My consulting company, Data Plan Services, offers annual and multi-annual support contracts for\nthe DBI. These provide sustained support for DBI development, and sustained value for you in\nreturn. Contact me for details.\n"
                    },
                    {
                        "name": "Sponsor Enhancements",
                        "content": "If your company would benefit from a specific new DBI feature, please consider sponsoring its\ndevelopment. Work is performed rapidly, and usually on a fixed-price payment-on-delivery basis.\nContact me for details.\n\nUsing such targeted financing allows you to contribute to DBI development, and rapidly get\nsomething specific and valuable in return.\n"
                    }
                ]
            },
            "ACKNOWLEDGEMENTS": {
                "content": "I would like to acknowledge the valuable contributions of the many people I have worked with on\nthe DBI project, especially in the early years (1992-1994). In no particular order: Kevin Stock,\nBuzz Moschetti, Kurt Andersen, Ted Lemon, William Hails, Garth Kennedy, Michael Peppler, Neil S.\nBriscoe, Jeff Urlwin, David J. Hughes, Jeff Stander, Forrest D Whitcher, Larry Wall, Jeff Fried,\nRoy Johnson, Paul Hudson, Georg Rehfeld, Steve Sizemore, Ron Pool, Jon Meek, Tom Christiansen,\nSteve Baumgarten, Randal Schwartz, and a whole lot more.\n\nThen, of course, there are the poor souls who have struggled through untold and undocumented\nobstacles to actually implement DBI drivers. Among their ranks are Jochen Wiedmann, Alligator\nDescartes, Jonathan Leffler, Jeff Urlwin, Michael Peppler, Henrik Tougaard, Edwin Pratomo,\nDavide Migliavacca, Jan Pazdziora, Peter Haworth, Edmund Mergl, Steve Williams, Thomas Lowery,\nand Phlip Plumlee. Without them, the DBI would not be the practical reality it is today. I'm\nalso especially grateful to Alligator Descartes for starting work on the first edition of the\n\"Programming the Perl DBI\" book and letting me jump on board.\n\nThe DBI and DBD::Oracle were originally developed while I was Technical Director (CTO) of the\nPaul Ingram Group in the UK. So I'd especially like to thank Paul for his generosity and vision\nin supporting this work for many years.\n\nA couple of specific DBI features have been sponsored by enlightened companies:\n\nThe development of the swapinnerhandle() method was sponsored by BizRate.com\n(<http://BizRate.com>)\n\nThe development of DBD::Gofer and related modules was sponsored by Shopzilla.com\n(<http://Shopzilla.com>), where I currently work.\n",
                "subsections": []
            },
            "CONTRIBUTING": {
                "content": "As you can see above, many people have contributed to the DBI and drivers in many ways over many\nyears.\n\nIf you'd like to help then see <http://dbi.perl.org/contributing>.\n\nIf you'd like the DBI to do something new or different then a good way to make that happen is to\ndo it yourself and send me a patch to the source code that shows the changes. (But read \"Speak\nbefore you patch\" below.)\n",
                "subsections": [
                    {
                        "name": "Browsing the source code repository",
                        "content": "Use https://github.com/perl5-dbi/dbi\n"
                    },
                    {
                        "name": "How to create a patch using Git",
                        "content": "The DBI source code is maintained using Git. To access the source you'll need to install a Git\nclient. Then, to get the source code, do:\n\ngit clone https://github.com/perl5-dbi/dbi.git DBI-git\n\nThe source code will now be available in the new subdirectory \"DBI-git\".\n\nWhen you want to synchronize later, issue the command\n\ngit pull --all\n\nMake your changes, test them, test them again until everything passes. If there are no tests for\nthe new feature you added or a behaviour change, the change should include a new test. Then\ncommit the changes. Either use\n\ngit gui\n\nor\n\ngit commit -a -m 'Message to my changes'\n\nIf you get any conflicts reported you'll need to fix them first.\n\nThen generate the patch file to be mailed:\n\ngit format-patch -1 --attach\n\nwhich will create a file 0001-*.patch (where * relates to the commit message). Read the patch\nfile, as a sanity check, and then email it to dbi-dev@perl.org.\n\nIf you have a github <https://github.com> account, you can also fork the repository, commit your\nchanges to the forked repository and then do a pull request.\n"
                    },
                    {
                        "name": "How to create a patch without Git",
                        "content": "Unpack a fresh copy of the distribution:\n\nwget http://cpan.metacpan.org/authors/id/T/TI/TIMB/DBI-1.627.tar.gz\ntar xfz DBI-1.627.tar.gz\n\nRename the newly created top level directory:\n\nmv DBI-1.627 DBI-1.627.yourfoo\n\nEdit the contents of DBI-1.627.yourfoo/* till it does what you want.\n\nTest your changes and then remove all temporary files:\n\nmake test && make distclean\n\nGo back to the directory you originally unpacked the distribution:\n\ncd ..\n\nUnpack *another* copy of the original distribution you started with:\n\ntar xfz DBI-1.627.tar.gz\n\nThen create a patch file by performing a recursive \"diff\" on the two top level directories:\n\ndiff -purd DBI-1.627 DBI-1.627.yourfoo > DBI-1.627.yourfoo.patch\n"
                    },
                    {
                        "name": "Speak before you patch",
                        "content": "For anything non-trivial or possibly controversial it's a good idea to discuss (on\ndbi-dev@perl.org) the changes you propose before actually spending time working on them.\nOtherwise you run the risk of them being rejected because they don't fit into some larger plans\nyou may not be aware of.\n\nYou can also reach the developers on IRC (chat). If they are on-line, the most likely place to\ntalk to them is the #dbi channel on irc.perl.org\n"
                    }
                ]
            },
            "TRANSLATIONS": {
                "content": "A German translation of this manual (possibly slightly out of date) is available, thanks to\nO'Reilly, at:\n\nhttp://www.oreilly.de/catalog/perldbiger/\n",
                "subsections": []
            },
            "OTHER RELATED WORK AND PERL MODULES": {
                "content": "Apache::DBI\nTo be used with the Apache daemon together with an embedded Perl interpreter like\n\"modperl\". Establishes a database connection which remains open for the lifetime of the\nHTTP daemon. This way the CGI connect and disconnect for every database access becomes\nsuperfluous.\n\nSQL Parser\nSee also the SQL::Statement module, SQL parser and engine.\n",
                "subsections": []
            }
        }
    }
}