WIP: introduce separate database schemas #102
@ -8,10 +8,10 @@
|
|||||||
Returns a textual representation of an integer number to be used as generated test data.
|
Returns a textual representation of an integer number to be used as generated test data.
|
||||||
|
|
||||||
Examples :
|
Examples :
|
||||||
intToVarChar(0, 3) => 'aaa'
|
basis.intToVarChar(0, 3) => 'aaa'
|
||||||
intToVarChar(1, 3) => 'aab'
|
basis.intToVarChar(1, 3) => 'aab'
|
||||||
*/
|
*/
|
||||||
create or replace function intToVarChar(i integer, len integer)
|
create or replace function basis.intToVarChar(i integer, len integer)
|
||||||
returns varchar
|
returns varchar
|
||||||
language plpgsql as $$
|
language plpgsql as $$
|
||||||
declare
|
declare
|
||||||
@ -19,7 +19,7 @@ declare
|
|||||||
begin
|
begin
|
||||||
select chr(ascii('a') + i % 26) into partial;
|
select chr(ascii('a') + i % 26) into partial;
|
||||||
if len > 1 then
|
if len > 1 then
|
||||||
return intToVarChar(i / 26, len - 1) || partial;
|
return basis.intToVarChar(i / 26, len - 1) || partial;
|
||||||
else
|
else
|
||||||
return partial;
|
return partial;
|
||||||
end if;
|
end if;
|
||||||
|
@ -59,7 +59,7 @@ create or replace procedure createTestCustomerTestData(
|
|||||||
begin
|
begin
|
||||||
for t in startCount..endCount
|
for t in startCount..endCount
|
||||||
loop
|
loop
|
||||||
call createTestCustomerTestData(testCustomerReference(t), intToVarChar(t, 3));
|
call createTestCustomerTestData(testCustomerReference(t), basis.intToVarChar(t, 3));
|
||||||
commit;
|
commit;
|
||||||
end loop;
|
end loop;
|
||||||
end; $$;
|
end; $$;
|
||||||
|
@ -25,7 +25,7 @@ begin
|
|||||||
|
|
||||||
insert
|
insert
|
||||||
into test_domain (name, packageUuid)
|
into test_domain (name, packageUuid)
|
||||||
values (pac.name || '-' || intToVarChar(t, 4), pac.uuid);
|
values (pac.name || '-' || basis.intToVarChar(t, 4), pac.uuid);
|
||||||
end loop;
|
end loop;
|
||||||
end; $$;
|
end; $$;
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ create or replace procedure createHsOfficeContactTestData(
|
|||||||
begin
|
begin
|
||||||
for t in startCount..endCount
|
for t in startCount..endCount
|
||||||
loop
|
loop
|
||||||
call createHsOfficeContactTestData(intToVarChar(t, 4) || '#' || t);
|
call createHsOfficeContactTestData(basis.intToVarChar(t, 4) || '#' || t);
|
||||||
commit;
|
commit;
|
||||||
end loop;
|
end loop;
|
||||||
end; $$;
|
end; $$;
|
||||||
|
@ -43,7 +43,7 @@ create or replace procedure createTestPersonTestData(
|
|||||||
begin
|
begin
|
||||||
for t in startCount..endCount
|
for t in startCount..endCount
|
||||||
loop
|
loop
|
||||||
call createHsOfficePersonTestData('LP', intToVarChar(t, 4));
|
call createHsOfficePersonTestData('LP', basis.intToVarChar(t, 4));
|
||||||
commit;
|
commit;
|
||||||
end loop;
|
end loop;
|
||||||
end; $$;
|
end; $$;
|
||||||
|
@ -69,8 +69,8 @@ declare
|
|||||||
begin
|
begin
|
||||||
for t in startCount..endCount
|
for t in startCount..endCount
|
||||||
loop
|
loop
|
||||||
select p.* from hs_office_person p where tradeName = intToVarChar(t, 4) into person;
|
select p.* from hs_office_person p where tradeName = basis.intToVarChar(t, 4) into person;
|
||||||
select c.* from hs_office_contact c where c.caption = intToVarChar(t, 4) || '#' || t into contact;
|
select c.* from hs_office_contact c where c.caption = basis.intToVarChar(t, 4) || '#' || t into contact;
|
||||||
|
|
||||||
call createHsOfficeRelationTestData(person.uuid, contact.uuid, 'REPRESENTATIVE');
|
call createHsOfficeRelationTestData(person.uuid, contact.uuid, 'REPRESENTATIVE');
|
||||||
commit;
|
commit;
|
||||||
|
Loading…
Reference in New Issue
Block a user