I think it ought to be possible to have an extra choice in the dataprovider window when you open the properties. I would like to have the ability to auto enter the default values as they are defined in the database backend for a certain field.
In Postgres I can do this by sending this SQL statement:
INSERT INTO products (product_no, name, price) VALUES (1, ‘Cheese’, DEFAULT);
The problem I can’t solve right now is this:
- Postgresql backend fields are defined as NOT NULL DEFAULT ‘’ (empty string)
- This setup creates an error within Servoy (even when for these fields autoenter property is marked database managed)
- When I enter a record with not all values entered I get an error (Cannot save form data: field x cannot be null)
Big problem for me right now, so if anybody has a clue (besides working within a transaction and procedurally checking every field)
tia
In Servoy 3.0 there is default value support build in, we read the default value from the database.
OK, but still…
I think being able to proceduraly turn a dataprovider on or off from being included in a query would proof to be usefull
Just an idea…
thx
If you switch a dataprovider to dbmanaged in the column properties Servoy will only read the value and never update or insert any value, is this what you mean?
If you switch a dataprovider to dbmanaged in the column properties Servoy will only read the value and never update or insert any value, is this what you mean?
This possibility is too “strong”. What I’m asking for is something less stringent. As you say when I switch to dbmanaged the value is NEVER updated or inserted.( I suppose because then it is left out op the prepared statement.) What I want is the possibility to influence the prepared statement by setting the property of a dataprovider ON THE FLY to dbmanaged or not (this would have been the solution for me when needing to use DB defined default values). If the dataprovider is empty, set the dataprovider to dbmanaged, but if a value is provided set it to servoy managed