{
    "mode": "perldoc",
    "parameter": "DBI::SQL::Nano",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/DBI%3A%3ASQL%3A%3ANano/json",
    "generated": "2026-06-15T14:30:29Z",
    "synopsis": "BEGIN { $ENV{DBISQLNANO}=1 } # forces use of Nano rather than SQL::Statement\nuse DBI::SQL::Nano;\nuse Data::Dumper;\nmy $stmt = DBI::SQL::Nano::Statement->new(\n\"SELECT bar,baz FROM foo WHERE qux = 1\"\n) or die \"Couldn't parse\";\nprint Dumper $stmt;",
    "sections": {
        "NAME": {
            "content": "DBI::SQL::Nano - a very tiny SQL engine\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "BEGIN { $ENV{DBISQLNANO}=1 } # forces use of Nano rather than SQL::Statement\nuse DBI::SQL::Nano;\nuse Data::Dumper;\nmy $stmt = DBI::SQL::Nano::Statement->new(\n\"SELECT bar,baz FROM foo WHERE qux = 1\"\n) or die \"Couldn't parse\";\nprint Dumper $stmt;\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "\"DBI::SQL::Nano\" is meant as a *very* minimal SQL engine for use in situations where\nSQL::Statement is not available. In most situations you are better off installing SQL::Statement\nalthough DBI::SQL::Nano may be faster for some very simple tasks.\n\nDBI::SQL::Nano, like SQL::Statement is primarily intended to provide a SQL engine for use with\nsome pure perl DBDs including DBD::DBM, DBD::CSV, DBD::AnyData, and DBD::Excel. It is not of\nmuch use in and of itself. You can dump out the structure of a parsed SQL statement, but that is\nabout it.\n",
            "subsections": []
        },
        "USAGE": {
            "content": "",
            "subsections": [
                {
                    "name": "Setting the DBISQLNANO flag",
                    "content": "By default, when a \"DBD\" uses \"DBI::SQL::Nano\", the module will look to see if \"SQL::Statement\"\nis installed. If it is, SQL::Statement objects are used. If SQL::Statement is not available,\nDBI::SQL::Nano objects are used.\n\nIn some cases, you may wish to use DBI::SQL::Nano objects even if SQL::Statement is available.\nTo force usage of DBI::SQL::Nano objects regardless of the availability of SQL::Statement, set\nthe environment variable DBISQLNANO to 1.\n\nYou can set the environment variable in your shell prior to running your script (with SET or\nEXPORT or whatever), or else you can set it in your script by putting this at the top of the\nscript:\n\nBEGIN { $ENV{DBISQLNANO} = 1 }\n"
                },
                {
                    "name": "Supported SQL syntax",
                    "content": "Here's a pseudo-BNF.  Square brackets [] indicate optional items;\nAngle brackets <> indicate items defined elsewhere in the BNF.\n\nstatement ::=\nDROP TABLE [IF EXISTS] <tablename>\n| CREATE TABLE <tablename> <coldeflist>\n| INSERT INTO <tablename> [<insertcollist>] VALUES <vallist>\n| DELETE FROM <tablename> [<whereclause>]\n| UPDATE <tablename> SET <setclause> <whereclause>\n| SELECT <selectcollist> FROM <tablename> [<whereclause>]\n[<orderclause>]\n\nthe optional IF EXISTS clause ::=\n* similar to MySQL - prevents errors when trying to drop\na table that doesn't exist\n\nidentifiers ::=\n* table and column names should be valid SQL identifiers\n* especially avoid using spaces and commas in identifiers\n* note: there is no error checking for invalid names, some\nwill be accepted, others will cause parse failures\n\ntablename ::=\n* only one table (no multiple table operations)\n* see identifier for valid table names\n\ncoldeflist ::=\n* a parens delimited, comma-separated list of column names\n* see identifier for valid column names\n* column types and column constraints may be included but are ignored\ne.g. these are all the same:\n(id,phrase)\n(id INT, phrase VARCHAR(40))\n(id INT PRIMARY KEY, phrase VARCHAR(40) NOT NULL)\n* you are *strongly* advised to put in column types even though\nthey are ignored ... it increases portability\n\ninsertcollist ::=\n* a parens delimited, comma-separated list of column names\n* as in standard SQL, this is optional\n\nselectcollist ::=\n* a comma-separated list of column names\n* or an asterisk denoting all columns\n\nvallist ::=\n* a parens delimited, comma-separated list of values which can be:\n* placeholders (an unquoted question mark)\n* numbers (unquoted numbers)\n* column names (unquoted strings)\n* nulls (unquoted word NULL)\n* strings (delimited with single quote marks);\n* note: leading and trailing percent mark (%) and underscore ()\ncan be used as wildcards in quoted strings for use with\nthe LIKE and CLIKE operators\n* note: escaped single quotation marks within strings are not\nsupported, neither are embedded commas, use placeholders instead\n\nsetclause ::=\n* a comma-separated list of column = value pairs\n* see vallist for acceptable value formats\n\nwhereclause ::=\n* a single \"column/value <op> column/value\" predicate, optionally\npreceded by \"NOT\"\n* note: multiple predicates combined with ORs or ANDs are not supported\n* see vallist for acceptable value formats\n* op may be one of:\n< > >= <= = <> LIKE CLIKE IS\n* CLIKE is a case insensitive LIKE\n\norderclause ::= columnname [ASC|DESC]\n* a single column optional ORDER BY clause is supported\n* as in standard SQL, if neither ASC (ascending) nor\nDESC (descending) is specified, ASC becomes the default\n"
                }
            ]
        },
        "TABLES": {
            "content": "DBI::SQL::Nano::Statement operates on exactly one table. This table will be opened by inherit\nfrom DBI::SQL::Nano::Statement and implements the \"opentable\" method.\n\nsub opentable ($$$$$)\n{\n...\nreturn Your::Table->new( \\%attributes );\n}\n\nDBI::SQL::Nano::Statement expects a rudimentary interface is implemented by the table object,\nas well as SQL::Statement expects.\n\npackage Your::Table;\n\nuse vars qw(@ISA);\n@ISA = qw(DBI::SQL::Nano::Table);\n\nsub drop ($$)        { ... }\nsub fetchrow ($$$)  { ... }\nsub pushrow ($$$)   { ... }\nsub pushnames ($$$) { ... }\nsub truncate ($$)    { ... }\nsub seek ($$$$)      { ... }\n\nThe base class interfaces are provided by DBI::SQL::Nano::Table in case of relying on\nDBI::SQL::Nano or SQL::Eval::Table (see SQL::Eval for details) otherwise.\n",
            "subsections": []
        },
        "BUGS AND LIMITATIONS": {
            "content": "There are no known bugs in DBI::SQL::Nano::Statement. If you find a one and want to report,\nplease see DBI for how to report bugs.\n\nDBI::SQL::Nano::Statement is designed to provide a minimal subset for executing SQL statements.\n\nThe most important limitation might be the restriction on one table per statement. This implies,\nthat no JOINs are supported and there cannot be any foreign key relation between tables.\n\nThe where clause evaluation of DBI::SQL::Nano::Statement is very slow (SQL::Statement uses a\nprecompiled evaluation).\n\nINSERT can handle only one row per statement. To insert multiple rows, use placeholders as\nexplained in DBI.\n\nThe DBI::SQL::Nano parser is very limited and does not support any additional syntax such as\nbrackets, comments, functions, aggregations etc.\n\nIn contrast to SQL::Statement, temporary tables are not supported.\n",
            "subsections": []
        },
        "ACKNOWLEDGEMENTS": {
            "content": "Tim Bunce provided the original idea for this module, helped me out of the tangled trap of\nnamespaces, and provided help and advice all along the way. Although I wrote it from the ground\nup, it is based on Jochen Wiedmann's original design of SQL::Statement, so much of the credit\nfor the API goes to him.\n",
            "subsections": []
        },
        "AUTHOR AND COPYRIGHT": {
            "content": "This module is originally written by Jeff Zucker < jzucker AT cpan.org >\n\nThis module is currently maintained by Jens Rehsack < jrehsack AT cpan.org >\n\nCopyright (C) 2010 by Jens Rehsack, all rights reserved. Copyright (C) 2004 by Jeff Zucker, all\nrights reserved.\n\nYou may freely distribute and/or modify this module under the terms of either the GNU General\nPublic License (GPL) or the Artistic License, as specified in the Perl README file.\n",
            "subsections": []
        }
    },
    "summary": "DBI::SQL::Nano - a very tiny SQL engine",
    "flags": [],
    "examples": [],
    "see_also": []
}