I need to test whether various types of database objects exist in a given database, and I don't know how to formulate these tests in Firebird SQL. Each test has the form "Does object of type X with name Y exist?". For example, I need to test whether a table with a given name exists. The object types I need to test are:
One can find how to query for a given table on the Internet, but the other types are more difficult to find ...
Invoking IsqlIf the bin is on your path, you may start it by typing isql regardless of your operating system. Example: $ isql Use CONNECT or CREATE DATABASE to specify a database SQL> CONNECT "C:\DATABASES\FIREBIRD\MY_EMPLOYEE. FDB" CON> user 'SYSDBA' password 'secret';
There are three basic mechanisms to get to a Firebird database. You can either use the raw C API interface, an Open Database Connectivity (ODBC) driver, or an OLE DB driver (the latter is used also for ActiveX Data Objects, ADO, access). Using the raw C API allows developers to write portable code.
Firebird is a relational database offering many ANSI SQL standard features that runs on Linux, Windows, and a variety of Unix platforms. Firebird offers excellent concurrency, high performance, and powerful language support for stored procedures and triggers.
The first example creates a primary key constraint PK_CUST using an index named IX_CUSTNO: create table customers ( custno int not null constraint pk_cust primary key using index ix_custno, ... This, however: create table customers ( custno int not null primary key using index ix_custno, ...
I think a lot of what you are asking can be found at this forum post. If you want to dive a little deeper, this site seems to have a graphical representation of the tables.
It seems like you need to query against the system tables to reliably get that information. Here's a tutorial that looks like it can help:
http://www.alberton.info/firebird_sql_meta_info.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With