{
    "mode": "perldoc",
    "parameter": "SQL::Statement",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/SQL%3A%3AStatement/json",
    "generated": "2026-06-11T06:51:52Z",
    "synopsis": "# ... depends on what you want to do, see below",
    "sections": {
        "NAME": {
            "content": "SQL::Statement - SQL parsing and processing engine\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "# ... depends on what you want to do, see below\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "The SQL::Statement module implements a pure Perl SQL parsing and execution engine. While it by\nno means implements full ANSI standard, it does support many features including column and table\naliases, built-in and user-defined functions, implicit and explicit joins, complex nested search\nconditions, and other features.\n\nSQL::Statement is a small embeddable Database Management System (DBMS). This means that it\nprovides all of the services of a simple DBMS except that instead of a persistent storage\nmechanism, it has two things: 1) an in-memory storage mechanism that allows you to prepare,\nexecute, and fetch from SQL statements using temporary tables and 2) a set of software sockets\nwhere any author can plug in any storage mechanism.\n\nThere are three main uses for SQL::Statement. One or another (hopefully not all) may be\nirrelevant for your needs: 1) to access and manipulate data in CSV, XML, and other formats 2) to\nbuild your own DBD for a new data source 3) to parse and examine the structure of SQL\nstatements.\n",
            "subsections": []
        },
        "INSTALLATION": {
            "content": "There are no prerequisites for using this as a standalone parser. If you want to access\npersistent stored data, you either need to write a subclass or use one of the DBI DBD drivers.\nYou can install this module using CPAN.pm, CPANPLUS.pm, PPM, apt-get, or other packaging tools\nor you can download the tar.gz file from CPAN and use the standard perl mantra:\n\nperl Makefile.PL\nmake\nmake test\nmake install\n\nIt works fine on all platforms it has been tested on. On Windows, you can use ppm or with the\nmantra use nmake, dmake, or make depending on which is available.\n",
            "subsections": []
        },
        "USAGE": {
            "content": "How can I use SQL::Statement to access and modify data?\nSQL::Statement provides the SQL engine for a number of existing DBI drivers including DBD::CSV,\nDBD::DBM, DBD::AnyData, DBD::Excel, DBD::Amazon, and others.\n\nThese modules provide access to Comma Separated Values, Fixed Length, XML, HTML and many other\nkinds of text files, to Excel Spreadsheets, to BerkeleyDB and other DBM formats, and to\nnon-traditional data sources like on-the-fly Amazon searches.\n\nIf you are interested in accessing and manipulating persistent data, you may not really want to\nuse SQL::Statement directly, but use DBI along with one of the DBDs mentioned above instead. You\nwill be using SQL::Statement, but under the hood of the DBD. See <http://dbi.perl.org> for help\nwith DBI and see SQL::Statement::Syntax for a description of the SQL syntax that SQL::Statement\nprovides for these modules and see the documentation for whichever DBD you are using for\nadditional details.\n\nHow can I use it to parse and examine the structure of SQL statements?\nSQL::Statement can be used stand-alone (without a subclass and without DBI) to parse and examine\nthe structure of SQL statements. See SQL::Statement::Structure for details.\n\nHow can I use it to embed a SQL engine in a DBD or other module?\nSQL::Statement is designed to be easily embedded in other modules and is especially suited for\ndeveloping new DBI drivers (DBDs). See SQL::Statement::Embed.\n\nWhat SQL Syntax is supported?\nSQL::Statement supports a small but powerful subset of SQL commands. See SQL::Statement::Syntax.\n\nHow can I extend the supported SQL syntax?\nYou can modify and extend the SQL syntax either by issuing SQL commands or by subclassing\nSQL::Statement. See SQL::Statement::Syntax.\n\nHow can I participate in ongoing development?\nSQL::Statement is a large module with many potential future directions. You are invited to help\nplan, code, test, document, or kibbitz about these directions. If you want to join the\ndevelopment team, or just hear more about the development, write Jeff (<jzuckerATcpan.org>) or\nJens (<rehsackATcpan.org>) a note.\n",
            "subsections": []
        },
        "METHODS": {
            "content": "The following methods can or must be overridden by derived classes.\n\ncapability\n$hascapability = $h->capability('capabilityname');\n\nReturns a true value if the specified capability is available.\n\nCurrently no capabilities are defined and this is a placeholder for future use. It is envisioned\nit will be used like \"SQL::Eval::Table::capability\".\n\nopentable\nThe \"opentable\" method must be overridden by derived classes to provide the capability of\nopening data tables. This is a necessity.\n\nArguments given to opentable call:\n\n$data\nThe database memo parameter. See \"execute\".\n\n$table\nThe name of the table to open as parsed from SQL statement.\n\n$createMode\nA flag indicating the mode (\"CREATE TABLE ...\") the table should be opened with. Set to a\ntrue value in create mode.\n\n$lockMode\nA flag indicating whether the table should be opened for writing (any other than \"SELECT\n...\"). Set to a true value if the table is to be opened for write access.\n\nThe following methods are required to use SQL::Statement in a DBD (for example).\n\nnew\nInstantiates a new SQL::Statement object.\n\nArguments:\n\n$sql\nThe SQL statement for later actions.\n\n$parser\nAn instance of a SQL::Parser object or flags for it's instantiation. If omitted, default\nflags are used.\n\nWhen the basic initialization is completed, \"$self->prepare($sql, $parser)\" is invoked.\n\nprepare\nPrepares SQL::Statement to execute a SQL statement.\n\nArguments:\n\n$sql\nThe SQL statement to parse and prepare.\n\n$parser\nInstance of a SQL::Parser object to parse the provided SQL statement.\n\nexecute\nExecutes a prepared statement.\n\nArguments:\n\n$data\nMemo field passed through to calls of the instantiated $table objects or \"opentable\" calls.\nIn \"CREATE\" with subquery, \"$data->{Database}\" must be a DBI database handle object.\n\n$params\nBound params via DBI ...\n\nerrstr\nGives the error string of the last error, if any.\n\nfetchrow\nFetches the next row from the result data set (implies removing the fetched row from the result\ndata set).\n\nfetchrows\nFetches all (remaining) rows from the result data set.\n",
            "subsections": []
        },
        "SUPPORT": {
            "content": "You can find documentation for this module with the perldoc command.\n\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*   CPAN Search\n\n<http://search.cpan.org/dist/SQL-Statement/>\n\nWhere can I go for help?\nFor questions about installation or usage, please ask on the dbi-users@perl.org mailing list\n(see http://dbi.perl.org) or post a question on PerlMonks (<http://www.perlmonks.org/>, where\nJeff is known as jZed). Jens does not visit PerlMonks on a regular basis.\n\nIf you have a bug report, a patch or a suggestion, please open a new report ticket at CPAN (but\nplease check previous reports first in case your issue has already been addressed). You can mail\nany of the module maintainers, but you are more assured of an answer by posting to the dbi-users\nlist or reporting the issue in RT.\n\nReport tickets should contain a detailed description of the bug or enhancement request and at\nleast an easily verifiable way of reproducing the issue or fix. Patches are always welcome, too.\n\nWhere can I go for help with a concrete version?\nBugs and feature requests are accepted against the latest version only. To get patches for\nearlier versions, you need to get an agreement with a developer of your choice - who may or not\nreport the issue and a suggested fix upstream (depends on the license you have chosen).\n",
            "subsections": [
                {
                    "name": "Business support and maintenance",
                    "content": "For business support you can contact Jens via his CPAN email address rehsackATcpan.org. Please\nkeep in mind that business support is neither available for free nor are you eligible to receive\nany support based on the license distributed with this package.\n"
                }
            ]
        },
        "ACKNOWLEDGEMENTS": {
            "content": "Jochen Wiedmann created the original module as an XS (C) extension in 1998. Jeff Zucker took\nover the maintenance in 2001 and rewrote all of the C portions in Perl and began extending the\nSQL support. More recently Ilya Sterin provided help with SQL::Parser, Tim Bunce provided both\ngeneral and specific support, Dan Wright and Dean Arnold have contributed extensively to the\ncode, and dozens of people from around the world have submitted patches, bug reports, and\nsuggestions.\n\nIn 2008 Jens Rehsack took over the maintenance of the extended module from Jeff. Together with\nH.Merijn Brand (who has taken DBD::CSV), Detlef Wartke and Volker Schubbert (especially between\n1.16 developer versions until 1.22) and all submitters of bug reports via RT a lot of issues\nhave been fixed.\n\nThanks to all!\n\nIf you're interested in helping develop SQL::Statement or want to use it with your own modules,\nfeel free to contact Jeff or Jens.\n",
            "subsections": []
        },
        "BUGS AND LIMITATIONS": {
            "content": "*   Currently we treat NULL and '' as the same in AnyData/CSV mode - eventually fix.\n\n*   No nested C-style comments allowed as SQL99 says.\n\n*   There are some issues regarding combining outer joins with where clauses.\n\n*   Aggregate functions cannot be used in where clause.\n\n*   Some SQL commands/features are not supported (most of them cannot by design), as \"LOCK\nTABLE\", using indices, sub-selects etc.\n\nCurrently the statement for missing features is: I plan to create a SQL::Statement v2.00\nbased on a pure Backus-Naur-Form parser and a fully object oriented command pattern based\nengine implementation. When the time is available, I will do it. Until then bugs will be\nfixed or other Perl modules under my maintainership will receive my time. Features which can\nbe added without deep design changes might be applied earlier - especially when their\naddition allows studying effective ways to implement the feature in upcoming 2.00.\n\n*   Some people report that SQL::Statement is slower since the XS parts were implemented in pure\nPerl. This might be true, but on the other hand a large number of features have been added\nincluding support for ANSI SQL 99.\n\nFor SQL::Statement 1.xx it's not planned to add new XS parts.\n\n*   Wildcards are expanded to lower cased identifiers. This might confuse some people, but it\nwas easier to implement.\n\nThe warning in DBI to never trust the case of returned column names should be read more\noften. If you need to rely on identifiers, always use \"sth->{NAMElc}\" or \"sth->{NAMEuc}\" -\nnever rely on \"sth->{NAME}\":\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\nSee \"FetchHashKeyName\" in DBI for more information.\n\n*   Unable to use the same table twice with different aliases. Workaround: Temporary tables:\n\"CREATE TEMP TABLE tfoo AS SELECT * FROM foo\". Than both tables can be used independently.\n\nPatches to fix bugs/limitations (or a grant to do it) would be very welcome. Please note, that\nany patches must successfully pass all the \"SQL::Statement\", DBD::File and DBD::CSV tests and\nmust be a general improvement.\n",
            "subsections": []
        },
        "AUTHOR AND COPYRIGHT": {
            "content": "Jochen Wiedmann created the original module as an XS (C) extension in 1998. Jeff Zucker took\nover the maintenance in 2001 and rewrote all of the C portions in perl and began extending the\nSQL support. Since 2008, Jens Rehsack is the maintainer.\n\nCopyright (c) 2001,2005 by Jeff Zucker: jzuckerATcpan.org Copyright (c) 2007-2020 by Jens\nRehsack: rehsackATcpan.org\n\nPortions Copyright (C) 1998 by Jochen Wiedmann: jwiedATcpan.org\n\nAll rights reserved.\n",
            "subsections": []
        },
        "LICENSE": {
            "content": "You 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": []
        }
    },
    "summary": "SQL::Statement - SQL parsing and processing engine",
    "flags": [],
    "examples": [],
    "see_also": []
}