Subject Re: Connection with Open Office 2
Author Bernard Devlin
--- In firebird-support@yahoogroups.com, "Robin Davis" <Ro.Davis@b...>
wrote:
The one
> problem left with getting the two programs to work seamlessly is the
auto
> increment. Open Office has two optional fields to retrieve generated
values.
> One for Auto-increment statement, and one for Query of generated values.
> I've tried AUTO etc etc and nothing seems to work.

Can you explain a bit more about what is not working? I am not
familiar with OO (or Access) so I'm not really sure what you are
doing. I have had a look at the OO docs, and they say this:

"Retrieve generated values
Enables OpenOffice.org support of auto-incremented data fields for the
current ODBC or JDBC data source. Select this check box if the
database does not support the auto-increment feature in its SDBCX
layer. In general, the auto-increment is selected for the primary key
field.

Auto-increment statement
Enter the SQL command specifier that instructs the data source to
auto-increment a specified Integer data field. For example, a typical
SQL statement to create a data field is:
CREATE TABLE "table1" ("id" INTEGER)

To auto-increment the "id" data field in a MySQL database, change the
statement to:

CREATE TABLE "table1" ("id" INTEGER AUTO_INCREMENT)
In other words, enter AUTO_INCREMENT into Auto-increment statement box.

Query of generated values
Enter an SQL statement that returns the last auto-incremented value
for the primary key data field. For example:
SELECT LAST_INSERT_D();"

Are you relying on OO to setup your firebird db for you, or does the
DB already exist (created by isql or some other tool)?

Does OO allow you to run SQL statements interactively, or is it just a
question of mapping OO fields to db columns? If it allows you to
enter SQL, can you send us the SQL you are using to retrieve the
auto-incremented value? In terms of firebird usage, the sql statement
you need is something like: SELECT gen_id(my_generator, 1) FROM
RDB$DATABASE

I think there is a lot of variation in how relational databases deal
with auto-incremented fields, so I would be surprised if a generic
tool like OO would not work with the way that Firebird deals with
auto-incremented fields. It could just be that they have written
their documentation only with Oracle and MySql in mind.

Hope that helps. Please let me know if this works or not.

Regards

Bernard