Subject Re: [IBO] Firebird 2: "default" parameters in stored procedures
Author Martijn Tonies
Hello Jason,

I got these answers --

First:
> So, could anyone enlighten me on how this should work in the API?

What do you do if you need to use default value in the
INSERT statement ? You have 2 choices - omit field from list
of fields or read default value from system tables and pass
it into INSERT statement. Procedures follows the same rules.

As a feature request we already discussed addition of
DEFAULT keyword into INSERT\UPDATE statements and appropriate
changes in XSQLVAR structure. Hope we'll implement it in the
one of the next version of Firebird.

Regards,
Vlad

---
Second (after my reply to this):

Martijn Tonies" <m.tonies@...> wrote:
>
> Is this the same? So you're telling me that with Firebird 2.0, you don't
> HAVE to supply structures for all parameters?

You have to specify structures for all parameters that exist in your SQL
statement. Whether all of them or only a few match the number of columns or
procedure parameters is not your business, the engine will take care about
that. This is true for both INSERT and EXECUTE PROCEDURE.

> Many (Delphi) component-sets will read the number of parameters
> and their datatypes from the system tables, so that the developer
> GUI creates parameters entries for a stored procedure. How do you
> expect this to work?

They will continue to work, but they won't use this feature. If they want
to, they need to fetch info about defaults, implement some "useDefault"
boolean flag for parameters and don't create XSQLVARs for the values having
this flag set.

Damn, how do those component sets dynamically create an INSERT statement
when I add a row in the grid and fill only a single column with a value?
There's no difference with procedure parameters here.

> Wouldn't a slight API modification be a great
> help to these kind of developer environments?

There's no need in API modification.


Dmitry
---

Does this help you any?

Martijn Tonies
Database Workbench - tool for InterBase, Firebird, MySQL, Oracle & MS SQL
Server
Upscene Productions
http://www.upscene.com
Database development questions? Check the forum!
http://www.databasedevelopmentforum.com





> > I do not want to supply any values myself, I want IBO not to pass
> > any values to the server, so that the server can use the default
> > values it has in its procedure definition.
>
> This would be possible with the existing data structures of the API but I
> would need to know how it was accommodated. To my knowledge they would
have
> to have added a new status to the SQLVAR.SQLInd structure that recognized
an
> UNBOUND state as well as an IS NULL or IS NOT NULL state. Being that they
> are working with a 2-byte field to indicate the SQLInd status they
certainly
> could use a value to indicate UNBOUND.