{
    "content": [
        {
            "type": "text",
            "text": "# DBI::DBD::Metadata (perldoc)\n\n## NAME\n\nDBI::DBD::Metadata - Generate the code and data for some DBI metadata methods\n\n## SYNOPSIS\n\nThe idea is to extract metadata information from a good quality ODBC driver and use it to\ngenerate code and data to use in your own DBI driver for the same database.\nTo generate code to support the getinfo method:\nperl -MDBI::DBD::Metadata -e \"writegetinfopm('dbi:ODBC:dsn-name','user','pass','Driver')\"\nperl -MDBI::DBD::Metadata -e writegetinfopm dbi:ODBC:foodb username password Driver\nTo generate code to support the typeinfo method:\nperl -MDBI::DBD::Metadata -e \"writetypeinfopm('dbi:ODBC:dsn-name','user','pass','Driver')\"\nperl -MDBI::DBD::Metadata -e writetypeinfopm dbi:ODBC:dsn-name user pass Driver\nWhere \"dbi:ODBC:dsn-name\" is the connection to use to extract the data, and \"Driver\" is the name\nof the driver you want the code generated for (the driver name gets embedded into the output in\nnumerous places).\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **Generating a GetInfo package for a driver**\n- **Generating a TypeInfo package for a driver**\n- **AUTHORS**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "DBI::DBD::Metadata",
        "section": "",
        "mode": "perldoc",
        "summary": "DBI::DBD::Metadata - Generate the code and data for some DBI metadata methods",
        "synopsis": "The idea is to extract metadata information from a good quality ODBC driver and use it to\ngenerate code and data to use in your own DBI driver for the same database.\nTo generate code to support the getinfo method:\nperl -MDBI::DBD::Metadata -e \"writegetinfopm('dbi:ODBC:dsn-name','user','pass','Driver')\"\nperl -MDBI::DBD::Metadata -e writegetinfopm dbi:ODBC:foodb username password Driver\nTo generate code to support the typeinfo method:\nperl -MDBI::DBD::Metadata -e \"writetypeinfopm('dbi:ODBC:dsn-name','user','pass','Driver')\"\nperl -MDBI::DBD::Metadata -e writetypeinfopm dbi:ODBC:dsn-name user pass Driver\nWhere \"dbi:ODBC:dsn-name\" is the connection to use to extract the data, and \"Driver\" is the name\nof the driver you want the code generated for (the driver name gets embedded into the output in\nnumerous places).",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 19,
                "subsections": []
            },
            {
                "name": "Generating a GetInfo package for a driver",
                "lines": 38,
                "subsections": []
            },
            {
                "name": "Generating a TypeInfo package for a driver",
                "lines": 33,
                "subsections": []
            },
            {
                "name": "AUTHORS",
                "lines": 3,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "DBI::DBD::Metadata - Generate the code and data for some DBI metadata methods\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "The idea is to extract metadata information from a good quality ODBC driver and use it to\ngenerate code and data to use in your own DBI driver for the same database.\n\nTo generate code to support the getinfo method:\n\nperl -MDBI::DBD::Metadata -e \"writegetinfopm('dbi:ODBC:dsn-name','user','pass','Driver')\"\n\nperl -MDBI::DBD::Metadata -e writegetinfopm dbi:ODBC:foodb username password Driver\n\nTo generate code to support the typeinfo method:\n\nperl -MDBI::DBD::Metadata -e \"writetypeinfopm('dbi:ODBC:dsn-name','user','pass','Driver')\"\n\nperl -MDBI::DBD::Metadata -e writetypeinfopm dbi:ODBC:dsn-name user pass Driver\n\nWhere \"dbi:ODBC:dsn-name\" is the connection to use to extract the data, and \"Driver\" is the name\nof the driver you want the code generated for (the driver name gets embedded into the output in\nnumerous places).\n",
                "subsections": []
            },
            "Generating a GetInfo package for a driver": {
                "content": "The \"writegetinfopm\" in the DBI::DBD::Metadata module generates a DBD::Driver::GetInfo package\non standard output.\n\nThis method generates a DBD::Driver::GetInfo package from the data source you specified in the\nparameter list or in the environment variable DBIDSN. DBD::Driver::GetInfo should help a DBD\nauthor implement the DBI getinfo() method. Because you are just creating this package, it is\nvery unlikely that DBD::Driver already provides a good implementation for getinfo(). Thus you\nwill probably connect via DBD::ODBC.\n\nOnce you are sure that it is producing reasonably sane data, you should typically redirect the\nstandard output to lib/DBD/Driver/GetInfo.pm, and then hand edit the result. Do not forget to\nupdate your Makefile.PL and MANIFEST to include this as an extra PM file that should be\ninstalled.\n\nIf you connect via DBD::ODBC, you should use version 0.38 or greater;\n\nPlease take a critical look at the data returned! ODBC drivers vary dramatically in their\nquality.\n\nThe generator assumes that most values are static and places these values directly in the %info\nhash. A few examples show the use of CODE references and the implementation via subroutines. It\nis very likely that you will have to write additional subroutines for values depending on the\nsession state or server version, e.g. SQLDBMSVER.\n\nA possible implementation of DBD::Driver::db::getinfo() may look like:\n\nsub getinfo {\nmy($dbh, $infotype) = @;\nrequire DBD::Driver::GetInfo;\nmy $v = $DBD::Driver::GetInfo::info{int($infotype)};\n$v = $v->($dbh) if ref $v eq 'CODE';\nreturn $v;\n}\n\nPlease replace Driver (or \"<foo>\") with the name of your driver. Note that this stub function is\ngenerated for you by writegetinfopm function, but you must manually transfer the code to\nDriver.pm.\n",
                "subsections": []
            },
            "Generating a TypeInfo package for a driver": {
                "content": "The \"writetypeinfopm\" function in the DBI::DBD::Metadata module generates on standard output\nthe data needed for a driver's typeinfoall method. It also provides default implementations of\nthe typeinfoall method for inclusion in the driver's main implementation file.\n\nThe driver parameter is the name of the driver for which the methods will be generated; for the\nsake of examples, this will be \"Driver\". Typically, the dsn parameter will be of the form\n\"dbi:ODBC:odbcdsn\", where the odbcdsn is a DSN for one of the driver's databases. The user and\npass parameters are the other optional connection parameters that will be provided to the DBI\nconnect method.\n\nOnce you are sure that it is producing reasonably sane data, you should typically redirect the\nstandard output to lib/DBD/Driver/TypeInfo.pm, and then hand edit the result if necessary. Do\nnot forget to update your Makefile.PL and MANIFEST to include this as an extra PM file that\nshould be installed.\n\nPlease take a critical look at the data returned! ODBC drivers vary dramatically in their\nquality.\n\nThe generator assumes that all the values are static and places these values directly in the\n%info hash.\n\nA possible implementation of DBD::Driver::typeinfoall() may look like:\n\nsub typeinfoall {\nmy ($dbh) = @;\nrequire DBD::Driver::TypeInfo;\nreturn [ @$DBD::Driver::TypeInfo::typeinfoall ];\n}\n\nPlease replace Driver (or \"<foo>\") with the name of your driver. Note that this stub function is\ngenerated for you by the writetypeinfopm function, but you must manually transfer the code to\nDriver.pm.\n",
                "subsections": []
            },
            "AUTHORS": {
                "content": "Jonathan Leffler <jleffler@us.ibm.com> (previously <jleffler@informix.com>), Jochen Wiedmann\n<joe@ispsoft.de>, Steffen Goeldner <sgoeldner@cpan.org>, and Tim Bunce <dbi-users@perl.org>.\n",
                "subsections": []
            }
        }
    }
}