Hi, > You mean DEFAULT as in > > INSERT INTO foo VALUES (1, DEFAULT, "bar"); > > where the _SQL_keyword_ DEFAULT triggers the use of whatever value was > declared as the DEFAULT value in the table definition? Yes, this is what I mean. But I want to set the default value as a parameter for a prepared statement like binding undef for NULL values.
> > > If DBI does not support default values as parameter are > there any other > > driver that support this. If yes, how is it solved? > > Well here's one way that might work: > > INSERT INTO foo VALUES (?, IFNULL(?,DEFAULT), "bar"); > > (substitute something else for IFNULL isn't that's not quite right) > but I'm not sure if that's valid and/or viable. In this case you can no longer insert the NULL value, it will always be substituted by the DEFAULT value. > How does the MaxDB API expose the functionality? The DBD::MaxDB uses the SQLDBC interface (c++ client interface for MaxDB). When you bind a parameter for a prepared statement with SQLDBC you can set an indicator value. This indicator value normally defines the length of the bounded buffer. But there are some special indicator values SQLDBC_NULL_DATA and SQLDBC_DEFAULT_PARAM that signals that the NULL VALUE/DEFAULT VALUE should be set for the parameter. As far as I know ODBC does it in the same way. A DBD::MaxDB specific solution would be to define a global constant variable DBD::MaxDB::default_parameter which can be used to bind as parameter. But this would be MaxDB specific and not common for all DBD driver. It would be better if we could find a DBD driver independend solution in the DBI interface. What do you think? Regards, Marco ---------------------- Marco Paskamp MaxDB, SAP Labs Berlin
