{
    "mode": "perldoc",
    "parameter": "SQL::Eval",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/SQL%3A%3AEval/json",
    "generated": "2026-06-10T16:21:08Z",
    "synopsis": "require SQL::Statement;\nrequire SQL::Eval;\n# Create an SQL statement; use a concrete subclass of\n# SQL::Statement\nmy $stmt = MyStatement->new(\"SELECT * FROM foo, bar\",\nSQL::Parser->new('Ansi'));\n# Get an eval object by calling opentables; this\n# will call MyStatement::opentable\nmy $eval = $stmt->opentables($data);\n# Set parameter 0 to 'Van Gogh'\n$eval->param(0, 'Van Gogh');\n# Get parameter 2\nmy $param = $eval->param(2);\n# Get the SQL::Eval::Table object referring the 'foo' table\nmy $fooTable = $eval->table('foo');",
    "sections": {
        "NAME": {
            "content": "SQL::Eval - Base for deriving evaluation objects for SQL::Statement\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "require SQL::Statement;\nrequire SQL::Eval;\n\n# Create an SQL statement; use a concrete subclass of\n# SQL::Statement\nmy $stmt = MyStatement->new(\"SELECT * FROM foo, bar\",\nSQL::Parser->new('Ansi'));\n\n# Get an eval object by calling opentables; this\n# will call MyStatement::opentable\nmy $eval = $stmt->opentables($data);\n\n# Set parameter 0 to 'Van Gogh'\n$eval->param(0, 'Van Gogh');\n# Get parameter 2\nmy $param = $eval->param(2);\n\n# Get the SQL::Eval::Table object referring the 'foo' table\nmy $fooTable = $eval->table('foo');\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This module implements two classes that can be used for deriving subclasses to evaluate\nSQL::Statement objects. The SQL::Eval object can be thought as an abstract state engine for\nexecuting SQL queries and the SQL::Eval::Table object is a table abstraction. It implements\nmethods for fetching or storing rows, retrieving column names and numbers and so on. See the\n\"test.pl\" script as an example for implementing a subclass.\n\nWhile reading on, keep in mind that these are abstract classes, you *must* implement at least\nsome of the methods described below. In addition, you need not derive from SQL::Eval or\nSQL::Eval::Table, you just need to implement the method interface.\n\nAll methods throw a Perl exception in case of errors.\n",
            "subsections": [
                {
                    "name": "Method interface of SQL::Eval",
                    "content": "new     Constructor; use it like this:\n\n$eval = SQL::Eval->new(\\%attr);\n\nBlesses the hash ref \\%attr into the SQL::Eval class (or a subclass).\n\nparam   Used for getting or setting input parameters, as in the SQL query\n\nINSERT INTO foo VALUES (?, ?);\n\nExample:\n\n$eval->param(0, $val);        # Set parameter 0\n$eval->param(0);              # Get parameter 0\n\nparams  Used for getting or setting the complete array of input parameters. Example:\n\n$eval->params($params);       # Set the array\n$eval->params();              # Get the array\n\ntable   Returns or sets a table object. Example:\n\n$eval->table('foo', $fooTable);  # Set the 'foo' table object\n$eval->table('foo');             # Return the 'foo' table object\n\ncolumn  Return the value of a column with a given name; example:\n\n$col = $eval->column('foo', 'id');  # Return the 'id' column of\n# the current row in the\n# 'foo' table\n\nThis is equivalent to and a shorthand for\n\n$col = $eval->table('foo')->column('id');\n\ngenaccessfastpath\nReturn a subroutine reference for fast accessing columns for read-only access. This\nroutine simply returns the \"genaccessfastpath\" of the referenced table.\n"
                },
                {
                    "name": "Method interface of SQL::Eval::Table",
                    "content": "new     Constructor; use it like this:\n\n$eval = SQL::Eval::Table->new(\\%attr);\n\nBlesses the hash ref \\%attr into the SQL::Eval::Table class (or a subclass).\n\nThe following attributes are used by \"SQL::Eval::Table\":\n\ncolnames   Array reference containing the names of the columns in order they appear in\nthe table. This attribute must be provided by the derived class.\n\ncolnums    Hash reference containing the column names as keys and the column indexes as\nvalues. If this is omitted (does not exist), it will be created from\n\"colnames\".\n\ncapabilities\nHash reference containing additional capabilities.\n\ngenaccessfastpath\nReturn a subroutine reference for fast accessing columns for read-only\naccess. When the instantiated object does not provide own methods for\n\"column\" and \"columnnum\" a subroutine reference is returned which directly\naccess the internal data structures. For all other cases a subroutine\ndirectly calling \"$self->column($[0])\" is returned.\n\nrow     Used to get the current row as an array ref. Do not confuse getting the current row with\nthe fetchrow method! In fact this method is valid only after a successful\n\"$table->fetchrow()\". Example:\n\n$row = $table->row();\n\ncolumn  Get the column with a given name in the current row. Valid only after a successful\n\"$table->fetchrow()\". Example:\n\n$col = $table->column($colName);\n\ncolumnnum\nReturn the number of the given column name. Column numbers start with 0. Returns undef,\nif a column name is not defined, so that you can use this for verifying column names.\nExample:\n\n$colNum = $table->columnnum($colNum);\n\ncolnums\nReturns an hash ref of column names with the column names as keys and the column indexes\nas the values.\n\ncolnames\nReturns an array ref of column names ordered by their index within the table.\n\ncapability\nReturns a boolean value whether the table has the specified capability or not. This\nmethod might be overridden by derived classes, but ensure that in that case the parent\ncapability method is called when the derived class does not handle the requested\ncapability.\n\nThe following capabilities are used (and requested) by SQL::Statement:\n\nupdateonerow\nDefines whether the table is able to update one single row. This capability\nis used for backward compatibility and might have (depending on table\nimplementation) several limitations. Please carefully study the\ndocumentation of the table or ask the author of the table, if this\ninformation is not provided.\n\nThis capability is evaluated automatically on first request and must not be\nhandled by any derived classes.\n\nupdatespecificrow\nDefines if the table is able to update one single row, but keeps the\noriginal content of the row to update.\n\nThis capability is evaluated automatically on first request and must not be\nhandled by derived classes.\n\nupdatecurrentrow\nDefines if the table is able to update the currently touched row. This\ncapability requires the capability of \"inplaceupdate\".\n\nThis capability is evaluated automatically on first request and must not be\nhandled by derived classes.\n\nrowwiseupdate\nDefines if the table is able to do row-wise updates which means one of\n\"updateonerow\", \"updatespecificrow\" or \"updatecurrentrow\". The\n\"updatecurrentrow\" is only evaluated if the table has the \"inplaceupdate\"\ncapability.\n\nThis capability is evaluated automatically on first request and must not be\nhandled by derived classes.\n\ninplaceupdate\nDefines if an update of a row has side effects (capability is not available)\nor can be done without harming any other currently running task on the\ntable.\n\nExample: The table storage is using a hash on the \"PRIMARY KEY\" of the\ntable. Real perl hashes do not care when an item is updated while the hash\nis traversed using \"each\". \"SDBMFile\" 1.06 has a bug, which does not adjust\nthe traversal pointer when an item is deleted.\n\n\"SQL::Statement::RAM::Table\" recognizes such situations and adjusts the\ntraversal pointer.\n\nThis might not be possible for all implementations which can update single\nrows.\n\nThis capability could be provided by a derived class only.\n\ndeleteonerow\nDefines whether the table can delete one single row by it's content or not.\n\nThis capability is evaluated automatically on first request and must not be\nhandled by derived classes.\n\ndeletecurrentrow\nDefines whether a table can delete the current traversed row or not. This\ncapability requires the \"inplacedelete\" capability.\n\nThis capability is evaluated automatically on first request and must not be\nhandled by derived classes.\n\nrowwisedelete\nDefines if any row-wise delete operation is provided by the table.\n\"row-wise\" delete capabilities are \"deleteonerow\" and\n\"deletecurrentrow\".\n\nThis capability is evaluated automatically on first request and must not be\nhandled by derived classes.\n\ninplacedelete\nDefines if the deletion of a row has side effects (capability is not\navailable) or can be done without harming any other currently running task\non the table.\n\nThis capability should be provided by a derived class only.\n\ninsertnewrow\nDefines if a table can easily insert a new row without need to seek or\ntruncate. This capability is provided by defining the table class method\n\"insertnewrow\".\n\nThis capability is evaluated automatically on first request and must not be\nhandled by derived classes.\n\nIf the capabilities *rowwiseupdate* and *insertnewrow* are provided, the table\nprimitive \"pushrow\" is not required anymore and may be omitted.\n\nThe above methods are implemented by SQL::Eval::Table. The following methods are not, so that\nthey *must* be implemented by the subclass. See the \"DBD::DBM::Table\" or \"DBD::CSV::Table\" for\nexample.\n\ndrop    Drops the table. All resources allocated by the table must be released after\n\"$table-\"drop($data)>.\n\nfetchrow\nFetches the next row from the table. Returns \"undef\", if the last row was already\nfetched. The argument $data is for private use of the subclass. Example:\n\n$row = $table->fetchrow($data);\n\nNote, that you may use\n\n$row = $table->row();\n\nfor retrieving the same row again, until the next call of \"fetchrow\".\n\n\"SQL::Statement\" requires that the last fetched row is available again and again via\n\"$table-\"row()>.\n\npushrow\nAs fetchrow except for storing rows. Example:\n\n$table->pushrow($data, $row);\n\npushnames\nUsed by the *CREATE TABLE* statement to set the column names of the new table. Receives\nan array ref of names. Example:\n\n$table->pushnames($data, $names);\n\nseek    Similar to the seek method of a filehandle; used for setting the number of the next row\nbeing written. Example:\n\n$table->seek($data, $whence, $rowNum);\n\nActually the current implementation only uses \"seek($data, 0, 0)\" (first row) and\n\"seek($data, 2, 0)\" (beyond last row, end of file).\n\ntruncate\nTruncates a table after the current row. Example:\n\n$table->truncate($data);\n"
                }
            ]
        },
        "INTERNALS": {
            "content": "The current implementation is quite simple: An SQL::Eval object is an hash ref with only two\nattributes. The \"params\" attribute is an array ref of parameters. The \"tables\" attribute is an\nhash ref of table names (keys) and table objects (values).\n\nSQL::Eval::Table instances are implemented as hash refs. Attributes used are \"row\" (the array\nref of the current row), \"colnums\" (an hash ref of column names as keys and column numbers as\nvalues) and \"colnames\", an array ref of column names with the column numbers as indexes.\n",
            "subsections": []
        },
        "MULTITHREADING": {
            "content": "All methods are working with instance-local data only, thus the module is reentrant and thread\nsafe, if you either do not share handles between threads or grant serialized use.\n",
            "subsections": []
        },
        "BUGS": {
            "content": "Please report any bugs or feature requests to \"bug-sql-statement at rt.cpan.org\", or through the\nweb interface at <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=SQL-Statement>. I will be\nnotified, and then you will automatically be notified of progress on your bug as I make changes.\n",
            "subsections": []
        },
        "SUPPORT": {
            "content": "You can find documentation for this module with the perldoc command.\n\nperldoc SQL::Eval\nperldoc SQL::Statement\n\nYou can also look for information at:\n\n*   RT: CPAN's request tracker\n\n<http://rt.cpan.org/NoAuth/Bugs.html?Dist=SQL-Statement>\n\n*   AnnoCPAN: Annotated CPAN documentation\n\n<http://annocpan.org/dist/SQL-Statement>\n\n*   CPAN Ratings\n\n<http://cpanratings.perl.org/s/SQL-Statement>\n\n*   Search CPAN\n\n<http://search.cpan.org/dist/SQL-Statement/>\n",
            "subsections": []
        },
        "AUTHOR AND COPYRIGHT": {
            "content": "Written by Jochen Wiedmann and currently maintained by Jens Rehsack.\n\nThis module is Copyright (C) 1998 by\n\nJochen Wiedmann\nAm Eisteich 9\n72555 Metzingen\nGermany\n\nEmail: joe@ispsoft.de\nPhone: +49 7123 14887\n\nand Copyright (C) 2009, 2017 by\n\nJens Rehsack < rehsackATcpan.org>\n\nAll rights reserved.\n\nYou may distribute this module under the terms of either the GNU General Public License or the\nArtistic License, as specified in the Perl README file.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "SQL::Statement(3)\n",
            "subsections": []
        }
    },
    "summary": "SQL::Eval - Base for deriving evaluation objects for SQL::Statement",
    "flags": [],
    "examples": [],
    "see_also": [
        {
            "name": "Statement",
            "section": "3",
            "url": "https://www.chedong.com/phpMan.php/man/Statement/3/json"
        }
    ]
}