Subject Re: [Firebird-Architect] Re: Indexed Views
Author Jim Starkey
Roman Rokytskyy wrote:

>Next problem to solve - return the generated value back to the
>application. Currently Firebird has no means to do this. So, that is
>not so easy.
I built a scheme in blr (blr_store2) to handling this, but it maps very
poorly into SQL. To be completely honest, it maps poorly into
everything else, too.

I took a different approach in Netfrastructure and added an API to
Netfrastructure to handle the problem:

class Connection
QUAD Connection::getSequenceValue (const char *schemaName, const
char *sequenceName);
QUAD Connection::getSequenceValue (const char *sequenceName);


public class NfsConnection implements java.sql.Connection
public long getSequenceValue (String schema, String sequenceName);
public long getSequenceValue (String sequenceName);

(the forms without an explicit schema search the namespace stack).

This has proven a great deal easier use within an application than
trying to recover a sequence value generated by trigger.

It would be straightforward to write a client side piece that emulates
this by generating a tiny requests to execute a blr_gen_id and return
the value. I think this is the better way to go for now. When we do a
wholesale API overhaul, we might expose "getSequenceValue" (or
requivalent) directly.


Jim Starkey
Netfrastructure, Inc.
978 526-1376