Subject Re: [firebird-python] cur.execute("show tables") giving error
Author David Rushby
--- asforza2sell <asforza2sell@...> wrote:
> when I try to do a "show tables" or a "show table X" command from the
> execute method in kinterbasd, I get the following error:
> [...]
> Should this command work for me?

Firebird implements three classes of SQL (I would call them dialects,
but dialects are a separate concept in Firebird):

- Procedural SQL (PSQL) is the class of SQL that stored procedures and
triggers are written in. PSQL itself is only available server-side,
although some previously PSQL-only features have become available in
Dynamic SQL recently (see "EXECUTE BLOCK" in the Firebird 2.0 release
notes).

- Dynamic SQL (DSQL) is the standard client SQL class that's accessible
via the Firebird network protocol. The Firebird client library
implements a C API to this protocol, and kinterbasdb is a Python
interface to that C API, so any SQL you execute directly through
kinterbasdb is DSQL.
If you want, you can execute PSQL indirectly from kinterbasdb by
programmatically defining PSQL entities such as stored procedures (with
CREATE PROCEDURE, etc.), then executing the PSQL entities via DSQL
statements. Firebird 2.0's EXECUTE BLOCK implements a sort of "dynamic
PSQL".

- Embedded SQL (ESQL) is implemented by a precompiler that's designed
to make writing database client applications in static,
non-garbage-collected languages (C, Ada, etc.) less torturous. ESQL
has serious limitations, and is not widely used in new applications or
modern programming languages.


There's also a command-line utility called 'isql', which can be found
in the 'bin' directory of your Firebird installation. isql is a
utility, not a separate class of SQL in the same way DSQL, ESQL, and
PSQL are, but it does implement some "commands" that make command-line
manipulation of the database easier. The commands, which include "show
tables" and "show table X", are not an official part of DSQL; they're
isql extensions. That's why kinterbasdb doesn't recognize them.

There's a general Firebird documentation page here:

http://www.ibphoenix.com/main.nfs?a=ibphoenix&page=ibp_download_documentation

The isql command line utility is documented in the Interbase 6
Operations Guide (see page 235 for the "SHOW TABLES" documentation):
http://www.ibphoenix.com/downloads/60OpGuide.zip

A DSQL reference for Interbase 6.0 (the predecessor of Firebird 1.0) is
here:

http://www.ibphoenix.com/main.nfs?a=ibphoenix&s=1139964824:311773&page=ibp_60_sqlref

The Interbase 6 DSQL reference covers all of the basics, and you can
combine it with the release notes for Firebird 1.0, 1.5, and 2.0, to
get a complete picture of Firebird's current DSQL.

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com