{
    "content": [
        {
            "type": "text",
            "text": "# DBI::Gofer::Execute (perldoc)\n\n**Summary:** DBI::Gofer::Execute - Executes Gofer requests and returns Gofer responses\n\n**Synopsis:** $executor = DBI::Gofer::Execute->new( { ...config... });\n$response = $executor->executerequest( $request );\n\n## Section Outline\n\n- **NAME** (3 lines)\n- **SYNOPSIS** (4 lines)\n- **DESCRIPTION** (11 lines)\n- **CONFIGURATION** (78 lines)\n- **DRIVER-SPECIFIC ISSUES** (8 lines)\n- **TESTING** (55 lines)\n- **AUTHOR** (2 lines)\n- **LICENCE AND COPYRIGHT** (5 lines)\n\n## Full Content\n\n### NAME\n\nDBI::Gofer::Execute - Executes Gofer requests and returns Gofer\nresponses\n\n### SYNOPSIS\n\n$executor = DBI::Gofer::Execute->new( { ...config... });\n\n$response = $executor->executerequest( $request );\n\n### DESCRIPTION\n\nAccepts a DBI::Gofer::Request object, executes the requested DBI method\ncalls, and returns a DBI::Gofer::Response object.\n\nAny error, including any internal 'fatal' errors are caught and\nconverted into a DBI::Gofer::Response object.\n\nThis module is usually invoked by a 'server-side' Gofer transport\nmodule. They usually have names in the \"\"DBI::Gofer::Transport::*\"\"\nnamespace. Examples include: DBI::Gofer::Transport::stream and\nDBI::Gofer::Transport::modperl.\n\n### CONFIGURATION\n\ncheckrequestsub\nIf defined, it must be a reference to a subroutine that will 'check' the\nrequest. It is passed the request object and the executor as its only\narguments.\n\nThe subroutine can either return the original request object or die with\na suitable error message (which will be turned into a Gofer response).\n\nIt can also construct and return a new request that should be executed\ninstead of the original request.\n\ncheckresponsesub\nIf defined, it must be a reference to a subroutine that will 'check' the\nresponse. It is passed the response object, the executor, and the\nrequest object. The sub may alter the response object and return undef,\nor return a new response object.\n\nThis mechanism can be used to, for example, terminate the service if\nspecific database errors are seen.\n\nforcedconnectdsn\nIf set, this DSN is always used instead of the one in the request.\n\ndefaultconnectdsn\nIf set, this DSN is used if \"forcedconnectdsn\" is not set and the\nrequest does not contain a DSN itself.\n\nforcedconnectattributes\nA reference to a hash of connect() attributes. Individual attributes in\n\"forcedconnectattributes\" will take precedence over corresponding\nattributes in the request.\n\ndefaultconnectattributes\nA reference to a hash of connect() attributes. Individual attributes in\nthe request take precedence over corresponding attributes in\n\"defaultconnectattributes\".\n\nmaxcacheddbhperdrh\nIf set, the loaded drivers will be checked to ensure they don't have\nmore than this number of cached connections. There is no default value.\nThis limit is not enforced for every request.\n\nmaxcachedsthperdbh\nIf set, all the cached statement handles will be cleared once the number\nof cached statement handles rises above this limit. The default is 1000.\n\nforcedsingleresultset\nIf true, then only the first result set will be fetched and returned in\nthe response.\n\nforcedresponseattributes\nA reference to a data structure that can specify extra attributes to be\nreturned in responses.\n\nforcedresponseattributes => {\nDriverName => {\ndbh => [ qw(dbhattribname) ],\nsth => [ qw(sthattribname) ],\n},\n},\n\nThis can be useful in cases where the driver has not implemented the\nprivateattributeinfo() method and DBI::Gofer::Execute's own fallback\nlist of private attributes doesn't include the driver or attributes you\nneed.\n\ntrackrecent\nIf set, specifies the number of recent requests and responses that\nshould be kept by the updatestats() method for diagnostics. See\nDBI::Gofer::Transport::modperl.\n\nNote that this setting can significantly increase memory use. Use with\ncaution.\n\nforcedgoferrandom\nEnable forced random failures and/or delays for testing. See\n\"DBIGOFERRANDOM\" below.\n\n### DRIVER-SPECIFIC ISSUES\n\nGofer needs to know about any driver-private attributes that should have\ntheir values sent back to the client.\n\nIf the driver doesn't support privateattributeinfo() method, and very\nfew do, then the module fallsback to using some hard-coded details, if\navailable, for the driver being used. Currently hard-coded details are\navailable for the mysql, Pg, Sybase, and SQLite drivers.\n\n### TESTING\n\nDBD::Gofer, DBD::Execute and related packages are well tested by\nexecuting the DBI test suite with DBIAUTOPROXY configured to route all\nDBI calls via DBD::Gofer.\n\nBecause Gofer includes timeout and 'retry on error' mechanisms there is\na need for some way to trigger delays and/or errors. This can be done\nvia the \"forcedgoferrandom\" configuration item, or else the\nDBIGOFERRANDOM environment variable.\n\nDBIGOFERRANDOM\nThe value of the \"forcedgoferrandom\" configuration item (or else the\nDBIGOFERRANDOM environment variable) is treated as a series of tokens\nseparated by commas.\n\nThe tokens can be one of three types:\n\nfail=R%\nSet the current failure rate to R where R is a percentage. The value\nR can be floating point, e.g., \"fail=0.05%\". Negative values for R\nhave special meaning, see below.\n\nerr=N\nSets the current failure err value to N (instead of the DBI's\ndefault 'standard err value' of 2000000000). This is useful when you\nwant to simulate a specific error.\n\ndelayN=R%\nSet the current random delay rate to R where R is a percentage, and\nset the current delay duration to N seconds. The values of R and N\ncan be floating point, e.g., \"delay0.5=0.2%\". Negative values for R\nhave special meaning, see below.\n\nIf R is an odd number (R % 2 == 1) then a message is logged via\nwarn() which will be returned to, and echoed at, the client.\n\nmethodname\nApplies the current fail, err, and delay values to the named method.\nIf neither a fail nor delay have been set yet then a warning is\ngenerated.\n\nFor example:\n\n$executor = DBI::Gofer::Execute->new( {\nforcedgoferrandom => \"fail=0.01%,do,delay60=1%,execute\",\n});\n\nwill cause the do() method to fail for 0.01% of calls, and the execute()\nmethod to fail 0.01% of calls and be delayed by 60 seconds on 1% of\ncalls.\n\nIf the percentage value (\"R\") is negative then instead of the failures\nbeing triggered randomly (via the rand() function) they are triggered\nvia a sequence number. In other words \"\"fail=-20%\"\" will mean every\nfifth call will fail. Each method has a distinct sequence number.\n\n### AUTHOR\n\nTim Bunce, <http://www.tim.bunce.name>\n\n### LICENCE AND COPYRIGHT\n\nCopyright (c) 2007, Tim Bunce, Ireland. All rights reserved.\n\nThis module is free software; you can redistribute it and/or modify it\nunder the same terms as Perl itself. See perlartistic.\n\n"
        }
    ],
    "structuredContent": {
        "command": "DBI::Gofer::Execute",
        "section": "",
        "mode": "perldoc",
        "summary": "DBI::Gofer::Execute - Executes Gofer requests and returns Gofer responses",
        "synopsis": "$executor = DBI::Gofer::Execute->new( { ...config... });\n$response = $executor->executerequest( $request );",
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 11,
                "subsections": []
            },
            {
                "name": "CONFIGURATION",
                "lines": 78,
                "subsections": []
            },
            {
                "name": "DRIVER-SPECIFIC ISSUES",
                "lines": 8,
                "subsections": []
            },
            {
                "name": "TESTING",
                "lines": 55,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "LICENCE AND COPYRIGHT",
                "lines": 5,
                "subsections": []
            }
        ]
    }
}