{
    "mode": "info",
    "parameter": "SQL::Eval",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/info/SQL%3A%3AEval/json",
    "generated": "2026-07-05T19:46:47Z",
    "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\nsubclasses to evaluate SQL::Statement objects. The SQL::Eval object can\nbe thought as an abstract state engine for executing SQL queries and\nthe SQL::Eval::Table object is a table abstraction. It implements\nmethods for fetching or storing rows, retrieving column names and\nnumbers and so on.  See the \"test.pl\" script as an example for\nimplementing a subclass.\n\nWhile reading on, keep in mind that these are abstract classes, you\n*must* implement at least some of the methods described below.  In\naddition, you need not derive from SQL::Eval or SQL::Eval::Table, you\njust need to implement the method interface.\n\nAll methods throw a Perl exception in case of errors.\n\nMethod interface of SQL::Eval\nnew     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\nsubclass).\n\nparam   Used for getting or setting input parameters, as in the SQL\nquery\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\nparameters. 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\nread-only access. This routine simply returns the\n\"genaccessfastpath\" of the referenced table.\n\nMethod interface of SQL::Eval::Table\nnew     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\na subclass).\n\nThe following attributes are used by \"SQL::Eval::Table\":\n\ncolnames   Array reference containing the names of the columns\nin order they appear in the table. This attribute\nmust be provided by the derived class.\n\ncolnums    Hash reference containing the column names as keys\nand the column indexes as values. If this is\nomitted (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\ncolumns for read-only access. When the instantiated\nobject does not provide own methods for \"column\"\nand \"columnnum\" a subroutine reference is returned\nwhich directly access the internal data structures.\nFor all other cases a subroutine directly calling\n\"$self->column($[0])\" is returned.\n\nrow     Used to get the current row as an array ref. Do not confuse\ngetting the current row with the fetchrow method! In fact this\nmethod is valid only after a successful \"$table->fetchrow()\".\nExample:\n\n$row = $table->row();\n\ncolumn  Get the column with a given name in the current row. Valid only\nafter a successful \"$table->fetchrow()\". Example:\n\n$col = $table->column($colName);\n\ncolumnnum\nReturn the number of the given column name. Column numbers\nstart with 0. Returns undef, if a column name is not defined,\nso that you can use this for verifying column names. Example:\n\n$colNum = $table->columnnum($colNum);\n\ncolnums\nReturns an hash ref of column names with the column names as\nkeys and the column indexes as the values.\n\ncolnames\nReturns an array ref of column names ordered by their index\nwithin the table.\n\ncapability\nReturns a boolean value whether the table has the specified\ncapability or not. This method might be overridden by derived\nclasses, but ensure that in that case the parent capability\nmethod is called when the derived class does not handle the\nrequested capability.\n\nThe following capabilities are used (and requested) by\nSQL::Statement:\n\nupdateonerow\nDefines whether the table is able to update one\nsingle row. This capability is used for backward\ncompatibility and might have (depending on table\nimplementation) several limitations. Please\ncarefully study the documentation of the table or\nask the author of the table, if this information is\nnot provided.\n\nThis capability is evaluated automatically on first\nrequest and must not be handled by any derived\nclasses.\n\nupdatespecificrow\nDefines if the table is able to update one single\nrow, but keeps the original content of the row to\nupdate.\n\nThis capability is evaluated automatically on first\nrequest and must not be handled by derived classes.\n\nupdatecurrentrow\nDefines if the table is able to update the\ncurrently touched row. This capability requires the\ncapability of \"inplaceupdate\".\n\nThis capability is evaluated automatically on first\nrequest and must not be handled by derived classes.\n\nrowwiseupdate\nDefines if the table is able to do row-wise updates\nwhich means one of \"updateonerow\",\n\"updatespecificrow\" or \"updatecurrentrow\".  The\n\"updatecurrentrow\" is only evaluated if the table\nhas the \"inplaceupdate\" capability.\n\nThis capability is evaluated automatically on first\nrequest and must not be handled by derived classes.\n\ninplaceupdate\nDefines if an update of a row has side effects\n(capability is not available) or can be done\nwithout harming any other currently running task on\nthe table.\n\nExample: The table storage is using a hash on the\n\"PRIMARY KEY\" of the table. Real perl hashes do not\ncare when an item is updated while the hash is\ntraversed using \"each\". \"SDBMFile\" 1.06 has a bug,\nwhich does not adjust the traversal pointer when an\nitem is deleted.\n\n\"SQL::Statement::RAM::Table\" recognizes such\nsituations and adjusts the traversal pointer.\n\nThis might not be possible for all implementations\nwhich can update single rows.\n\nThis capability could be provided by a derived\nclass only.\n\ndeleteonerow\nDefines whether the table can delete one single row\nby it's content or not.\n\nThis capability is evaluated automatically on first\nrequest and must not be handled by derived classes.\n\ndeletecurrentrow\nDefines whether a table can delete the current\ntraversed row or not. This capability requires the\n\"inplacedelete\" capability.\n\nThis capability is evaluated automatically on first\nrequest and must not be handled by derived classes.\n\nrowwisedelete\nDefines if any row-wise delete operation is\nprovided by the table. \"row-wise\" delete\ncapabilities are \"deleteonerow\" and\n\"deletecurrentrow\".\n\nThis capability is evaluated automatically on first\nrequest and must not be handled by derived classes.\n\ninplacedelete\nDefines if the deletion of a row has side effects\n(capability is not available) or can be done\nwithout harming any other currently running task on\nthe table.\n\nThis capability should be provided by a derived\nclass only.\n\ninsertnewrow\nDefines if a table can easily insert a new row\nwithout need to seek or truncate. This capability\nis provided by defining the table class method\n\"insertnewrow\".\n\nThis capability is evaluated automatically on first\nrequest and must not be handled by derived classes.\n\nIf the capabilities rowwiseupdate and insertnewrow are\nprovided, the table primitive \"pushrow\" is not required\nanymore and may be omitted.\n\nThe above methods are implemented by SQL::Eval::Table. The following\nmethods are not, so that they *must* be implemented by the subclass.\nSee the \"DBD::DBM::Table\" or \"DBD::CSV::Table\" for example.\n\ndrop    Drops the table. All resources allocated by the table must be\nreleased after \"$table-\"drop($data)>.\n\nfetchrow\nFetches the next row from the table. Returns \"undef\", if the\nlast row was already fetched. The argument $data is for private\nuse 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\n\"fetchrow\".\n\n\"SQL::Statement\" requires that the last fetched row is\navailable again and again via \"$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\nthe new table. Receives an array ref of names. Example:\n\n$table->pushnames($data, $names);\n\nseek    Similar to the seek method of a filehandle; used for setting\nthe number of the next row being written. Example:\n\n$table->seek($data, $whence, $rowNum);\n\nActually the current implementation only uses \"seek($data, 0,\n0)\" (first row) and \"seek($data, 2, 0)\" (beyond last row, end\nof file).\n\ntruncate\nTruncates a table after the current row. Example:\n\n$table->truncate($data);\n",
            "subsections": []
        },
        "INTERNALS": {
            "content": "The current implementation is quite simple: An SQL::Eval object is an\nhash ref with only two attributes. The \"params\" attribute is an array\nref of parameters. The \"tables\" attribute is an hash ref of table names\n(keys) and table objects (values).\n\nSQL::Eval::Table instances are implemented as hash refs. Attributes\nused are \"row\" (the array ref of the current row), \"colnums\" (an hash\nref of column names as keys and column numbers as values) and\n\"colnames\", an array ref of column names with the column numbers as\nindexes.\n",
            "subsections": []
        },
        "MULTITHREADING": {
            "content": "All methods are working with instance-local data only, thus the module\nis reentrant and thread safe, if you either do not share handles\nbetween threads or grant serialized use.\n",
            "subsections": []
        },
        "BUGS": {
            "content": "Please report any bugs or feature requests to \"bug-sql-statement at\nrt.cpan.org\", or through the web interface at\n<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=SQL-Statement>.  I will\nbe notified, and then you will automatically be notified of progress on\nyour 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\no   RT: CPAN's request tracker\n\n<http://rt.cpan.org/NoAuth/Bugs.html?Dist=SQL-Statement>\n\no   AnnoCPAN: Annotated CPAN documentation\n\n<http://annocpan.org/dist/SQL-Statement>\n\no   CPAN Ratings\n\n<http://cpanratings.perl.org/s/SQL-Statement>\n\no   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\nGeneral Public License or the Artistic License, as specified in the\nPerl README file.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "SQL::Statement(3)\n\nperl v5.30.3                      2020-10-23                    SQL::Eval(3pm)",
            "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"
        },
        {
            "name": "Eval",
            "section": "3pm",
            "url": "https://www.chedong.com/phpMan.php/man/Eval/3pm/json"
        }
    ]
}