Forum > Database
Insert autoincerement field into Firebird 3 using ZeosLib 8.0
(1/1)
krzynio:
Hi!
After upgrade from Lazarus 2.4 to 3.0 and ZeosLib from 7.14 to 8.0 my application cannot insert a new record.
I have the select TZQuery. Select is from one, simple table only. So, I do not use TZUpdateSQL but I also tried with it and result was the same.
Table has 3 fields: IDDOC, NAZDOC, DATA.
ID is integer, not null and autoicremented by trigger.
When I try to insert the new record, I assign only NAZDOC and DATA fields, next after Post data should be inserted to DB and it was under Zeod 7.14
After upgrade I receive the error: Field IDDOC is required, but not supported.
The only thing I changed in the code was db driver in ZConnection. I changed it from Firebird 3 to Firebird becuse drivers for Firebird and Oracle in in Zeos 8.0 are without version number.
BTW after upgrade I also noticed similar error while updating complex queries containing required fields from joined table i.e.
--- Code: SQL [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---SELECT a.id, a.name, b.name FROM a LEFT JOIN b ON a.id=b.idid and name are requied fields in both tables.
I connected TZUpdateSQL with queries updating only table a but while updating I received the error that b.name is required.
Any reasons, solutions?
krzynio:
It seems I found the solution.
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---TZQuery.Options.doCheckRequired = False does the trick.
I'll leave it here, maybe it will be useful to someone.
fjabouley:
I had the same issue (with Insert (Ids are handled by a trigger by the database itself)) and in Zdataset unit you can also remove"doCheckRequired" in the options, so that when you dynamically create a bunch of TzQueries it should be fine !
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- {** Implements an universal SQL query for read/write data access. } TZQuery = class (TZAbstractRWTxnUpdateObjDataSet) published property Active; property ReadOnly default False; property SQL; property ParamCheck; property ParamChar; property Params; property FetchRow; // added by Patyi property ShowRecordTypes; property Properties; property DataSource; property MasterFields; property MasterSource; property LinkedFields; {renamed by bangfauzan} property IndexFieldNames; {bangfauzan addition} property Upda]"]>Blockedde; property WhereMode; property Sequence; property SequenceField; property TryKeepDataOnDisconnect default False; property Options default [doCalcDefaults, doPreferPrepared]; end;
Navigation
[0] Message Index