We’ve got multiple developers working on a large soultion which has all DB-Managed sequences and are merging each developer’s exports in one file on a daily basis.
On import of the merged solution file, we occasionally see messages like these relating to one or more tables:
“The import version of the column ‘id_states’ of table ‘states’ in server ‘sprocket’ has ‘db identity’ sequence type but the table already exists so it cannot be created, using ‘servoy seq’ sequence type instead.”
On occasion, this has affected 20 or 30 tables and so we’ve needed to manually go into data providers and set all PK’s to be DB-managed.
My question is if the import file specifies db-managed sequences for a column, why can’t Servoy set the local repository to DB-managed during the import rather than default to Servoy-managed (which then requires us to manually go into data-providers)?
Assuming you are referring to data for your imports (rather than code) and that you are using SQL Anywhere included with Servoy, you could use stored procedures with the combination of LOAD TABLE or INPUT (from Interactive SQL) and merge the developer’s data.
Consider the following:
You have a base table foo that you want merge with developer file name bar.
//Assume that tmp_foo looks exactly like foo and the table foo has a primary key.
CREATE procedure merger( in @filename char(128))
begin
DECLARE LOCAL TEMPORARY TABLE tmp_foo
(id int not null default autoincrement,
col2 char(40),
col3 char(40),
col4 datetime) ON COMMIT PRESERVE ROWS;
EXECUTE IMMEDIATE ‘LOAD TABLE tmp_foo from ‘’’||@filename||‘’‘’;
INSERT INTO foo (id,col2,col3,col4) ON EXISTING UPDATE SELECT id,col2,col3,col4 FROM tmp_foo;
//Optional information message
MESSAGE 'Rows Affected: ’ || @@rowcount;
COMMIT;
DELETE FROM tmp_foo;
END;
–Invoke the procedure
CALL merger(‘c:\bar’);
JDW:
“The import version of the column ‘id_states’ of table ‘states’ in server ‘sprocket’ has ‘db identity’ sequence type but the table already exists so it cannot be created, using ‘servoy seq’ sequence type instead.”
I have seen many similar messages with my PostgreSQL databases created outside Servoy. I think I have found the problem (in my case): Stupid me forgot to specify which field was the PRIMARY KEY when defining the tables. On loading the tables into Servoy the first time I would specify DB managed and enter the name of the sequence. Everything would work fine until I loaded the modules onto another server…