mirror of
https://github.com/Wisser/Jailer.git
synced 2026-05-15 12:08:24 -05:00
Compare commits
222 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 58eba308dd | |||
| 395d971b99 | |||
| c31f453525 | |||
| d36fc2aa45 | |||
| 754fdd631a | |||
| 73addfd60e | |||
| de2522771e | |||
| 2f11bbd2e1 | |||
| e0499dcbd7 | |||
| de30765cb1 | |||
| b77951e76a | |||
| 400bf6cebd | |||
| 2a8ae2c19d | |||
| c894f26625 | |||
| 1936cb35ff | |||
| 2978a95a17 | |||
| 1b97cc4ca2 | |||
| f51b1d1fd7 | |||
| 14c062008d | |||
| 58b5e7c93b | |||
| e3df9fa40c | |||
| 3c57c0ab28 | |||
| fa68baafe2 | |||
| 00b7bbedc8 | |||
| c087460e09 | |||
| a494583bc0 | |||
| 5cb61dbd04 | |||
| 0800c08d44 | |||
| 2d470c3444 | |||
| e2ae728053 | |||
| b83ece2f84 | |||
| 747733d866 | |||
| 85438ab011 | |||
| 953e8f3219 | |||
| b94096ea29 | |||
| f60799026a | |||
| 71fe6d89c4 | |||
| ff42096d12 | |||
| 718eeb2263 | |||
| 79ab21bd1c | |||
| aa53d09dab | |||
| 9516e89af9 | |||
| 323e2a1cef | |||
| cd086058f0 | |||
| 5c5d26eee3 | |||
| 72b7652612 | |||
| 388ea97bac | |||
| 1811f8cfcd | |||
| 3e4939b797 | |||
| d25e6d4b1c | |||
| 349785c4cb | |||
| 0f7fc6c78b | |||
| 851c7d0fa6 | |||
| a13f2214a5 | |||
| 6eaca4f955 | |||
| 0868742a8d | |||
| fb11d3b1e2 | |||
| 68d8b9c781 | |||
| 30e07c5796 | |||
| 268b4ac833 | |||
| 2e3770407c | |||
| 098e1d368c | |||
| 2104c9d489 | |||
| 63b411a77d | |||
| 605ae30c98 | |||
| 828df86e49 | |||
| ad2139ed97 | |||
| 7b05807b99 | |||
| 7ac4b3c462 | |||
| dab9b84719 | |||
| c06dcad238 | |||
| 44097e1260 | |||
| 246bf33450 | |||
| 81cb2c936d | |||
| 4c4fef89dc | |||
| bf9ab7494b | |||
| 639f48e6e2 | |||
| 0830e7c680 | |||
| 336838ac07 | |||
| 5d357482fc | |||
| c73f214c2a | |||
| 4465f1d604 | |||
| a35d7477ec | |||
| 025ea22c63 | |||
| bc77da4443 | |||
| bf9029a86d | |||
| eb99956031 | |||
| 1de01a9fc0 | |||
| 8364db8c7c | |||
| 978e70f66e | |||
| 171b507d0c | |||
| 0a5db71680 | |||
| b8d97e4596 | |||
| 6f0096d5ab | |||
| 62f5d5dbc1 | |||
| b8eacf3596 | |||
| f84117354f | |||
| d5177e0674 | |||
| f1179c6dbf | |||
| 9d60ea56c5 | |||
| 01641ab452 | |||
| a38d791d6a | |||
| 69f5353209 | |||
| ad1b1bbc0f | |||
| 5d015121b1 | |||
| 8aaf79ccfb | |||
| cecf21fd9f | |||
| ce8e221c16 | |||
| 1b3d8d8ec4 | |||
| bba3ce5775 | |||
| df6dccdc83 | |||
| 1a37c3f3ed | |||
| ef94d823a6 | |||
| 1689825933 | |||
| 918c4b0e4f | |||
| 361956428a | |||
| 9badf1aab4 | |||
| 6c4199a297 | |||
| de906c50ab | |||
| a376678736 | |||
| b4be86aaf6 | |||
| d99b8032c8 | |||
| f4d2a32482 | |||
| b03cecf727 | |||
| ae162cee64 | |||
| 4d6437f144 | |||
| 58c48e26ab | |||
| 722ebbd6ae | |||
| 16d2a00cab | |||
| 2dab65a6a8 | |||
| 15c0fd3214 | |||
| 46dcbc0516 | |||
| 1de182ed90 | |||
| 892c0d2c3c | |||
| 736c1bb8f9 | |||
| 7b530a5a66 | |||
| 164dfea1c7 | |||
| 5fa06f446f | |||
| 594cd0393d | |||
| 9b2d7e9a7b | |||
| 7152107712 | |||
| 02690f41be | |||
| 33e6944a73 | |||
| 122f71f02d | |||
| 7257700b44 | |||
| 9f45305ca7 | |||
| 8bd5a133a5 | |||
| bf6050d50e | |||
| a8a173024d | |||
| 169fcc8df9 | |||
| 40708ae74e | |||
| 0627a68e73 | |||
| ad668107b0 | |||
| a82239ec38 | |||
| d862dbe790 | |||
| d45b61e131 | |||
| f65962cc5a | |||
| d608eb4d58 | |||
| 649fd0a75c | |||
| 7c858b3a5e | |||
| 1753898629 | |||
| c4683bb77f | |||
| cd5aa81c13 | |||
| 6831c0eb92 | |||
| d371492e6c | |||
| 50bc5de77b | |||
| 11c9be978a | |||
| a4e543c8e7 | |||
| 18e9afb2e4 | |||
| 934228a82d | |||
| c62b9540f1 | |||
| 6faa3423b4 | |||
| 189dd83fb8 | |||
| e7e5073b6d | |||
| 89600dc88c | |||
| e21a53bc16 | |||
| a330414c1a | |||
| edd6bbe2a1 | |||
| e19ed43a90 | |||
| 014f434734 | |||
| 9d5e4a74cb | |||
| 1296e0d6e1 | |||
| a586421d25 | |||
| 1eba21a1ed | |||
| f1403b7dcf | |||
| 2b5b38b2a9 | |||
| cd73432a66 | |||
| 5ca97fb800 | |||
| 548bb7d5df | |||
| 3ff03cdd91 | |||
| 01f38a055c | |||
| 41bedb3027 | |||
| 9c9a90b969 | |||
| fcb4acd3d5 | |||
| e1ad0d356a | |||
| 1efe4d1b8d | |||
| 616530507f | |||
| 66469eb0b8 | |||
| 56fdff7bf4 | |||
| 804d85892a | |||
| a1e471c251 | |||
| 9c091de37a | |||
| 9f72bf5124 | |||
| 11162a5fcb | |||
| b37845724c | |||
| a13cf014f9 | |||
| 87839c45ab | |||
| 625aa8c8dd | |||
| e104053988 | |||
| ab293108f9 | |||
| 14a6f8005a | |||
| 7effdb5088 | |||
| 0d62e75b94 | |||
| d9888cc188 | |||
| bae615523f | |||
| 6b0d541a67 | |||
| 4129a63fec | |||
| 0eb34d6040 | |||
| 686064d1be | |||
| 6c4bc539b1 | |||
| 379b8c7a10 | |||
| 4e5af9889d |
@@ -59,3 +59,9 @@ rm $1.zip
|
||||
zip -r jailer_$1.zip jailer
|
||||
cp -r jailer dbeauty
|
||||
zip -r dbeauty_$1.zip dbeauty
|
||||
|
||||
# Web upload
|
||||
# cd docs
|
||||
# scp -r * rwisser,jailer@web.sf.net:/home/groups/j/ja/jailer/htdocs/
|
||||
# scp -r * rwisser,jailer@web.sf.net:/home/groups/j/ja/jailer/htdocs/doc/
|
||||
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
rm -rf ~/tmp/jailer
|
||||
rm -rf ~/tmp/1
|
||||
rm -rf ~/tmp/1.co
|
||||
mkdir ~/tmp/jailer
|
||||
mkdir ~/tmp/1
|
||||
mkdir ~/tmp/1.co
|
||||
cd ~/tmp/1.co
|
||||
svn checkout --username=rwisser https://svn.code.sf.net/p/jailer/code/trunk/docs jailer-code
|
||||
cd ..
|
||||
mv 1.co/jailer-code/* jailer
|
||||
cd jailer
|
||||
|
||||
cp home.htm index.html
|
||||
find -iname ".svn" -exec rm -rf '{}' \;
|
||||
find -iname ".cvs*" -exec rm -rf '{}' \;
|
||||
|
||||
scp -r * rwisser,jailer@web.sf.net:/home/groups/j/ja/jailer/htdocs/
|
||||
scp -r * rwisser,jailer@web.sf.net:/home/groups/j/ja/jailer/htdocs/doc/
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
# Table A; Table B; First-insert; Cardinality; Join-condition; Name; Author
|
||||
# Table A; Table B; First-insert; Cardinality (opt); Join-condition; Name; Author
|
||||
ADDRESS; CITY; B; n:1; A.CITY_ID=B.CITY_ID; FK_ADDRESS_CITY; H2 JDBC Driver; ;
|
||||
CITY; COUNTRY; B; n:1; A.COUNTRY_ID=B.COUNTRY_ID; FK_CITY_COUNTRY; H2 JDBC Driver; ;
|
||||
CUSTOMER; ADDRESS; B; n:1; A.ADDRESS_ID=B.ADDRESS_ID; FK_CUSTOMER_ADDRESS; H2 JDBC Driver; ;
|
||||
CUSTOMER; STORE; B; n:1; A.STORE_ID=B.STORE_ID; FK_CUSTOMER_STORE; H2 JDBC Driver; ;
|
||||
FILM; "LANGUAGE"; B; n:1; A.LANGUAGE_ID=B.LANGUAGE_ID; FK_FILM_LANGUAGE; H2 JDBC Driver; ;
|
||||
FILM; "LANGUAGE"; B; n:1; A.ORIGINAL_LANGUAGE_ID=B.LANGUAGE_ID; FK_FILM_LANGUAGE_ORIGINAL; H2 JDBC Driver; ;
|
||||
FILM_ACTOR; ACTOR; B; n:1; A.ACTOR_ID=B.ACTOR_ID; FK_FILM_ACTOR_ACTOR; H2 JDBC Driver; ;
|
||||
FILM_ACTOR; FILM; B; n:1; A.FILM_ID=B.FILM_ID; FK_FILM_ACTOR_FILM; H2 JDBC Driver; ;
|
||||
FILM_CATEGORY; CATEGORY; B; n:1; A.CATEGORY_ID=B.CATEGORY_ID; FK_FILM_CATEGORY_CATEGORY; H2 JDBC Driver; ;
|
||||
FILM_CATEGORY; FILM; B; n:1; A.FILM_ID=B.FILM_ID; FK_FILM_CATEGORY_FILM; H2 JDBC Driver; ;
|
||||
FILM; LANGUAGE; B; n:1; A.LANGUAGE_ID=B.LANGUAGE_ID; FK_FILM_LANGUAGE; H2 JDBC Driver; ;
|
||||
FILM; LANGUAGE; B; n:1; A.ORIGINAL_LANGUAGE_ID=B.LANGUAGE_ID; FK_FILM_LANGUAGE_ORIGINAL; H2 JDBC Driver; ;
|
||||
INVENTORY; FILM; B; n:1; A.FILM_ID=B.FILM_ID; FK_INVENTORY_FILM; H2 JDBC Driver; ;
|
||||
INVENTORY; STORE; B; n:1; A.STORE_ID=B.STORE_ID; FK_INVENTORY_STORE; H2 JDBC Driver; ;
|
||||
PAYMENT; CUSTOMER; B; n:1; A.CUSTOMER_ID=B.CUSTOMER_ID; FK_PAYMENT_CUSTOMER; H2 JDBC Driver; ;
|
||||
|
||||
|
@@ -1,17 +1,17 @@
|
||||
# Table; Columns
|
||||
"LANGUAGE"; LANGUAGE_ID SMALLINT; NAME CHAR(20); LAST_UPDATE TIMESTAMP; ;
|
||||
ACTOR; ACTOR_ID DECIMAL(65535, 32767); FIRST_NAME VARCHAR(45); LAST_NAME VARCHAR(45); LAST_UPDATE TIMESTAMP; ;
|
||||
ADDRESS; ADDRESS_ID INTEGER; ADDRESS VARCHAR(50); ADDRESS2 VARCHAR(50); DISTRICT VARCHAR(20); CITY_ID INTEGER; POSTAL_CODE VARCHAR(10); PHONE VARCHAR(20); LAST_UPDATE TIMESTAMP; ;
|
||||
ADDRESS; ADDRESS_ID INTEGER; ADDRESS VARCHAR(50); ADDRESS2 VARCHAR(50) null; DISTRICT VARCHAR(20); CITY_ID INTEGER; POSTAL_CODE VARCHAR(10) null; PHONE VARCHAR(20); LAST_UPDATE TIMESTAMP; ;
|
||||
CATEGORY; CATEGORY_ID SMALLINT; NAME VARCHAR(25); LAST_UPDATE TIMESTAMP; ;
|
||||
CITY; CITY_ID INTEGER; CITY VARCHAR(50); COUNTRY_ID SMALLINT; LAST_UPDATE TIMESTAMP; ;
|
||||
COUNTRY; COUNTRY_ID SMALLINT; COUNTRY VARCHAR(50); LAST_UPDATE TIMESTAMP; ;
|
||||
CUSTOMER; CUSTOMER_ID INTEGER; STORE_ID INTEGER; FIRST_NAME VARCHAR(45); LAST_NAME VARCHAR(45); EMAIL VARCHAR(50); ADDRESS_ID INTEGER; ACTIVE CHAR(1); CREATE_DATE TIMESTAMP; LAST_UPDATE TIMESTAMP; ;
|
||||
FILM; FILM_ID INTEGER; TITLE VARCHAR(255); DESCRIPTION VARCHAR(255); RELEASE_YEAR VARCHAR(4); LANGUAGE_ID SMALLINT; ORIGINAL_LANGUAGE_ID SMALLINT; RENTAL_DURATION SMALLINT; RENTAL_RATE DECIMAL(4, 2); LENGTH SMALLINT; REPLACEMENT_COST DECIMAL(5, 2); RATING VARCHAR(10); SPECIAL_FEATURES VARCHAR(100); LAST_UPDATE TIMESTAMP; ;
|
||||
COUNTRY; COUNTRY_ID SMALLINT; COUNTRY VARCHAR(50); LAST_UPDATE TIMESTAMP null; ;
|
||||
CUSTOMER; CUSTOMER_ID INTEGER; STORE_ID INTEGER; FIRST_NAME VARCHAR(45); LAST_NAME VARCHAR(45); EMAIL VARCHAR(50) null; ADDRESS_ID INTEGER; ACTIVE VARCHAR(1); CREATE_DATE TIMESTAMP; LAST_UPDATE TIMESTAMP; ;
|
||||
FILM; FILM_ID INTEGER; TITLE VARCHAR(255); DESCRIPTION VARCHAR(255) null; RELEASE_YEAR VARCHAR(4) null; LANGUAGE_ID SMALLINT; ORIGINAL_LANGUAGE_ID SMALLINT null; RENTAL_DURATION SMALLINT; RENTAL_RATE DECIMAL(4, 2); LENGTH SMALLINT null; REPLACEMENT_COST DECIMAL(5, 2); RATING VARCHAR(10) null; SPECIAL_FEATURES VARCHAR(100) null; LAST_UPDATE TIMESTAMP; ;
|
||||
FILM_ACTOR; ACTOR_ID INTEGER; FILM_ID INTEGER; LAST_UPDATE TIMESTAMP; ;
|
||||
FILM_CATEGORY; FILM_ID INTEGER; CATEGORY_ID SMALLINT; LAST_UPDATE TIMESTAMP; ;
|
||||
FILM_TEXT; FILM_ID SMALLINT; TITLE VARCHAR(255); DESCRIPTION VARCHAR(255); ;
|
||||
FILM_TEXT; FILM_ID SMALLINT; TITLE VARCHAR(255); DESCRIPTION VARCHAR(255) null; ;
|
||||
INVENTORY; INVENTORY_ID INTEGER; FILM_ID INTEGER; STORE_ID INTEGER; LAST_UPDATE TIMESTAMP; ;
|
||||
PAYMENT; PAYMENT_ID INTEGER; CUSTOMER_ID INTEGER; STAFF_ID SMALLINT; RENTAL_ID INTEGER; AMOUNT DECIMAL(5, 2); PAYMENT_DATE TIMESTAMP; LAST_UPDATE TIMESTAMP; ;
|
||||
RENTAL; RENTAL_ID INTEGER; RENTAL_DATE TIMESTAMP; INVENTORY_ID INTEGER; CUSTOMER_ID INTEGER; RETURN_DATE TIMESTAMP; STAFF_ID SMALLINT; LAST_UPDATE TIMESTAMP; ;
|
||||
STAFF; STAFF_ID SMALLINT; FIRST_NAME VARCHAR(45); LAST_NAME VARCHAR(45); ADDRESS_ID INTEGER; PICTURE BLOB; EMAIL VARCHAR(50); STORE_ID INTEGER; ACTIVE SMALLINT; USERNAME VARCHAR(16); PASSWORD VARCHAR(40); LAST_UPDATE TIMESTAMP; ;
|
||||
LANGUAGE; LANGUAGE_ID SMALLINT; NAME VARCHAR(20); LAST_UPDATE TIMESTAMP; ;
|
||||
PAYMENT; PAYMENT_ID INTEGER; CUSTOMER_ID INTEGER; STAFF_ID SMALLINT; RENTAL_ID INTEGER null; AMOUNT DECIMAL(5, 2); PAYMENT_DATE TIMESTAMP; LAST_UPDATE TIMESTAMP; ;
|
||||
RENTAL; RENTAL_ID INTEGER; RENTAL_DATE TIMESTAMP; INVENTORY_ID INTEGER; CUSTOMER_ID INTEGER; RETURN_DATE TIMESTAMP null; STAFF_ID SMALLINT; LAST_UPDATE TIMESTAMP; ;
|
||||
STAFF; STAFF_ID SMALLINT; FIRST_NAME VARCHAR(45); LAST_NAME VARCHAR(45); ADDRESS_ID INTEGER; PICTURE BLOB null; EMAIL VARCHAR(50) null; STORE_ID INTEGER; ACTIVE SMALLINT; USERNAME VARCHAR(16); PASSWORD VARCHAR(40) null; LAST_UPDATE TIMESTAMP; ;
|
||||
STORE; STORE_ID INTEGER; MANAGER_STAFF_ID SMALLINT; ADDRESS_ID INTEGER; LAST_UPDATE TIMESTAMP; ;
|
||||
|
||||
|
@@ -1,2 +1,2 @@
|
||||
# name; last modification
|
||||
Demo-Sakila;
|
||||
Demo Sakila (16 Tables);
|
||||
|
||||
|
@@ -1,5 +1,4 @@
|
||||
# Name; Upsert; Primary key; ; Author
|
||||
"LANGUAGE"; N; LANGUAGE_ID SMALLINT; ; H2 JDBC Driver; ;
|
||||
# Name; Upsert; Primary Key; ; Author
|
||||
ACTOR; N; ACTOR_ID DECIMAL(65535, 32767); ; H2 JDBC Driver; ;
|
||||
ADDRESS; N; ADDRESS_ID INTEGER; ; H2 JDBC Driver; ;
|
||||
CATEGORY; N; CATEGORY_ID SMALLINT; ; H2 JDBC Driver; ;
|
||||
@@ -11,6 +10,7 @@ FILM_ACTOR; N; ACTOR_ID INTEGER; FILM_ID INTEGER; ; H2 JDBC Driver; ;
|
||||
FILM_CATEGORY; N; FILM_ID INTEGER; CATEGORY_ID SMALLINT; ; H2 JDBC Driver; ;
|
||||
FILM_TEXT; N; FILM_ID SMALLINT; ; H2 JDBC Driver; ;
|
||||
INVENTORY; N; INVENTORY_ID INTEGER; ; H2 JDBC Driver; ;
|
||||
LANGUAGE; N; LANGUAGE_ID SMALLINT; ; H2 JDBC Driver; ;
|
||||
PAYMENT; N; PAYMENT_ID INTEGER; ; H2 JDBC Driver; ;
|
||||
RENTAL; N; RENTAL_ID INTEGER; ; H2 JDBC Driver; ;
|
||||
STAFF; N; STAFF_ID SMALLINT; ; H2 JDBC Driver; ;
|
||||
|
||||
|
@@ -1 +1 @@
|
||||
7.2.2
|
||||
8.7.5
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
# Table A; Table B; First-insert; Cardinality; Join-condition; Name; Author
|
||||
# Table A; Table B; First-insert; Cardinality (opt); Join-condition; Name; Author
|
||||
EMPLOYEE; BONUS; ; 1:1; A.NAME=B.ENAME and A.JOB=B.JOB; BONUS; Demo; ;
|
||||
EMPLOYEE; DEPARTMENT; B; n:1; A.DEPTNO=B.DEPTNO; DEPARTMENT; Demo; ;
|
||||
EMPLOYEE; EMPLOYEE; B; n:1; A.BOSS=B.EMPNO; BOSS; Demo; ;
|
||||
EMPLOYEE; SALARYGRADE; ; n:1; A.SALARY BETWEEN B.LOSAL and B.HISAL; SALARY; Demo; ;
|
||||
EMPLOYEE; DEPARTMENT; B; n:1; A.DEPTNO=B.DEPTNO; DEPARTMENT; Demo; ;
|
||||
PROJECT_PARTICIPATION; EMPLOYEE; B; n:1; A.EMPNO=B.EMPNO; EMPLOYEE; Demo; ;
|
||||
PROJECT_PARTICIPATION; PROJECT; B; n:1; A.PROJECTNO=B.PROJECTNO; PROJECT; Demo; ;
|
||||
PROJECT_PARTICIPATION; ROLE; B; n:1; A.ROLE_ID=B.ROLE_ID; ROLE; Demo; ;
|
||||
EMPLOYEE; SALARYGRADE; ; n:1; A.SALARY BETWEEN B.LOSAL and B.HISAL; SALARY; Demo; ;
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
# Table; Columns
|
||||
BONUS; ENAME VARCHAR(10); JOB VARCHAR(9); SAL DECIMAL(7, 2); COMM DECIMAL(7, 2); ;
|
||||
DEPARTMENT; DEPTNO INTEGER; NAME VARCHAR(14); LOCATION VARCHAR(13); ;
|
||||
EMPLOYEE; EMPNO INTEGER; NAME VARCHAR(10); JOB VARCHAR(9); BOSS INTEGER; HIREDATE VARCHAR(12); SALARY DECIMAL(7, 2); COMM DECIMAL(7, 2); DEPTNO INTEGER; ;
|
||||
PROJECT; PROJECTNO INTEGER; DESCRIPTION VARCHAR(100); START_DATE VARCHAR(12); END_DATE VARCHAR(12); ;
|
||||
PROJECT_PARTICIPATION; PROJECTNO INTEGER; EMPNO INTEGER; START_DATE VARCHAR(12); END_DATE VARCHAR(12); ROLE_ID INTEGER; ;
|
||||
ROLE; ROLE_ID INTEGER; DESCRIPTION VARCHAR(100); ;
|
||||
BONUS; ENAME VARCHAR(10); JOB VARCHAR(9); SAL DECIMAL(7, 2) null; COMM DECIMAL(7, 2) null; ;
|
||||
DEPARTMENT; DEPTNO INTEGER; NAME VARCHAR(14) null; LOCATION VARCHAR(13) null; ;
|
||||
EMPLOYEE; EMPNO INTEGER; NAME VARCHAR(10) null; JOB VARCHAR(9) null; BOSS INTEGER null; HIREDATE VARCHAR(12) null; SALARY DECIMAL(7, 2) null; COMM DECIMAL(7, 2) null; DEPTNO INTEGER null; ;
|
||||
PROJECT; PROJECTNO INTEGER; DESCRIPTION VARCHAR(100) null; START_DATE VARCHAR(12) null; END_DATE VARCHAR(12) null; ;
|
||||
PROJECT_PARTICIPATION; PROJECTNO INTEGER; EMPNO INTEGER; START_DATE VARCHAR(12); END_DATE VARCHAR(12) null; ROLE_ID INTEGER null; ;
|
||||
ROLE; ROLE_ID INTEGER; DESCRIPTION VARCHAR(100) null; ;
|
||||
SALARYGRADE; GRADE INTEGER; LOSAL INTEGER; HISAL INTEGER; ;
|
||||
|
||||
|
@@ -1,2 +1,2 @@
|
||||
# name; last modification
|
||||
Demo-Scott;
|
||||
Demo Scott (7 Tables);
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
# Name; Upsert; Primary key; ; Author
|
||||
# Name; Upsert; Primary Key; ; Author
|
||||
BONUS; N; ENAME VARCHAR(10); JOB VARCHAR(9); ; Demo; ;
|
||||
DEPARTMENT; N; DEPTNO INTEGER; ; Demo; ;
|
||||
EMPLOYEE; N; EMPNO INTEGER; ; Demo; ;
|
||||
|
||||
|
@@ -1 +1 @@
|
||||
7.2.2
|
||||
8.7.5
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+47
-125
@@ -116,7 +116,7 @@
|
||||
"font-weight: bold;">Dependencies</span></big>
|
||||
|
||||
<ul>
|
||||
<li>jailer-engine-<i>version</i>.jar</li>
|
||||
<li>jailer-engine-<i>version</i>.jar (included in jailer-<i>version</i>.zip)</li>
|
||||
|
||||
<li>log4J</li>
|
||||
</ul><br />
|
||||
@@ -137,8 +137,8 @@
|
||||
<br />
|
||||
The example is included in the
|
||||
jailer-engine-<i>version</i>.jar. It extracts some data
|
||||
from the "demo-scott" database and imports it into another
|
||||
database "demo-scott-subset".<br />
|
||||
from the "demo-scott-1.4" database and imports it into another
|
||||
database "demo-scott-subset-1.4".<br />
|
||||
|
||||
<ul>
|
||||
<li>Packages<br />
|
||||
@@ -154,132 +154,54 @@
|
||||
|
||||
<div style=
|
||||
'background:#FFFFFF; font-family: Courier New, Courier; font-size: 10pt; COLOR: #000000; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;'>
|
||||
|
||||
<pre style="color:#000000;background:#ffffff;"><span style="color:#800000; font-weight:bold; ">public</span> <span style="color:#800000; font-weight:bold; ">class</span> APIExample <span style="color:#800080; ">{</span>
|
||||
|
||||
<span style="color:#696969; ">// JDBC connection pool size</span>
|
||||
<span style="color:#800000; font-weight:bold; ">private</span> <span style="color:#800000; font-weight:bold; ">static</span> <span style="color:#800000; font-weight:bold; ">final</span> <span style="color:#bb7977; ">int</span> POOL_SIZE <span style="color:#808030; ">=</span> <span style="color:#008c00; ">10</span><span style="color:#800080; ">;</span>
|
||||
|
||||
<span style="color:#696969; ">// The subsetter</span>
|
||||
<span style="color:#800000; font-weight:bold; ">private</span> <span style="color:#800000; font-weight:bold; ">static</span> Subsetter subsetter <span style="color:#808030; ">=</span>
|
||||
<span style="color:#800000; font-weight:bold; ">new</span> Subsetter<span style="color:#808030; ">(</span>
|
||||
<span style="color:#800000; font-weight:bold; ">new</span> BasicDataSource<span style="color:#808030; ">(</span>
|
||||
<span style="color:#0000e6; ">"org.h2.Driver"</span><span style="color:#808030; ">,</span> <span style="color:#0000e6; ">"jdbc:h2:"</span> <span style="color:#808030; ">+</span> <span style="color:#800000; font-weight:bold; ">new</span> <span style="color:#bb7977; font-weight:bold; ">File</span><span style="color:#808030; ">(</span><span style="color:#0000e6; ">"demo-scott-1.4"</span><span style="color:#808030; ">)</span><span style="color:#808030; ">.</span>getAbsolutePath<span style="color:#808030; ">(</span><span style="color:#808030; ">)</span><span style="color:#808030; ">,</span> <span style="color:#0000e6; ">"sa"</span><span style="color:#808030; ">,</span> <span style="color:#0000e6; ">""</span><span style="color:#808030; ">,</span>
|
||||
POOL_SIZE<span style="color:#808030; ">,</span>
|
||||
<span style="color:#800000; font-weight:bold; ">new</span> <span style="color:#bb7977; font-weight:bold; ">File</span><span style="color:#808030; ">(</span><span style="color:#0000e6; ">"lib/h2-1.4.199.jar"</span><span style="color:#808030; ">)</span><span style="color:#808030; ">)</span><span style="color:#808030; ">,</span>
|
||||
<span style="color:#800000; font-weight:bold; ">null</span><span style="color:#808030; ">,</span>
|
||||
APIExample<span style="color:#808030; ">.</span>class<span style="color:#808030; ">.</span>getResource<span style="color:#808030; ">(</span><span style="color:#0000e6; ">"Demo-Scott"</span><span style="color:#808030; ">)</span><span style="color:#808030; ">,</span>
|
||||
APIExample<span style="color:#808030; ">.</span>class<span style="color:#808030; ">.</span>getResource<span style="color:#808030; ">(</span><span style="color:#0000e6; ">"Demo-Scott.jm"</span><span style="color:#808030; ">)</span><span style="color:#808030; ">,</span>
|
||||
ScriptFormat<span style="color:#808030; ">.</span>SQL<span style="color:#808030; ">)</span><span style="color:#800080; ">;</span>
|
||||
|
||||
<span style="color:#696969; ">// The importer</span>
|
||||
<span style="color:#800000; font-weight:bold; ">private</span> <span style="color:#800000; font-weight:bold; ">static</span> Importer importer <span style="color:#808030; ">=</span>
|
||||
<span style="color:#800000; font-weight:bold; ">new</span> Importer<span style="color:#808030; ">(</span>
|
||||
<span style="color:#800000; font-weight:bold; ">new</span> BasicDataSource<span style="color:#808030; ">(</span>
|
||||
<span style="color:#0000e6; ">"org.h2.Driver"</span><span style="color:#808030; ">,</span> <span style="color:#0000e6; ">"jdbc:h2:"</span> <span style="color:#808030; ">+</span> <span style="color:#800000; font-weight:bold; ">new</span> <span style="color:#bb7977; font-weight:bold; ">File</span><span style="color:#808030; ">(</span><span style="color:#0000e6; ">"demo-scott-subset-1.4"</span><span style="color:#808030; ">)</span><span style="color:#808030; ">.</span>getAbsolutePath<span style="color:#808030; ">(</span><span style="color:#808030; ">)</span><span style="color:#808030; ">,</span> <span style="color:#0000e6; ">"sa"</span><span style="color:#808030; ">,</span> <span style="color:#0000e6; ">""</span><span style="color:#808030; ">,</span>
|
||||
<span style="color:#008c00; ">10</span><span style="color:#808030; ">,</span>
|
||||
<span style="color:#800000; font-weight:bold; ">new</span> <span style="color:#bb7977; font-weight:bold; ">File</span><span style="color:#808030; ">(</span><span style="color:#0000e6; ">"lib/h2-1.4.199.jar"</span><span style="color:#808030; ">)</span><span style="color:#808030; ">)</span><span style="color:#808030; ">)</span><span style="color:#800080; ">;</span>
|
||||
|
||||
<span style="color:#3f5fbf; ">/**</span>
|
||||
<span style="color:#3f5fbf; "> </span><span style="color:#7f9fbf; font-weight:bold; ">*</span><span style="color:#3f5fbf; "> Exports data related with employee "SCOTT"</span>
|
||||
<span style="color:#3f5fbf; "> </span><span style="color:#7f9fbf; font-weight:bold; ">*</span><span style="color:#3f5fbf; "> and imports it into another database.</span>
|
||||
<span style="color:#3f5fbf; "> */</span>
|
||||
<span style="color:#800000; font-weight:bold; ">public</span> <span style="color:#800000; font-weight:bold; ">static</span> <span style="color:#bb7977; ">void</span> main<span style="color:#808030; ">(</span><span style="color:#bb7977; font-weight:bold; ">String</span><span style="color:#808030; ">[</span><span style="color:#808030; ">]</span> args<span style="color:#808030; ">)</span> <span style="color:#800000; font-weight:bold; ">throws</span> <span style="color:#bb7977; font-weight:bold; ">SQLException</span><span style="color:#808030; ">,</span> <span style="color:#bb7977; font-weight:bold; ">IOException</span> <span style="color:#800080; ">{</span>
|
||||
<span style="color:#bb7977; font-weight:bold; ">File</span> exportScriptFile <span style="color:#808030; ">=</span> Configuration<span style="color:#808030; ">.</span>getInstance<span style="color:#808030; ">(</span><span style="color:#808030; ">)</span><span style="color:#808030; ">.</span>createTempFile<span style="color:#808030; ">(</span><span style="color:#808030; ">)</span><span style="color:#800080; ">;</span>
|
||||
|
||||
subsetter<span style="color:#808030; ">.</span>setUpsertOnly<span style="color:#808030; ">(</span><span style="color:#800000; font-weight:bold; ">true</span><span style="color:#808030; ">)</span><span style="color:#800080; ">;</span> <span style="color:#696969; ">// overwrite previous data</span>
|
||||
subsetter<span style="color:#808030; ">.</span>execute<span style="color:#808030; ">(</span><span style="color:#0000e6; ">"NAME='SCOTT'"</span><span style="color:#808030; ">,</span> exportScriptFile<span style="color:#808030; ">)</span><span style="color:#800080; ">;</span>
|
||||
|
||||
importer<span style="color:#808030; ">.</span>execute<span style="color:#808030; ">(</span>exportScriptFile<span style="color:#808030; ">)</span><span style="color:#800080; ">;</span>
|
||||
|
||||
exportScriptFile<span style="color:#808030; ">.</span>delete<span style="color:#808030; ">(</span><span style="color:#808030; ">)</span><span style="color:#800080; ">;</span>
|
||||
<span style="color:#800080; ">}</span>
|
||||
|
||||
<span style="color:#800080; ">}</span>
|
||||
</pre>
|
||||
|
||||
<br />
|
||||
<strong><font color=
|
||||
'#7F0055'>package</font></strong> net.sf.jailer.api_example;<br />
|
||||
|
||||
<br />
|
||||
<strong><font color=
|
||||
'#7F0055'>import</font></strong> java.io.File;<br />
|
||||
|
||||
<strong><font color=
|
||||
'#7F0055'>import</font></strong> java.io.IOException;<br />
|
||||
|
||||
<strong><font color=
|
||||
'#7F0055'>import</font></strong> java.sql.SQLException;<br />
|
||||
|
||||
<br />
|
||||
<strong><font color=
|
||||
'#7F0055'>import</font></strong> net.sf.jailer.api.Importer;<br />
|
||||
|
||||
<strong><font color=
|
||||
'#7F0055'>import</font></strong> net.sf.jailer.api.Subsetter;<br />
|
||||
|
||||
<strong><font color=
|
||||
'#7F0055'>import</font></strong> net.sf.jailer.configuration.Configuration;<br />
|
||||
|
||||
<strong><font color=
|
||||
'#7F0055'>import</font></strong> net.sf.jailer.database.BasicDataSource;<br />
|
||||
|
||||
<strong><font color=
|
||||
'#7F0055'>import</font></strong> net.sf.jailer.subsetting.ScriptFormat;<br />
|
||||
|
||||
<br />
|
||||
<font color='#2040A0'>/**<br />
|
||||
* Jailer API Example. <br />
|
||||
|
||||
* <br />
|
||||
* Extracts some data from the "demo-scott" database<br />
|
||||
|
||||
* and imports it into another database "demo-scott-subset".<br />
|
||||
|
||||
*/</font><br />
|
||||
<strong><font color=
|
||||
'#7F0055'>public</font></strong> <strong><font color='#7F0055'>class</font></strong> APIExample {<br />
|
||||
|
||||
<br />
|
||||
<font color=
|
||||
'#3F7F5F'>// JDBC connection pool size</font><br />
|
||||
|
||||
<strong><font color=
|
||||
'#7F0055'>private</font></strong> <strong><font color='#7F0055'>static</font></strong> <strong><font color='#7F0055'>final</font></strong> <strong><font color='#7F0055'>int</font></strong> POOL_SIZE = 10;<br />
|
||||
|
||||
<br />
|
||||
<font color=
|
||||
'#3F7F5F'>// The subsetter</font><br />
|
||||
<strong><font color=
|
||||
'#7F0055'>private</font></strong> <strong><font color='#7F0055'>static</font></strong> Subsetter subsetter = <br />
|
||||
|
||||
<strong><font color='#7F0055'>new</font></strong> Subsetter(<br />
|
||||
|
||||
<strong><font color='#7F0055'>new</font></strong> BasicDataSource(<br />
|
||||
|
||||
<font color='#2A00FF'>"org.h2.Driver"</font>, <font color='#2A00FF'>"jdbc:h2:demo-scott"</font>, <font color='#2A00FF'>"sa"</font>, <font color='#2A00FF'>""</font>,<br />
|
||||
|
||||
POOL_SIZE,<br />
|
||||
|
||||
<strong><font color='#7F0055'>new</font></strong> File(<font color='#2A00FF'>"lib/h2-1.3.160.jar"</font>)),<br />
|
||||
|
||||
<strong><font color='#7F0055'>null</font></strong>,<br />
|
||||
|
||||
APIExample.<strong><font color='#7F0055'>class</font></strong>.getResource(<font color='#2A00FF'>"Demo-Scott"</font>),<br />
|
||||
|
||||
APIExample.<strong><font color='#7F0055'>class</font></strong>.getResource(<font color='#2A00FF'>"Demo-Scott.csv"</font>),<br />
|
||||
|
||||
ScriptFormat.SQL);<br />
|
||||
|
||||
<br />
|
||||
<font color=
|
||||
'#3F7F5F'>// The importer</font><br />
|
||||
<strong><font color=
|
||||
'#7F0055'>private</font></strong> <strong><font color='#7F0055'>static</font></strong> Importer importer =<br />
|
||||
|
||||
<strong><font color='#7F0055'>new</font></strong> Importer(<br />
|
||||
|
||||
<strong><font color='#7F0055'>new</font></strong> BasicDataSource(<br />
|
||||
|
||||
<font color='#2A00FF'>"org.h2.Driver"</font>, <font color='#2A00FF'>"jdbc:h2:demo-scott-subset"</font>, <font color='#2A00FF'>"sa"</font>, <font color='#2A00FF'>""</font>,<br />
|
||||
|
||||
10,<br />
|
||||
|
||||
<strong><font color='#7F0055'>new</font></strong> File(<font color='#2A00FF'>"lib/h2-1.3.160.jar"</font>)));<br />
|
||||
|
||||
<br />
|
||||
<font color=
|
||||
'#2040A0'>/**<br />
|
||||
* Exports data related with employee "SCOTT"<br />
|
||||
|
||||
* and imports it into another database.<br />
|
||||
|
||||
*/</font><br />
|
||||
<strong><font color=
|
||||
'#7F0055'>public</font></strong> <strong><font color='#7F0055'>static</font></strong> <strong><font color='#7F0055'>void</font></strong> main(String[] args) <strong><font color='#7F0055'>throws</font></strong> SQLException, IOException {<br />
|
||||
|
||||
File exportScriptFile = Configuration.getInstance().createTempFile();<br />
|
||||
|
||||
<br />
|
||||
|
||||
subsetter.setUpsertOnly(<strong><font color='#7F0055'>true</font></strong>); <font color='#3F7F5F'>// overwrite previous data</font><br />
|
||||
|
||||
subsetter.execute(<font color='#2A00FF'>"NAME='SCOTT'"</font>, exportScriptFile);<br />
|
||||
|
||||
<br />
|
||||
|
||||
importer.execute(exportScriptFile);<br />
|
||||
|
||||
<br />
|
||||
|
||||
exportScriptFile.delete();<br />
|
||||
|
||||
}<br />
|
||||
<br />
|
||||
}<br />
|
||||
|
||||
<div style=
|
||||
'text-align:right;BORDER-TOP: #ccc 1px dashed'>
|
||||
<a href=
|
||||
"http://www.togotutor.com/code-to-html/java-to-html.php"
|
||||
target="_blank">Code Formatted by ToGoTutor</a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
+3
-3
@@ -12,14 +12,14 @@ Informix Dynamic Server;jdbc:informix-sqli://<HOST>:<PORT>/<DB>:INFORMIXSERVER=<
|
||||
InstantDB (v3.13 and earlier);jdbc:idb:<DB>;jdbc.idbDriver
|
||||
InstantDB (v3.14 and later);jdbc:idb:<DB>;org.enhydra.instantdb.jdbc.idbDriver
|
||||
Interbase (InterClient Driver);jdbc:interbase://<HOST>/<DB>;interbase.interclient.Driver
|
||||
H2 embedded (Java SQL database);jdbc:h2:<DB-File>;org.h2.Driver;lib/h2-1.3.175.jar
|
||||
H2 TCP (Java SQL database);jdbc:h2:tcp://<HOST>/<DB-File>;org.h2.Driver;lib/h2-1.3.175.jar
|
||||
H2 embedded (Java SQL database);jdbc:h2:<DB-File>;org.h2.Driver;lib/h2-1.4.199.jar
|
||||
H2 TCP (Java SQL database);jdbc:h2:tcp://<HOST>/<DB-File>;org.h2.Driver;lib/h2-1.4.199.jar
|
||||
HyperSQL;jdbc:hsqldb:<file|hsql|http>:<DB>;org.hsqldb.jdbcDriver
|
||||
# Microsoft SQL Server (jTDS);jdbc:jtds:sqlserver://<server>[:<port>][/<database>];net.sourceforge.jtds.jdbc.Driver;lib/jtds-1.3.1.jar
|
||||
# Microsoft SQL Server (JTurbo Driver);jdbc:JTurbo://<HOST>:<PORT>/<DB>;com.ashna.jturbo.driver.Driver
|
||||
# Microsoft SQL Server (Sprinta Driver);jdbc:inetdae:<HOST>:<PORT>?database=<DB>;com.inet.tds.TdsDriver
|
||||
# Microsoft SQL Server (Microsoft Driver);jdbc:microsoft:sqlserver://<HOST>:<PORT>[\;DatabaseName=<DB>];com.microsoft.jdbc.sqlserver.SQLServerDriver
|
||||
Microsoft SQL Server;jdbc:sqlserver://<HOST>:<PORT>[\;DatabaseName=<DB>];com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
Microsoft SQL Server;jdbc:sqlserver://<HOST>:<PORT>[\;DatabaseName=<DB>];com.microsoft.sqlserver.jdbc.SQLServerDriver;lib/mssql-jdbc-7.2.1.jre8.jar
|
||||
MySQL;jdbc:mysql://<HOST>:<PORT>/<DB>;org.gjt.mm.mysql.Driver;lib/mysql-connector-java-5.1.5-bin.jar
|
||||
Oracle OCI;jdbc:oracle:oci:@<SID>;oracle.jdbc.driver.OracleDriver
|
||||
# PostgreSQL (v6.5 and earlier);jdbc:postgresql://<HOST>:<PORT>/<DB>;postgresql.Driver
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,3 +1,50 @@
|
||||
8.8.0
|
||||
- New feature "Check Primary Keys" makes it possible to check the user-defined primary keys for uniqueness.
|
||||
- A warning message appears if the number of collected rows differs from the number of exported ones.
|
||||
- The performance of the preparation for the subsetting-process has been improved.
|
||||
- Extraction models can now be loaded from the "Data Model Manager" dialog.
|
||||
- It was not possible to pass user / password via cli when it starts with '-'
|
||||
- Updated local database to H2 1.4.199.
|
||||
- The fonts selection in the GUI has been standardized.
|
||||
- Improved error handling in the data browser.
|
||||
If the same error occurs multiple times because it affects multiple table browsers,
|
||||
it will be displayed only once.
|
||||
|
||||
8.7.8
|
||||
- Fixed a bug that caused the creation of a delete script to generate syntactically incorrect SQL statements when a table without a primary key exists.
|
||||
|
||||
8.7.5
|
||||
- Fix for ticket 39 "Oracle queries are going failed". https://sourceforge.net/p/jailer/bugs/39/
|
||||
- Minor bug fixes.
|
||||
|
||||
8.7.3
|
||||
- Fix: the working table scope "local" did not work correctly with PostgreSQL.
|
||||
- Cursor-based result sets have been activated under PostgreSQL.
|
||||
Retrieving the entire ResultSet at once led to out-of-memory errors.
|
||||
|
||||
8.7.2
|
||||
- Selected tables are automatically scrolled into the visible area of the display.
|
||||
- Fix: not all associations between two visible tables were always visible.
|
||||
|
||||
8.7.1
|
||||
- SQL Console is now robust against outdated metadata.
|
||||
- Fixed: Associations between visible tables were not always visible.
|
||||
|
||||
8.7
|
||||
- Modal dialogues were replaced by non-modal ones.
|
||||
- Creation of the data model files has been revised.
|
||||
- Execution plans for DB2 LUW.
|
||||
- Fixed "ERROR: failed to find conversion function from unknown to text"
|
||||
that could occur with PostgreSQL in connection with the "local database" scope.
|
||||
|
||||
8.6
|
||||
- The data browser automatically reconnects when the connection is lost.
|
||||
- Minor bug fixes.
|
||||
|
||||
8.5.4
|
||||
- The table from which the navigation starts can now be changed at any time in the data browser.
|
||||
- Improved data browser performance.
|
||||
|
||||
8.5.3
|
||||
- Column order in the display can be defined not only globally but also for each table.
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -161,7 +161,13 @@ public class CommandLine {
|
||||
|
||||
@Option(name="-limit-transaction-size", usage="collects the rows using multiple insert operations with a limited number of rows per operation")
|
||||
boolean insertIncrementally = false;
|
||||
|
||||
|
||||
@Option(name="-abortInCaseOfInconsistency", usage="abort the process if the result is inconsistent due to insufficient transaction isolation")
|
||||
boolean abortInCaseOfInconsistency = false;
|
||||
|
||||
@Option(name="-", usage="do not interpret the next word as an option, even if it begins with '-'. For example, if the username is \"-abc\", use \"- -abc\".")
|
||||
public List<String> escapedWords = new ArrayList<String>();
|
||||
|
||||
@Argument
|
||||
public List<String> arguments = new ArrayList<String>();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -15,6 +15,10 @@
|
||||
*/
|
||||
package net.sf.jailer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.kohsuke.args4j.CmdLineException;
|
||||
import org.kohsuke.args4j.CmdLineParser;
|
||||
|
||||
@@ -34,8 +38,32 @@ public class CommandLineParser {
|
||||
public static CommandLine parse(String[] args, boolean silent) throws Exception {
|
||||
CommandLine commandLine = new CommandLine();
|
||||
try {
|
||||
List<String> theArgs = new ArrayList<String>();
|
||||
|
||||
final String ESC_PREFIX = "((!JAILER_MINUS_ESC!!)";
|
||||
|
||||
int i = 0;
|
||||
while (i < args.length) {
|
||||
String arg = args[i];
|
||||
if ("-".equals(arg) && i < args.length - 1) {
|
||||
theArgs.add(ESC_PREFIX + args[++i]);
|
||||
} else {
|
||||
theArgs.add(arg);
|
||||
}
|
||||
++i;
|
||||
}
|
||||
|
||||
CmdLineParser cmdLineParser = new CmdLineParser(commandLine);
|
||||
cmdLineParser.parseArgument(args);
|
||||
cmdLineParser.parseArgument(theArgs.toArray(new String[0]));
|
||||
List<String> escapedWords = new ArrayList<String>();
|
||||
for (String arg: commandLine.arguments) {
|
||||
if (arg.startsWith(ESC_PREFIX)) {
|
||||
escapedWords.add(arg.substring(ESC_PREFIX.length()));
|
||||
} else {
|
||||
escapedWords.add(arg);
|
||||
}
|
||||
}
|
||||
commandLine.arguments = escapedWords;
|
||||
if (commandLine.arguments.isEmpty()) {
|
||||
if (!silent) {
|
||||
printUsage();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,9 +24,11 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import net.sf.jailer.api.Subsetter;
|
||||
import net.sf.jailer.configuration.DBMS;
|
||||
import net.sf.jailer.database.WorkingTableScope;
|
||||
import net.sf.jailer.progress.ProgressListenerRegistry;
|
||||
import net.sf.jailer.subsetting.InconsistentSubsettingResultException;
|
||||
import net.sf.jailer.subsetting.ScriptFormat;
|
||||
import net.sf.jailer.util.CsvFile;
|
||||
import net.sf.jailer.util.LayoutStorage;
|
||||
@@ -84,6 +86,7 @@ public class ExecutionContext {
|
||||
this.embedded = other.embedded;
|
||||
this.checkPrimaryKeys = other.checkPrimaryKeys;
|
||||
this.insertIncrementally = other.insertIncrementally;
|
||||
this.abortInCaseOfInconsistency = other.abortInCaseOfInconsistency;
|
||||
this.independentWorkingTables = other.independentWorkingTables;
|
||||
this.upkDomain = other.upkDomain;
|
||||
// don't share progressListenerRegistry, was: this.progressListenerRegistry = other.progressListenerRegistry;
|
||||
@@ -562,6 +565,24 @@ public class ExecutionContext {
|
||||
this.insertIncrementally = insertIncrementally;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return if <code>true</code>, {@link Subsetter#execute(String, File)} throws an
|
||||
* {@link InconsistentSubsettingResultException} if the result is inconsistent
|
||||
* due to insufficient transaction isolation
|
||||
*/
|
||||
public boolean isAbortInCaseOfInconsistency() {
|
||||
return abortInCaseOfInconsistency;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param abortInCaseOfInconsitency if <code>true</code>, {@link Subsetter#execute(String, File)} throws an
|
||||
* {@link InconsistentSubsettingResultException} if the result is inconsistent
|
||||
* due to insufficient transaction isolation
|
||||
*/
|
||||
public void setAbortInCaseOfInconsistency(boolean abortInCaseOfInconsitency) {
|
||||
this.abortInCaseOfInconsistency = abortInCaseOfInconsitency;
|
||||
}
|
||||
|
||||
/**
|
||||
* Is the subsetter embedded into an application?
|
||||
*/
|
||||
@@ -830,6 +851,9 @@ public class ExecutionContext {
|
||||
// collects the rows using multiple insert operations with a limited number of rows per operation
|
||||
private boolean insertIncrementally = false;
|
||||
|
||||
// abort the process if the result is inconsistent due to insufficient transaction isolation
|
||||
private boolean abortInCaseOfInconsistency = false;
|
||||
|
||||
// schema in which the import-filter mapping tables will be created
|
||||
private String importFilterMappingTableSchema = "";
|
||||
|
||||
@@ -939,6 +963,7 @@ public class ExecutionContext {
|
||||
importFilterMappingTableSchema = commandLine.importFilterMappingTableSchema;
|
||||
checkPrimaryKeys = commandLine.checkPrimaryKeys;
|
||||
insertIncrementally = commandLine.insertIncrementally;
|
||||
abortInCaseOfInconsistency = commandLine.abortInCaseOfInconsistency;
|
||||
}
|
||||
|
||||
private Map<String, String> copy(Map<String, String> map) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -25,7 +25,7 @@ public class JailerVersion {
|
||||
/**
|
||||
* The Jailer version.
|
||||
*/
|
||||
public static final String VERSION = "8.5.3.0";
|
||||
public static final String VERSION = "8.8.0.2";
|
||||
|
||||
/**
|
||||
* The Jailer working tables version.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -32,6 +32,7 @@ import net.sf.jailer.configuration.DBMS;
|
||||
import net.sf.jailer.database.BasicDataSource;
|
||||
import net.sf.jailer.database.WorkingTableScope;
|
||||
import net.sf.jailer.subsetting.ExportStatistic;
|
||||
import net.sf.jailer.subsetting.InconsistentSubsettingResultException;
|
||||
import net.sf.jailer.subsetting.ScriptFormat;
|
||||
import net.sf.jailer.subsetting.SubsettingEngine;
|
||||
|
||||
@@ -118,6 +119,8 @@ public class Subsetter {
|
||||
* @param exportScriptFile the export-script file (compressed if it ends with '.zip' or '.gz')
|
||||
*
|
||||
* @return export statistic
|
||||
*
|
||||
* @throws InconsistentSubsettingResultException if {@link ExecutionContext#isAbortInCaseOfInconsistency()} and the number of exported rows differs from that of the collected ones
|
||||
*/
|
||||
public ExportStatistic execute(String whereClause, File exportScriptFile) throws SQLException, IOException {
|
||||
return execute(whereClause, exportScriptFile, null);
|
||||
@@ -131,6 +134,8 @@ public class Subsetter {
|
||||
* @param deleteScriptFile the delete-script file (compressed if it ends with '.zip' or '.gz'), optional
|
||||
*
|
||||
* @return export statistic
|
||||
*
|
||||
* @throws InconsistentSubsettingResultException if {@link ExecutionContext#isAbortInCaseOfInconsistency()} and the number of exported rows differs from that of the collected ones
|
||||
*/
|
||||
public ExportStatistic execute(String whereClause, File exportScriptFile, File deleteScriptFile) throws SQLException, IOException {
|
||||
try {
|
||||
@@ -643,6 +648,22 @@ public class Subsetter {
|
||||
return executionContext.getSourceSchemaMapping();
|
||||
}
|
||||
|
||||
/**
|
||||
* If <code>true</code>, the Subsetter throws an
|
||||
*
|
||||
* @return if <code>true</code>, abort the process if the result is inconsistent due to insufficient transaction isolation
|
||||
*/
|
||||
public boolean isAbortInCaseOfInconsistency() {
|
||||
return executionContext.isAbortInCaseOfInconsistency();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param abortInCaseOfInconsitency if <code>true</code>, abort the process if the result is inconsistent due to insufficient transaction isolation
|
||||
*/
|
||||
public void setAbortInCaseOfInconsistency(boolean abortInCaseOfInconsitency) {
|
||||
executionContext.setAbortInCaseOfInconsistency(abortInCaseOfInconsitency);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the size of extraction-model pool (default is 10)
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -26,10 +26,10 @@ import net.sf.jailer.database.BasicDataSource;
|
||||
import net.sf.jailer.subsetting.ScriptFormat;
|
||||
|
||||
/**
|
||||
* Jailer API Example. <br>
|
||||
* Jailer API Example. <br>
|
||||
*
|
||||
* Extracts some data from the "demo-scott" database
|
||||
* and imports it into another database "demo-scott-subset".
|
||||
* Extracts some data from the "demo-scott-1.4" database
|
||||
* and imports it into another database "demo-scott-subset-1.4".
|
||||
*/
|
||||
public class APIExample {
|
||||
|
||||
@@ -40,9 +40,9 @@ public class APIExample {
|
||||
private static Subsetter subsetter =
|
||||
new Subsetter(
|
||||
new BasicDataSource(
|
||||
"org.h2.Driver", "jdbc:h2:demo-scott", "sa", "",
|
||||
"org.h2.Driver", "jdbc:h2:" + new File("demo-scott-1.4").getAbsolutePath(), "sa", "",
|
||||
POOL_SIZE,
|
||||
new File("lib/h2-1.3.175.jar")),
|
||||
new File("lib/h2-1.4.199.jar")),
|
||||
null,
|
||||
APIExample.class.getResource("Demo-Scott"),
|
||||
APIExample.class.getResource("Demo-Scott.jm"),
|
||||
@@ -52,9 +52,9 @@ public class APIExample {
|
||||
private static Importer importer =
|
||||
new Importer(
|
||||
new BasicDataSource(
|
||||
"org.h2.Driver", "jdbc:h2:demo-scott-subset", "sa", "",
|
||||
"org.h2.Driver", "jdbc:h2:" + new File("demo-scott-subset-1.4").getAbsolutePath(), "sa", "",
|
||||
10,
|
||||
new File("lib/h2-1.3.175.jar")));
|
||||
new File("lib/h2-1.4.199.jar")));
|
||||
|
||||
/**
|
||||
* Exports data related with employee "SCOTT"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -92,12 +92,39 @@ public class Configuration {
|
||||
* The renderer.
|
||||
*/
|
||||
private HtmlDataModelRenderer renderer;
|
||||
|
||||
|
||||
/**
|
||||
* URL rewrite rule.
|
||||
*/
|
||||
public static class UrlRewriteRule {
|
||||
private String pattern;
|
||||
private String replacement;
|
||||
|
||||
public String getPattern() {
|
||||
return pattern;
|
||||
}
|
||||
public void setPattern(String pattern) {
|
||||
this.pattern = pattern;
|
||||
}
|
||||
|
||||
public String getReplacement() {
|
||||
return replacement;
|
||||
}
|
||||
public void setReplacement(String replacement) {
|
||||
this.replacement = replacement;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* All URL rewrite rules.
|
||||
*/
|
||||
private List<UrlRewriteRule> urlRewriteRules = new ArrayList<UrlRewriteRule>();
|
||||
|
||||
/**
|
||||
* All {@link DBMS}s.
|
||||
*/
|
||||
private List<DBMS> dBMSConfigurations = new ArrayList<DBMS>();
|
||||
|
||||
|
||||
/**
|
||||
* If <code>true</code>, the UPK don't preserve order. This minimizes the size of the UPK.
|
||||
*/
|
||||
@@ -210,6 +237,21 @@ public class Configuration {
|
||||
this.renderer = theRenderer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the URL rewrite rules.
|
||||
*/
|
||||
@XmlElement(name = "urlRewriteRule")
|
||||
public List<UrlRewriteRule> getUrlRewriteRules() {
|
||||
return urlRewriteRules;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param urlRewriteRules the URL rewrite rules.
|
||||
*/
|
||||
public void setUrlRewriteRules(List<UrlRewriteRule> urlRewriteRules) {
|
||||
this.urlRewriteRules = urlRewriteRules;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the dBMSConfigurations
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -306,6 +306,7 @@ public class DBMS {
|
||||
private String indexInfoQuery = null;
|
||||
private String identifierQuoteString = "\"";
|
||||
|
||||
private String explainCreateExplainTable = null;
|
||||
private String explainPrepare = null;
|
||||
private String explainQuery = null;
|
||||
private String explainCleanup = null;
|
||||
@@ -944,6 +945,14 @@ public class DBMS {
|
||||
this.explainPrepare = explainPrepare;
|
||||
}
|
||||
|
||||
public String getExplainCreateExplainTable() {
|
||||
return explainCreateExplainTable;
|
||||
}
|
||||
|
||||
public void setExplainCreateExplainTable(String explainCreateExplainTable) {
|
||||
this.explainCreateExplainTable = explainCreateExplainTable;
|
||||
}
|
||||
|
||||
public String getExplainQuery() {
|
||||
return explainQuery;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -159,7 +159,7 @@ public class DatabaseObjectRenderingDescription {
|
||||
ImageIcon icon = icons.get(getIconURL());
|
||||
if (icon == null) {
|
||||
try {
|
||||
icon = new ImageIcon(getClass().getResource(getIconURL()));
|
||||
icon = new ImageIcon(DatabaseObjectRenderingDescription.class.getResource(getIconURL()));
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -32,7 +32,7 @@ public class LocalDatabaseConfiguration {
|
||||
private String password = "";
|
||||
|
||||
private String driver = "org.h2.Driver";
|
||||
private String lib = "lib/h2-1.3.175.jar";
|
||||
private String lib = "lib/h2-1.4.199.jar";
|
||||
|
||||
/**
|
||||
* @return the localPKType
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<!-- Configuration of the local database -->
|
||||
<localDatabase>
|
||||
<databaseFolder>local</databaseFolder>
|
||||
<lib>lib/h2-1.3.175.jar</lib>
|
||||
<lib>lib/h2-1.4.199.jar</lib>
|
||||
<driver>org.h2.Driver</driver>
|
||||
<urlPattern>jdbc:h2:%s;LOG=0;UNDO_LOG=0</urlPattern>
|
||||
<localPKType>VARCHAR</localPKType>
|
||||
@@ -47,6 +47,19 @@
|
||||
<!-- additional SQL keywords -->
|
||||
<additionalSQLKeywords>sensitive, datetime</additionalSQLKeywords>
|
||||
|
||||
<!-- IBM JDBC Connector -->
|
||||
<urlRewriteRule>
|
||||
<pattern>^jdbc:ibm:(.*)$</pattern>
|
||||
<replacement>jdbc:$1</replacement>
|
||||
</urlRewriteRule>
|
||||
|
||||
<!-- other rules
|
||||
<urlRewriteRule>
|
||||
<pattern></pattern>
|
||||
<replacement></replacement>
|
||||
</urlRewriteRule>
|
||||
-->
|
||||
|
||||
<!-- for Oracle -->
|
||||
<dbms>
|
||||
<id>ORACLE</id>
|
||||
@@ -353,7 +366,7 @@ union all
|
||||
<dbms>
|
||||
<id>MySQL</id>
|
||||
<displayName>MySQL</displayName>
|
||||
<urlPattern>jdbc:mysql.*|jdbc:mariadb.*</urlPattern>
|
||||
<urlPattern>jdbc:mysql.*</urlPattern>
|
||||
<sqlDialect>
|
||||
<needsValuesKeywordForDeletes>false</needsValuesKeywordForDeletes>
|
||||
<supportsInClauseForDeletes>true</supportsInClauseForDeletes>
|
||||
@@ -366,6 +379,7 @@ union all
|
||||
<value>true</value>
|
||||
</entry>
|
||||
</jdbcProperties>
|
||||
<!-- <fetchSize>-2147483648</fetchSize> --> <!-- setFetchSize(Integer.MIN_VALUE) should enable result set streaming -->
|
||||
<statisticRenovator>
|
||||
<scriptFileName>script/mysql/update_statistics.sql</scriptFileName>
|
||||
</statisticRenovator>
|
||||
@@ -471,7 +485,186 @@ union all
|
||||
<avoidLeftJoin>false</avoidLeftJoin>
|
||||
<useInlineViewsInDataBrowser>true</useInlineViewsInDataBrowser>
|
||||
<defaultSchemaQuery>Select DATABASE()</defaultSchemaQuery>
|
||||
<estimatedRowCountQuery>select TABLE_NAME, CARDINALITY from INFORMATION_SCHEMA.STATISTICS where TABLE_SCHEMA = '%s'</estimatedRowCountQuery>
|
||||
<estimatedRowCountQuery>select TABLE_NAME, max(CARDINALITY) from INFORMATION_SCHEMA.STATISTICS where TABLE_SCHEMA = '%s' group by TABLE_NAME</estimatedRowCountQuery>
|
||||
<viewTextOrDDLQuery>SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = '%1$s' and TABLE_NAME = '%2$s'</viewTextOrDDLQuery>
|
||||
|
||||
<virtualColumnsQuery>SELECT TABLE_NAME, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = '${SCHEMA}' AND EXTRA LIKE '%VIRTUAL%'</virtualColumnsQuery>
|
||||
<!--
|
||||
<importedKeysQuery>SELECT PKCU.TABLE_SCHEMA, null, PKCU.TABLE_NAME, PKCU.COLUMN_NAME, KCU.TABLE_SCHEMA, null, KCU.TABLE_NAME, KCU.COLUMN_NAME, KCU.ORDINAL_POSITION, null, null, RC.CONSTRAINT_NAME, RC.UNIQUE_CONSTRAINT_NAME, null FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS RC JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU ON KCU.CONSTRAINT_CATALOG = RC.CONSTRAINT_CATALOG AND KCU.CONSTRAINT_SCHEMA = RC.CONSTRAINT_SCHEMA AND KCU.CONSTRAINT_NAME = RC.CONSTRAINT_NAME JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE PKCU ON PKCU.CONSTRAINT_CATALOG = RC.UNIQUE_CONSTRAINT_CATALOG AND PKCU.CONSTRAINT_SCHEMA = RC.UNIQUE_CONSTRAINT_SCHEMA AND PKCU.CONSTRAINT_NAME = RC.UNIQUE_CONSTRAINT_NAME AND PKCU.TABLE_NAME = RC.REFERENCED_TABLE_NAME AND PKCU.ORDINAL_POSITION = KCU.ORDINAL_POSITION WHERE PKCU.TABLE_SCHEMA = '${SCHEMA}' ORDER BY KCU.ORDINAL_POSITION</importedKeysQuery>
|
||||
<primaryKeysQuery>SELECT null, KCU.TABLE_SCHEMA, KCU.TABLE_NAME, KCU.COLUMN_NAME, KCU.ORDINAL_POSITION, C.CONSTRAINT_NAME FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS C JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU ON KCU.CONSTRAINT_CATALOG = C.CONSTRAINT_CATALOG AND KCU.CONSTRAINT_SCHEMA = C.CONSTRAINT_SCHEMA AND KCU.TABLE_NAME = C.TABLE_NAME AND KCU.CONSTRAINT_NAME = C.CONSTRAINT_NAME WHERE C.CONSTRAINT_TYPE = 'PRIMARY KEY' AND KCU.TABLE_SCHEMA = '${SCHEMA}' ORDER BY KCU.ORDINAL_POSITION</primaryKeysQuery>
|
||||
-->
|
||||
<nullableContraint>NULL</nullableContraint>
|
||||
<identifierQuoteString>`</identifierQuoteString>
|
||||
<ddlQuery>SHOW CREATE ${type} `${schema}`.`${table}`</ddlQuery>
|
||||
<explainPrepare></explainPrepare>
|
||||
<explainQuery>explain %1$s</explainQuery>
|
||||
<explainCleanup></explainCleanup>
|
||||
<functionSourceQuery>SHOW CREATE FUNCTION %1$s.%2$s</functionSourceQuery>
|
||||
<procedureSourceQuery>SHOW CREATE PROCEDURE %1$s.%2$s</procedureSourceQuery>
|
||||
<constraintsQuery>
|
||||
Select CNAME, TNAME, COLNAME, CTYPE, DETAIL From
|
||||
(
|
||||
Select concat('pk_', KCU.TABLE_NAME) CNAME, KCU.TABLE_NAME TNAME, KCU.COLUMN_NAME COLNAME, 'PK' CTYPE, null DETAIL, KCU.ORDINAL_POSITION POS, 1 TYPEPOS
|
||||
From
|
||||
INFORMATION_SCHEMA.TABLE_CONSTRAINTS C
|
||||
join
|
||||
INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU
|
||||
ON KCU.CONSTRAINT_CATALOG = C.CONSTRAINT_CATALOG
|
||||
AND KCU.CONSTRAINT_SCHEMA = C.CONSTRAINT_SCHEMA
|
||||
AND KCU.TABLE_NAME = C.TABLE_NAME
|
||||
AND KCU.CONSTRAINT_NAME = C.CONSTRAINT_NAME
|
||||
where
|
||||
C.CONSTRAINT_TYPE = 'PRIMARY KEY'
|
||||
AND KCU.TABLE_SCHEMA = '%1$s'
|
||||
union all
|
||||
Select C.CONSTRAINT_NAME CNAME, KCU.TABLE_NAME TNAME, KCU.COLUMN_NAME COLNAME, 'Unique' CTYPE, null DETAIL, KCU.ORDINAL_POSITION POS, 2 TYPEPOS
|
||||
From
|
||||
INFORMATION_SCHEMA.TABLE_CONSTRAINTS C
|
||||
join
|
||||
INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU
|
||||
ON KCU.CONSTRAINT_CATALOG = C.CONSTRAINT_CATALOG
|
||||
AND KCU.CONSTRAINT_SCHEMA = C.CONSTRAINT_SCHEMA
|
||||
AND KCU.TABLE_NAME = C.TABLE_NAME
|
||||
AND KCU.CONSTRAINT_NAME = C.CONSTRAINT_NAME
|
||||
where
|
||||
C.CONSTRAINT_TYPE = 'UNIQUE'
|
||||
AND KCU.TABLE_SCHEMA = '%1$s'
|
||||
) pk order by TYPEPOS, CNAME, TNAME, POS, COLNAME
|
||||
</constraintsQuery>
|
||||
<objectRenderers>
|
||||
<name>Triggers</name>
|
||||
<iconURL>/net/sf/jailer/ui/resource/triggers.png</iconURL>
|
||||
<itemDescription>
|
||||
<iconURL>/net/sf/jailer/ui/resource/trigger.png</iconURL>
|
||||
</itemDescription>
|
||||
<listQuery>SHOW TRIGGERS FROM %1$s</listQuery>
|
||||
</objectRenderers>
|
||||
</dbms>
|
||||
|
||||
<!-- for MariaDB -->
|
||||
<dbms>
|
||||
<id>MariaDB</id>
|
||||
<displayName>MariaDB</displayName>
|
||||
<urlPattern>jdbc:mariadb.*</urlPattern>
|
||||
<sqlDialect>
|
||||
<needsValuesKeywordForDeletes>false</needsValuesKeywordForDeletes>
|
||||
<supportsInClauseForDeletes>true</supportsInClauseForDeletes>
|
||||
<supportsMultiRowInserts>true</supportsMultiRowInserts>
|
||||
<upsertMode>FROM_DUAL</upsertMode>
|
||||
</sqlDialect>
|
||||
<jdbcProperties>
|
||||
<entry>
|
||||
<key>noDatetimeStringSync</key>
|
||||
<value>true</value>
|
||||
</entry>
|
||||
</jdbcProperties>
|
||||
<!-- <fetchSize>-2147483648</fetchSize> --> <!-- setFetchSize(Integer.MIN_VALUE) should enable result set streaming -->
|
||||
<statisticRenovator>
|
||||
<scriptFileName>script/mysql/update_statistics.sql</scriptFileName>
|
||||
</statisticRenovator>
|
||||
<typeReplacement>
|
||||
<entry>
|
||||
<key>TINYINT</key>
|
||||
<value>INT</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>SMALLINT</key>
|
||||
<value>INT</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>MEDIUMINT</key>
|
||||
<value>INT</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>INT</key>
|
||||
<value>BIGINT</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>INTEGER</key>
|
||||
<value>BIGINT</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>tinyint</key>
|
||||
<value>int</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>smallint</key>
|
||||
<value>int</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>mediumint</key>
|
||||
<value>int</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>int</key>
|
||||
<value>bigint</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>integer</key>
|
||||
<value>bigint</value>
|
||||
</entry>
|
||||
</typeReplacement>
|
||||
<stringLiteralEscapeSequences>
|
||||
<entry>
|
||||
<key>\0</key>
|
||||
<value>\0</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>'</key>
|
||||
<value>\'</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>"</key>
|
||||
<value>\"</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>\n</key>
|
||||
<value>\n</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>\r</key>
|
||||
<value>\r</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>\t</key>
|
||||
<value>\t</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>\b</key>
|
||||
<value>\b</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>\26</key>
|
||||
<value>\Z</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>\\</key>
|
||||
<value>\\</value>
|
||||
</entry>
|
||||
</stringLiteralEscapeSequences>
|
||||
<sqlLimitSuffix>LIMIT 0, %s</sqlLimitSuffix>
|
||||
|
||||
<!-- NOLOGGING, TABLESPACE-spec., etc. -->
|
||||
<tableProperties></tableProperties>
|
||||
|
||||
<limitTransactionSize>
|
||||
<limit>30000</limit>
|
||||
<statementSuffix>limit %1$s</statementSuffix>
|
||||
</limitTransactionSize>
|
||||
|
||||
<identityInserts>false</identityInserts>
|
||||
<emptyBLOBValue>BINARY ''</emptyBLOBValue>
|
||||
<emptyCLOBValue>''</emptyCLOBValue>
|
||||
<emptyNCLOBValue>''</emptyNCLOBValue>
|
||||
<toBlob>0x%s</toBlob>
|
||||
<toClob>'%s'</toClob>
|
||||
<toNClob>'%s'</toNClob>
|
||||
<embeddedLobSizeLimit>32000</embeddedLobSizeLimit>
|
||||
<binaryPattern>x'%s'</binaryPattern>
|
||||
<avoidLeftJoin>false</avoidLeftJoin>
|
||||
<useInlineViewsInDataBrowser>true</useInlineViewsInDataBrowser>
|
||||
<defaultSchemaQuery>Select DATABASE()</defaultSchemaQuery>
|
||||
<estimatedRowCountQuery>select TABLE_NAME, max(CARDINALITY) from INFORMATION_SCHEMA.STATISTICS where TABLE_SCHEMA = '%s' group by TABLE_NAME</estimatedRowCountQuery>
|
||||
<viewTextOrDDLQuery>SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = '%1$s' and TABLE_NAME = '%2$s'</viewTextOrDDLQuery>
|
||||
|
||||
<virtualColumnsQuery>SELECT TABLE_NAME, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = '${SCHEMA}' AND EXTRA LIKE '%VIRTUAL%'</virtualColumnsQuery>
|
||||
@@ -596,6 +789,215 @@ union all
|
||||
<procedureDetailNeedsSpecificName>true</procedureDetailNeedsSpecificName>
|
||||
<functionSourceQuery>SELECT 'Source', cast(ROUTINE_DEFINITION as varchar) FROM SYSIBM.ROUTINES where ROUTINE_SCHEMA = '%1$s' and SPECIFIC_NAME = '%2$s' and ROUTINE_DEFINITION is not null</functionSourceQuery>
|
||||
<procedureSourceQuery>SELECT 'Source', cast(ROUTINE_DEFINITION as varchar) FROM SYSIBM.ROUTINES where ROUTINE_SCHEMA = '%1$s' and SPECIFIC_NAME = '%2$s' and ROUTINE_DEFINITION is not null</procedureSourceQuery>
|
||||
|
||||
<explainCreateExplainTable>CALL SYSPROC.SYSINSTALLOBJECTS('EXPLAIN', 'C',CAST (NULL AS VARCHAR(128)), CAST (NULL AS VARCHAR(128)))</explainCreateExplainTable>
|
||||
<explainPrepare>explain plan for %1$s</explainPrepare>
|
||||
<explainQuery><![CDATA[
|
||||
WITH tree(operator_ID, level, path, explain_time, cycle)
|
||||
AS
|
||||
(
|
||||
SELECT 1 operator_id
|
||||
, 0 level
|
||||
, CAST('001' AS VARCHAR(1000)) path
|
||||
, max(explain_time) explain_time
|
||||
, 0
|
||||
FROM SYSTOOLS.EXPLAIN_OPERATOR O
|
||||
WHERE O.EXPLAIN_REQUESTER = SESSION_USER
|
||||
UNION ALL
|
||||
SELECT s.source_id
|
||||
, level + 1
|
||||
, tree.path || '/' || LPAD(CAST(s.source_id AS VARCHAR(3)), 3, '0') path
|
||||
, tree.explain_time
|
||||
, POSITION('/' || LPAD(CAST(s.source_id AS VARCHAR(3)), 3, '0') || '/' IN path USING OCTETS)
|
||||
FROM tree
|
||||
, SYSTOOLS.EXPLAIN_STREAM S
|
||||
WHERE s.target_id = tree.operator_id
|
||||
AND s.explain_time = tree.explain_time
|
||||
AND S.Object_Name IS NULL
|
||||
AND S.explain_requester = SESSION_USER
|
||||
AND tree.cycle = 0
|
||||
AND level < 100
|
||||
)
|
||||
SELECT *
|
||||
FROM (
|
||||
SELECT "Explain Plan"
|
||||
FROM (
|
||||
SELECT CAST( LPAD(id, MAX(LENGTH(id)) OVER(), ' ')
|
||||
|| ' | '
|
||||
|| RPAD(operation, MAX(LENGTH(operation)) OVER(), ' ')
|
||||
|| ' | '
|
||||
|| LPAD(rows, MAX(LENGTH(rows)) OVER(), ' ')
|
||||
|| ' | '
|
||||
-- Don't show ActualRows columns if there are no actuals available at all
|
||||
|| CASE WHEN COUNT(ActualRows) OVER () > 1 -- the heading 'ActualRows' is always present, so "1" means no OTHER values
|
||||
THEN LPAD(ActualRows, MAX(LENGTH(ActualRows)) OVER(), ' ') || ' | '
|
||||
ELSE ''
|
||||
END
|
||||
|| LPAD(cost, MAX(LENGTH(cost)) OVER(), ' ')
|
||||
AS VARCHAR(100)) "Explain Plan"
|
||||
, path
|
||||
FROM (
|
||||
SELECT 'ID' ID
|
||||
, 'Operation' Operation
|
||||
, 'Rows' Rows
|
||||
, 'ActualRows' ActualRows
|
||||
, 'Cost' Cost
|
||||
, '0' Path
|
||||
FROM SYSIBM.SYSDUMMY1
|
||||
-- TODO: UNION ALL yields duplicate. where do they come from?
|
||||
UNION
|
||||
SELECT CAST(tree.operator_id as VARCHAR(254)) ID
|
||||
, CAST(LPAD(' ', tree.level, ' ')
|
||||
|| CASE WHEN tree.cycle = 1
|
||||
THEN '(cycle) '
|
||||
ELSE ''
|
||||
END
|
||||
|| COALESCE (
|
||||
TRIM(O.Operator_Type)
|
||||
|| COALESCE(' (' || argument || ')', '')
|
||||
|| ' '
|
||||
|| COALESCE(S.Object_Name,'')
|
||||
, ''
|
||||
)
|
||||
AS VARCHAR(254)) AS OPERATION
|
||||
, COALESCE(CAST(rows AS VARCHAR(254)), '') Rows
|
||||
, CAST(ActualRows as VARCHAR(254)) ActualRows -- note: no coalesce
|
||||
, COALESCE(CAST(CAST(O.Total_Cost AS BIGINT) AS VARCHAR(254)), '') Cost
|
||||
, path
|
||||
FROM tree
|
||||
LEFT JOIN ( SELECT i.source_id
|
||||
, i.target_id
|
||||
, CAST(CAST(ROUND(o.stream_count) AS BIGINT) AS VARCHAR(12))
|
||||
|| ' of '
|
||||
|| CAST (total_rows AS VARCHAR(12))
|
||||
|| CASE WHEN total_rows > 0
|
||||
AND ROUND(o.stream_count) <= total_rows THEN
|
||||
' ('
|
||||
|| LPAD(CAST (ROUND(ROUND(o.stream_count)/total_rows*100,2)
|
||||
AS NUMERIC(5,2)), 6, ' ')
|
||||
|| '%%)'
|
||||
ELSE ''
|
||||
END rows
|
||||
, CASE WHEN act.actual_value is not null then
|
||||
CAST(CAST(ROUND(act.actual_value) AS BIGINT) AS VARCHAR(12))
|
||||
|| ' of '
|
||||
|| CAST (total_rows AS VARCHAR(12))
|
||||
|| CASE WHEN total_rows > 0 THEN
|
||||
' ('
|
||||
|| LPAD(CAST (ROUND(ROUND(act.actual_value)/total_rows*100,2)
|
||||
AS NUMERIC(5,2)), 6, ' ')
|
||||
|| '%%)'
|
||||
ELSE NULL
|
||||
END END ActualRows
|
||||
, i.object_name
|
||||
, i.explain_time
|
||||
FROM (SELECT MAX(source_id) source_id
|
||||
, target_id
|
||||
, MIN(CAST(ROUND(stream_count,0) AS BIGINT)) total_rows
|
||||
, CAST(LISTAGG(object_name) AS VARCHAR(50)) object_name
|
||||
, explain_time
|
||||
FROM SYSTOOLS.EXPLAIN_STREAM
|
||||
WHERE explain_time = (SELECT MAX(explain_time)
|
||||
FROM SYSTOOLS.EXPLAIN_OPERATOR
|
||||
WHERE EXPLAIN_REQUESTER = SESSION_USER
|
||||
)
|
||||
GROUP BY target_id, explain_time
|
||||
) I
|
||||
LEFT JOIN SYSTOOLS.EXPLAIN_STREAM O
|
||||
ON ( I.target_id=o.source_id
|
||||
AND I.explain_time = o.explain_time
|
||||
AND O.EXPLAIN_REQUESTER = SESSION_USER
|
||||
)
|
||||
LEFT JOIN SYSTOOLS.EXPLAIN_ACTUALS act
|
||||
ON ( act.operator_id = i.target_id
|
||||
AND act.explain_time = i.explain_time
|
||||
AND act.explain_requester = SESSION_USER
|
||||
AND act.ACTUAL_TYPE like 'CARDINALITY%%'
|
||||
)
|
||||
) s
|
||||
ON ( s.target_id = tree.operator_id
|
||||
AND s.explain_time = tree.explain_time
|
||||
)
|
||||
LEFT JOIN SYSTOOLS.EXPLAIN_OPERATOR O
|
||||
ON ( o.operator_id = tree.operator_id
|
||||
AND o.explain_time = tree.explain_time
|
||||
AND o.explain_requester = SESSION_USER
|
||||
)
|
||||
LEFT JOIN (SELECT LISTAGG (CASE argument_type
|
||||
WHEN 'UNIQUE' THEN
|
||||
CASE WHEN argument_value = 'TRUE'
|
||||
THEN 'UNIQUE'
|
||||
ELSE NULL
|
||||
END
|
||||
WHEN 'TRUNCSRT' THEN
|
||||
CASE WHEN argument_value = 'TRUE'
|
||||
THEN 'TOP-N'
|
||||
ELSE NULL
|
||||
END
|
||||
WHEN 'SCANDIR' THEN
|
||||
CASE WHEN argument_value != 'FORWARD'
|
||||
THEN argument_value
|
||||
ELSE NULL
|
||||
END
|
||||
ELSE argument_value
|
||||
END
|
||||
, ' ') argument
|
||||
, operator_id
|
||||
, explain_time
|
||||
FROM SYSTOOLS.EXPLAIN_ARGUMENT EA
|
||||
WHERE argument_type IN ('AGGMODE' -- GRPBY
|
||||
, 'UNIQUE', 'TRUNCSRT' -- SORT
|
||||
, 'SCANDIR' -- IXSCAN, TBSCAN
|
||||
, 'OUTERJN' -- JOINs
|
||||
)
|
||||
AND explain_requester = SESSION_USER
|
||||
GROUP BY explain_time, operator_id
|
||||
) A
|
||||
ON ( a.operator_id = tree.operator_id
|
||||
AND a.explain_time = tree.explain_time
|
||||
)
|
||||
) O
|
||||
UNION ALL
|
||||
VALUES ('', 'A')
|
||||
, ('', 'Y')
|
||||
UNION ALL
|
||||
SELECT CAST (LPAD(CASE WHEN operator_id = LAG (operator_id)
|
||||
OVER (PARTITION BY operator_id
|
||||
ORDER BY pred_order
|
||||
)
|
||||
THEN ''
|
||||
ELSE operator_id || ' - '
|
||||
END
|
||||
, MAX(LENGTH(operator_id )+4) OVER()
|
||||
, ' ')
|
||||
|| how_applied
|
||||
|| ' '
|
||||
|| predicate_text
|
||||
AS VARCHAR(100)) "Predicate Information"
|
||||
, 'P' || LPAD(id_order, 5, '0') || pred_order path
|
||||
FROM (SELECT CAST(operator_id AS VARCHAR(254)) operator_id
|
||||
, LPAD(trim(how_applied)
|
||||
, MAX (LENGTH(TRIM(how_applied)))
|
||||
OVER (PARTITION BY operator_id)
|
||||
, ' '
|
||||
) how_applied
|
||||
, CAST(substr(predicate_text, 1, 80) AS VARCHAR(80)) predicate_text
|
||||
, CASE how_applied WHEN 'START' THEN '1'
|
||||
WHEN 'STOP' THEN '2'
|
||||
WHEN 'SARG' THEN '3'
|
||||
ELSE '9'
|
||||
END pred_order
|
||||
, operator_id id_order
|
||||
FROM systools.explain_predicate p
|
||||
WHERE explain_time = (SELECT MAX(explain_time)
|
||||
FROM systools.explain_operator)
|
||||
)
|
||||
)
|
||||
ORDER BY path
|
||||
)]]>
|
||||
</explainQuery>
|
||||
<explainCleanup></explainCleanup>
|
||||
|
||||
<constraintsQuery>
|
||||
Select CNAME, TNAME, COLNAME, CTYPE, DETAIL From
|
||||
(
|
||||
@@ -769,7 +1171,7 @@ Select CNAME, TNAME, COLNAME, CTYPE, DETAIL From
|
||||
<dbms>
|
||||
<id>POSTGRESQL</id>
|
||||
<displayName>PostgreSQL</displayName>
|
||||
<urlPattern>jdbc:postgres.*|jdbc:redshift.*</urlPattern>
|
||||
<urlPattern>jdbc:postgres.*</urlPattern>
|
||||
<sqlDialect>
|
||||
<needsValuesKeywordForDeletes>true</needsValuesKeywordForDeletes>
|
||||
<supportsInClauseForDeletes>true</supportsInClauseForDeletes>
|
||||
@@ -915,7 +1317,158 @@ union all
|
||||
<listQuery>select sequence_name, sequence_schema, sequence_catalog, data_type, numeric_precision, numeric_precision_radix, numeric_scale, start_value, minimum_value, maximum_value, increment, cycle_option from information_schema.sequences where sequence_schema = '%1$s'</listQuery>
|
||||
</objectRenderers>
|
||||
</dbms>
|
||||
|
||||
|
||||
<!-- for Amazon Redshift -->
|
||||
<dbms>
|
||||
<id>Redshift</id>
|
||||
<displayName>Redshift</displayName>
|
||||
<urlPattern>jdbc:redshift.*</urlPattern>
|
||||
<sqlDialect>
|
||||
<needsValuesKeywordForDeletes>true</needsValuesKeywordForDeletes>
|
||||
<supportsInClauseForDeletes>true</supportsInClauseForDeletes>
|
||||
<supportsMultiRowInserts>true</supportsMultiRowInserts>
|
||||
<upsertMode>DB2</upsertMode>
|
||||
</sqlDialect>
|
||||
<statisticRenovator>
|
||||
<scriptFileName>script/postgres/update_statistics.sql</scriptFileName>
|
||||
</statisticRenovator>
|
||||
<typeReplacement>
|
||||
<entry>
|
||||
<key>DOUBLE</key>
|
||||
<value>DOUBLE PRECISION</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>double</key>
|
||||
<value>double precision</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>bigserial</key>
|
||||
<value>int8</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>serial8</key>
|
||||
<value>int8</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>serial</key>
|
||||
<value>int4</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>serial4</key>
|
||||
<value>int4</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>NVARCHAR</key>
|
||||
<value>VARCHAR</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>nvarchar</key>
|
||||
<value>varchar</value>
|
||||
</entry>
|
||||
</typeReplacement>
|
||||
<sqlLimitSuffix>LIMIT %s</sqlLimitSuffix>
|
||||
<fetchSize>1000</fetchSize>
|
||||
|
||||
<!-- NOLOGGING, TABLESPACE-spec., etc. -->
|
||||
<tableProperties></tableProperties>
|
||||
|
||||
<sessionTemporaryTableManager>
|
||||
<createIndexPrefix>CREATE INDEX </createIndexPrefix>
|
||||
<createIndexSuffix></createIndexSuffix>
|
||||
<createTablePrefix>CREATE TEMPORARY TABLE </createTablePrefix>
|
||||
<createTableSuffix></createTableSuffix>
|
||||
<dropTablePrefix>-- DROP TABLE </dropTablePrefix>
|
||||
<indexTablePrefix></indexTablePrefix>
|
||||
</sessionTemporaryTableManager>
|
||||
<identityInserts>false</identityInserts>
|
||||
<datePattern>''yyyy-MM-dd'''::date'</datePattern>
|
||||
<timestampPattern>'to_timestamp('''yyyy-MM-dd HH.mm.ss'.${NANO}'', ''YYYY-MM-DD HH24.MI.SS.US'')'</timestampPattern>
|
||||
<embeddedLobSizeLimit>3980</embeddedLobSizeLimit>
|
||||
<binaryPattern>E'\\x%s'</binaryPattern>
|
||||
<avoidLeftJoin>false</avoidLeftJoin>
|
||||
<supportsSchemasInIndexDefinitions>false</supportsSchemasInIndexDefinitions>
|
||||
<useInlineViewsInDataBrowser>true</useInlineViewsInDataBrowser>
|
||||
<identifierQuoteString>"</identifierQuoteString>
|
||||
<viewTextOrDDLQuery>SELECT VIEW_DEFINITION FROM INFORMATION_SCHEMA.VIEWS WHERE TABLE_SCHEMA = '%1$s' and TABLE_NAME = '%2$s'</viewTextOrDDLQuery>
|
||||
<estimatedRowCountQuery>
|
||||
SELECT c.relname, c.reltuples::bigint AS estimate
|
||||
FROM pg_class c
|
||||
JOIN pg_namespace n ON n.oid = c.relnamespace
|
||||
WHERE n.nspname = '%s'
|
||||
</estimatedRowCountQuery>
|
||||
<explainPrepare></explainPrepare>
|
||||
<explainQuery>explain %1$s</explainQuery>
|
||||
<explainCleanup></explainCleanup>
|
||||
<functionSourceQuery>
|
||||
SELECT 'Function', p.proname || '(' || pg_catalog.pg_get_function_arguments(p.oid) || ') RETURNS ' || pg_catalog.pg_get_function_result(p.oid)
|
||||
FROM pg_catalog.pg_proc p
|
||||
LEFT JOIN pg_catalog.pg_namespace n ON n.oid = p.pronamespace
|
||||
WHERE p.proname = '%2$s' AND n.nspname = '%1$s'
|
||||
</functionSourceQuery>
|
||||
<constraintsQuery>
|
||||
Select CNAME, TNAME, COLNAME, CTYPE, DETAIL From
|
||||
(
|
||||
Select KCU.CONSTRAINT_NAME CNAME, KCU.TABLE_NAME TNAME, KCU.COLUMN_NAME COLNAME, 'PK' CTYPE, null DETAIL, KCU.ORDINAL_POSITION POS, 1 TYPEPOS
|
||||
From
|
||||
INFORMATION_SCHEMA.TABLE_CONSTRAINTS C
|
||||
join
|
||||
INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU
|
||||
ON KCU.CONSTRAINT_CATALOG = C.CONSTRAINT_CATALOG
|
||||
AND KCU.CONSTRAINT_SCHEMA = C.CONSTRAINT_SCHEMA
|
||||
AND KCU.TABLE_NAME = C.TABLE_NAME
|
||||
AND KCU.CONSTRAINT_NAME = C.CONSTRAINT_NAME
|
||||
where
|
||||
C.CONSTRAINT_TYPE = 'PRIMARY KEY'
|
||||
AND KCU.TABLE_SCHEMA = '%1$s'
|
||||
union all
|
||||
Select C.CONSTRAINT_NAME CNAME, KCU.TABLE_NAME TNAME, KCU.COLUMN_NAME COLNAME, 'Unique' CTYPE, null DETAIL, KCU.ORDINAL_POSITION POS, 2 TYPEPOS
|
||||
From
|
||||
INFORMATION_SCHEMA.TABLE_CONSTRAINTS C
|
||||
join
|
||||
INFORMATION_SCHEMA.KEY_COLUMN_USAGE KCU
|
||||
ON KCU.CONSTRAINT_CATALOG = C.CONSTRAINT_CATALOG
|
||||
AND KCU.CONSTRAINT_SCHEMA = C.CONSTRAINT_SCHEMA
|
||||
AND KCU.TABLE_NAME = C.TABLE_NAME
|
||||
AND KCU.CONSTRAINT_NAME = C.CONSTRAINT_NAME
|
||||
where
|
||||
C.CONSTRAINT_TYPE = 'UNIQUE'
|
||||
AND KCU.TABLE_SCHEMA = '%1$s'
|
||||
union all
|
||||
Select C.CONSTRAINT_NAME CNAME, C.TABLE_NAME TNAME, CU.COLUMN_NAME COLNAME, 'Check' CTYPE, CHECK_CLAUSE DETAIL, 1 POS, 3 TYPEPOS
|
||||
From
|
||||
INFORMATION_SCHEMA.CHECK_CONSTRAINTS CC
|
||||
join
|
||||
INFORMATION_SCHEMA.CONSTRAINT_COLUMN_USAGE CU
|
||||
on CU.CONSTRAINT_CATALOG = CC.CONSTRAINT_CATALOG
|
||||
and CU.CONSTRAINT_SCHEMA = CC.CONSTRAINT_SCHEMA
|
||||
and CU.CONSTRAINT_NAME = CC.CONSTRAINT_NAME
|
||||
join
|
||||
INFORMATION_SCHEMA.TABLE_CONSTRAINTS C
|
||||
on C.CONSTRAINT_CATALOG = CC.CONSTRAINT_CATALOG
|
||||
and C.CONSTRAINT_SCHEMA = CC.CONSTRAINT_SCHEMA
|
||||
and C.CONSTRAINT_NAME = CC.CONSTRAINT_NAME
|
||||
and C.CONSTRAINT_TYPE = 'CHECK'
|
||||
and C.TABLE_SCHEMA = '%1$s'
|
||||
) pk order by TYPEPOS, CNAME, TNAME, POS, COLNAME
|
||||
</constraintsQuery>
|
||||
<objectRenderers>
|
||||
<name>Triggers</name>
|
||||
<iconURL>/net/sf/jailer/ui/resource/triggers.png</iconURL>
|
||||
<itemDescription>
|
||||
<iconURL>/net/sf/jailer/ui/resource/trigger.png</iconURL>
|
||||
</itemDescription>
|
||||
<listQuery>select trigger_name, event_manipulation,event_object_catalog,event_object_schema,event_object_table,action_order,action_condition,action_statement,action_orientation,action_timing,action_reference_old_table,action_reference_new_table,action_reference_old_row,action_reference_new_row,created FROM information_schema.triggers where trigger_schema = '%1$s'</listQuery>
|
||||
</objectRenderers>
|
||||
<objectRenderers>
|
||||
<name>Sequences</name>
|
||||
<iconURL>/net/sf/jailer/ui/resource/sequences.png</iconURL>
|
||||
<itemDescription>
|
||||
<iconURL>/net/sf/jailer/ui/resource/sequence.png</iconURL>
|
||||
</itemDescription>
|
||||
<listQuery>select sequence_name, sequence_schema, sequence_catalog, data_type, numeric_precision, numeric_precision_radix, numeric_scale, start_value, minimum_value, maximum_value, increment, cycle_option from information_schema.sequences where sequence_schema = '%1$s'</listQuery>
|
||||
</objectRenderers>
|
||||
</dbms>
|
||||
|
||||
<!-- for Cloudscape -->
|
||||
<dbms>
|
||||
<id>CLOADSCAPE</id>
|
||||
|
||||
@@ -17,6 +17,7 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.SQLFeatureNotSupportedException;
|
||||
import java.sql.Statement;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
@@ -33,6 +34,7 @@ import javax.sql.DataSource;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import net.sf.jailer.configuration.Configuration;
|
||||
import net.sf.jailer.configuration.Configuration.UrlRewriteRule;
|
||||
import net.sf.jailer.configuration.DBMS;
|
||||
|
||||
/**
|
||||
@@ -231,40 +233,53 @@ public class BasicDataSource implements DataSource {
|
||||
return perUrl.get(dbUrl);
|
||||
}
|
||||
DBMS defaultDBMS = DBMS.forDBMS(null);
|
||||
List<DBMS> cs = Configuration.getInstance().getDBMS();
|
||||
for (DBMS c: cs) {
|
||||
if (Pattern.matches(c.getUrlPattern(), dbUrl)) {
|
||||
boolean ok = true;
|
||||
if (c.getTestQuery() != null) {
|
||||
Connection connection = null;
|
||||
Statement st = null;
|
||||
try {
|
||||
connection = getConnection(defaultDBMS, false);
|
||||
st = connection.createStatement();
|
||||
ResultSet rs = st.executeQuery(c.getTestQuery());
|
||||
while (rs.next()) {
|
||||
}
|
||||
rs.close();
|
||||
} catch (SQLException e) {
|
||||
ok = false;
|
||||
} finally {
|
||||
if (st != null) {
|
||||
try {
|
||||
st.close();
|
||||
} catch (SQLException e) {
|
||||
List<DBMS> cs = Configuration.getInstance().getDBMS();
|
||||
List<String> rwUrls = new ArrayList<String>();
|
||||
rwUrls.add(dbUrl);
|
||||
List<UrlRewriteRule> urlRewriteRules = Configuration.getInstance().getUrlRewriteRules();
|
||||
if (urlRewriteRules != null) {
|
||||
for (UrlRewriteRule rule: urlRewriteRules) {
|
||||
String rwUrl = dbUrl.replaceAll(rule.getPattern(), rule.getReplacement());
|
||||
if (!rwUrl.equals(dbUrl)) {
|
||||
rwUrls.add(rwUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String rwUrl: rwUrls) {
|
||||
for (DBMS c: cs) {
|
||||
if (Pattern.matches(c.getUrlPattern(), rwUrl)) {
|
||||
boolean ok = true;
|
||||
if (c.getTestQuery() != null) {
|
||||
Connection connection = null;
|
||||
Statement st = null;
|
||||
try {
|
||||
connection = getConnection(defaultDBMS, false);
|
||||
st = connection.createStatement();
|
||||
ResultSet rs = st.executeQuery(c.getTestQuery());
|
||||
while (rs.next()) {
|
||||
}
|
||||
}
|
||||
if (connection != null) {
|
||||
try {
|
||||
connection.close();
|
||||
} catch (SQLException e) {
|
||||
rs.close();
|
||||
} catch (SQLException e) {
|
||||
ok = false;
|
||||
} finally {
|
||||
if (st != null) {
|
||||
try {
|
||||
st.close();
|
||||
} catch (SQLException e) {
|
||||
}
|
||||
}
|
||||
if (connection != null) {
|
||||
try {
|
||||
connection.close();
|
||||
} catch (SQLException e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ok) {
|
||||
perUrl.put(dbUrl, c);
|
||||
return c;
|
||||
if (ok) {
|
||||
perUrl.put(dbUrl, c);
|
||||
return c;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -274,6 +289,34 @@ public class BasicDataSource implements DataSource {
|
||||
|
||||
private final List<Connection> pool = Collections.synchronizedList(new LinkedList<Connection>());
|
||||
|
||||
public static boolean findDBMSNeedsConnection(String dbUrl) {
|
||||
if (perUrl.containsKey(dbUrl)) {
|
||||
return false;
|
||||
}
|
||||
List<DBMS> cs = Configuration.getInstance().getDBMS();
|
||||
List<String> rwUrls = new ArrayList<String>();
|
||||
rwUrls.add(dbUrl);
|
||||
List<UrlRewriteRule> urlRewriteRules = Configuration.getInstance().getUrlRewriteRules();
|
||||
if (urlRewriteRules != null) {
|
||||
for (UrlRewriteRule rule: urlRewriteRules) {
|
||||
String rwUrl = dbUrl.replaceAll(rule.getPattern(), rule.getReplacement());
|
||||
if (!rwUrl.equals(dbUrl)) {
|
||||
rwUrls.add(rwUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String rwUrl: rwUrls) {
|
||||
for (DBMS c: cs) {
|
||||
if (Pattern.matches(c.getUrlPattern(), rwUrl)) {
|
||||
if (c.getTestQuery() != null) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new connection.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -44,7 +44,7 @@ public abstract class InlineViewBuilder implements Session.ResultSetReader {
|
||||
*/
|
||||
protected final String name;
|
||||
|
||||
private final StatementBuilder statementBuilder;
|
||||
protected final StatementBuilder statementBuilder;
|
||||
|
||||
protected ResultSetMetaData resultSetMetaData = null;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -104,6 +104,7 @@ public class PrimaryKeyValidator {
|
||||
});
|
||||
}
|
||||
jobManager.executeJobs(jobs);
|
||||
CancellationHandler.checkForCancellation(null);
|
||||
throwIfErrorFound();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -256,7 +256,11 @@ public class Session {
|
||||
public synchronized Connection getConnection() throws SQLException {
|
||||
@SuppressWarnings("resource")
|
||||
Connection con = local? connection.get() : temporaryTableSession == null? connection.get() : temporaryTableSession;
|
||||
|
||||
|
||||
if (con == null && Boolean.TRUE.equals(sharesConnection.get())) {
|
||||
con = defaultConnection;
|
||||
}
|
||||
|
||||
if (con == null) {
|
||||
try {
|
||||
con = dataSource.getConnection();
|
||||
@@ -319,13 +323,21 @@ public class Session {
|
||||
/**
|
||||
* Closes current connection and opens a new one.
|
||||
*/
|
||||
public void reconnect() throws SQLException {
|
||||
public void reconnect() {
|
||||
Connection con = connection.get();
|
||||
if (con != null) {
|
||||
if (temporaryTableScope == WorkingTableScope.TRANSACTION_LOCAL) {
|
||||
con.commit();
|
||||
try {
|
||||
con.commit();
|
||||
} catch (SQLException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
try {
|
||||
con.close();
|
||||
} catch (SQLException e) {
|
||||
// ignore
|
||||
}
|
||||
con.close();
|
||||
connection.set(null);
|
||||
if (con == temporaryTableSession) {
|
||||
temporaryTableSession = null;
|
||||
@@ -334,9 +346,17 @@ public class Session {
|
||||
}
|
||||
if (temporaryTableSession != null) {
|
||||
if (temporaryTableScope == WorkingTableScope.TRANSACTION_LOCAL) {
|
||||
temporaryTableSession.commit();
|
||||
try {
|
||||
temporaryTableSession.commit();
|
||||
} catch (SQLException e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
try {
|
||||
temporaryTableSession.close();
|
||||
} catch (SQLException e) {
|
||||
// ignore
|
||||
}
|
||||
temporaryTableSession.close();
|
||||
temporaryTableSession = null;
|
||||
}
|
||||
}
|
||||
@@ -408,6 +428,17 @@ public class Session {
|
||||
return schema;
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a SQL-Query (SELECT).
|
||||
*
|
||||
* @param sqlQuery the query in SQL
|
||||
* @param reader the reader for the result
|
||||
* @param withExplicitCommit if <code>true</code>, switch of autocommit and commit explicitly
|
||||
*/
|
||||
public long executeQuery(String sqlQuery, ResultSetReader reader, boolean withExplicitCommit) throws SQLException {
|
||||
return executeQuery(sqlQuery, reader, null, null, 0, withExplicitCommit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a SQL-Query (SELECT).
|
||||
*
|
||||
@@ -415,9 +446,23 @@ public class Session {
|
||||
* @param reader the reader for the result
|
||||
*/
|
||||
public long executeQuery(String sqlQuery, ResultSetReader reader) throws SQLException {
|
||||
return executeQuery(sqlQuery, reader, null, null, 0);
|
||||
return executeQuery(sqlQuery, reader, null, null, 0, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a SQL-Query (SELECT).
|
||||
*
|
||||
* @param sqlQuery the query in SQL
|
||||
* @param reader the reader for the result
|
||||
* @param alternativeSQL query to be executed if sqlQuery fails
|
||||
* @param limit row limit, 0 for unlimited
|
||||
* @param context cancellation context
|
||||
* @param withExplicitCommit if <code>true</code>, switch of autocommit and commit explicitly
|
||||
*/
|
||||
public long executeQuery(String sqlQuery, ResultSetReader reader, String alternativeSQL, Object context, int limit, boolean withExplicitCommit) throws SQLException {
|
||||
return executeQuery(sqlQuery, reader, alternativeSQL, context, limit, 0, withExplicitCommit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes a SQL-Query (SELECT).
|
||||
*
|
||||
@@ -428,7 +473,7 @@ public class Session {
|
||||
* @param context cancellation context
|
||||
*/
|
||||
public long executeQuery(String sqlQuery, ResultSetReader reader, String alternativeSQL, Object context, int limit) throws SQLException {
|
||||
return executeQuery(sqlQuery, reader, alternativeSQL, context, limit, 0);
|
||||
return executeQuery(sqlQuery, reader, alternativeSQL, context, limit, 0, false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -441,8 +486,26 @@ public class Session {
|
||||
* @param limit row limit, 0 for unlimited
|
||||
* @param context cancellation context
|
||||
* @param timeout the timeout in sec
|
||||
* @param withExplicitCommit if <code>true</code>, switch of autocommit and commit explicitly
|
||||
*/
|
||||
private long executeQuery(Connection theConnection, String sqlQuery, ResultSetReader reader, String alternativeSQL, Object context, int limit, int timeout) throws SQLException {
|
||||
private long executeQuery(Connection theConnection, String sqlQuery, ResultSetReader reader, String alternativeSQL, Object context, int limit, int timeout, boolean withExplicitCommit) throws SQLException {
|
||||
if (withExplicitCommit) {
|
||||
synchronized (theConnection) {
|
||||
if (theConnection.getAutoCommit()) {
|
||||
try {
|
||||
theConnection.setAutoCommit(false);
|
||||
return executeQuery(theConnection, sqlQuery, reader, alternativeSQL, context, limit, timeout, false);
|
||||
} finally {
|
||||
try {
|
||||
theConnection.commit();
|
||||
} catch (SQLException e) {
|
||||
_log.warn("commit failed", e);
|
||||
}
|
||||
theConnection.setAutoCommit(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
long rc = 0;
|
||||
CancellationHandler.checkForCancellation(context);
|
||||
long startTime = System.currentTimeMillis();
|
||||
@@ -511,13 +574,14 @@ public class Session {
|
||||
* @param limit row limit, 0 for unlimited
|
||||
* @param context cancellation context
|
||||
* @param timeout the timeout in sec
|
||||
* @param withExplicitCommit if <code>true</code>, switch of autocommit and commit explicitly
|
||||
*/
|
||||
public long executeQuery(String sqlQuery, ResultSetReader reader, String alternativeSQL, Object context, int limit, int timeout) throws SQLException {
|
||||
public long executeQuery(String sqlQuery, ResultSetReader reader, String alternativeSQL, Object context, int limit, int timeout, boolean withExplicitCommit) throws SQLException {
|
||||
if (getLogStatements()) {
|
||||
_log.info(sqlQuery);
|
||||
}
|
||||
try {
|
||||
return executeQuery(connectionFactory.getConnection(), sqlQuery, reader, alternativeSQL, context, limit, timeout);
|
||||
return executeQuery(connectionFactory.getConnection(), sqlQuery, reader, alternativeSQL, context, limit, timeout, withExplicitCommit);
|
||||
} catch (SQLException e) {
|
||||
CancellationHandler.checkForCancellation(context);
|
||||
if (!silent) {
|
||||
@@ -535,8 +599,9 @@ public class Session {
|
||||
*
|
||||
* @param sqlFile file containing a query in SQL
|
||||
* @param reader the reader for the result
|
||||
* @param withExplicitCommit if <code>true</code>, switch of autocommit and commit explicitly
|
||||
*/
|
||||
public void executeQuery(File sqlFile, ResultSetReader reader) throws SQLException {
|
||||
public void executeQuery(File sqlFile, ResultSetReader reader, boolean withExplicitCommit) throws SQLException {
|
||||
StringBuffer result = new StringBuffer();
|
||||
try {
|
||||
BufferedReader in = new BufferedReader(new FileReader(sqlFile));
|
||||
@@ -551,7 +616,7 @@ public class Session {
|
||||
throw new RuntimeException("Failed to load content of file", e);
|
||||
}
|
||||
|
||||
executeQuery(result.toString(), reader);
|
||||
executeQuery(result.toString(), reader, withExplicitCommit);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -879,9 +944,13 @@ public class Session {
|
||||
synchronized (this) {
|
||||
down = true;
|
||||
}
|
||||
_log.info("closing connection...");
|
||||
_log.info("closing connections... (" + connections.size() + ")");
|
||||
for (Connection con: connections) {
|
||||
con.close();
|
||||
try {
|
||||
con.close();
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
closeTemporaryTableSession();
|
||||
_log.info("connection closed");
|
||||
@@ -967,7 +1036,7 @@ public class Session {
|
||||
temporaryTableSession.close();
|
||||
}
|
||||
} catch(SQLException e) {
|
||||
_log.error("can't close connection", e);
|
||||
_log.warn("can't close connection", e);
|
||||
}
|
||||
temporaryTableSession = null;
|
||||
}
|
||||
@@ -1097,4 +1166,10 @@ public class Session {
|
||||
return true;
|
||||
}
|
||||
|
||||
private final static ThreadLocal<Boolean> sharesConnection = new ThreadLocal<Boolean>();
|
||||
|
||||
public static void setThreadSharesConnection() {
|
||||
sharesConnection.set(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -142,6 +142,13 @@ public class StatementBuilder {
|
||||
return body.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the items of the current statement.
|
||||
*/
|
||||
public List<String> getItems() {
|
||||
return body;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the maximal size of a body-list.
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -467,35 +467,35 @@ public class DataModel {
|
||||
} catch (Exception e) {
|
||||
// ignore
|
||||
}
|
||||
// order columns
|
||||
if (!columnOrderPrio.isEmpty()) {
|
||||
final Map<Column, ColumnOrderPriority> prio = new IdentityHashMap<>();
|
||||
String prefix = line.cells.get(0).trim().length() == 0? "" : (line.cells.get(0).trim() + ".");
|
||||
for (Column column: columns) {
|
||||
ColumnOrderPriority columnOrderPriority = columnOrderPrio.get(prefix + Quoting.normalizeIdentifier(column.name));
|
||||
if (columnOrderPriority == null) {
|
||||
columnOrderPriority = columnOrderPrio.get(Quoting.normalizeIdentifier(column.name));
|
||||
}
|
||||
prio.put(column, columnOrderPriority);
|
||||
}
|
||||
// order columns
|
||||
if (!columnOrderPrio.isEmpty()) {
|
||||
final Map<Column, ColumnOrderPriority> prio = new IdentityHashMap<>();
|
||||
String prefix = line.cells.get(0).trim().length() == 0? "" : (line.cells.get(0).trim() + ".");
|
||||
for (Column column: columns) {
|
||||
ColumnOrderPriority columnOrderPriority = columnOrderPrio.get(prefix + Quoting.normalizeIdentifier(column.name));
|
||||
if (columnOrderPriority == null) {
|
||||
columnOrderPriority = columnOrderPrio.get(Quoting.normalizeIdentifier(column.name));
|
||||
}
|
||||
Collections.sort(columns, new Comparator<Column>() {
|
||||
@Override
|
||||
public int compare(Column a, Column b) {
|
||||
ColumnOrderPriority prioA = prio.get(a);
|
||||
ColumnOrderPriority prioB = prio.get(b);
|
||||
if (prioA != prioB) {
|
||||
if (prioA == ColumnOrderPriority.HI) {
|
||||
return -1;
|
||||
} else if (prioA == ColumnOrderPriority.LO) {
|
||||
return 1;
|
||||
} else {
|
||||
return prioB == ColumnOrderPriority.HI? 1 : -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
prio.put(column, columnOrderPriority);
|
||||
}
|
||||
Collections.sort(columns, new Comparator<Column>() {
|
||||
@Override
|
||||
public int compare(Column a, Column b) {
|
||||
ColumnOrderPriority prioA = prio.get(a);
|
||||
ColumnOrderPriority prioB = prio.get(b);
|
||||
if (prioA != prioB) {
|
||||
if (prioA == ColumnOrderPriority.HI) {
|
||||
return -1;
|
||||
} else if (prioA == ColumnOrderPriority.LO) {
|
||||
return 1;
|
||||
} else {
|
||||
return prioB == ColumnOrderPriority.HI? 1 : -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
}
|
||||
Table table = tables.get(SqlUtil.mappedSchema(sourceSchemaMapping, line.cells.get(0)));
|
||||
if (table != null) {
|
||||
@@ -885,7 +885,7 @@ public class DataModel {
|
||||
private static final long serialVersionUID = 4523935351640139649L;
|
||||
public final Table table;
|
||||
public NoPrimaryKeyException(Table table, String message) {
|
||||
super("Table '" + table.getName() + "' " + message);
|
||||
super((table == null? "Subject table " : ("Table '" + table.getName() + "' ")) + message);
|
||||
this.table = table;
|
||||
}
|
||||
public NoPrimaryKeyException(Table table) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -205,7 +205,7 @@ public class PrimaryKeyFactory {
|
||||
toIgnore.add(table);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
executionContext.setUpkDomain(upkDomain);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -39,6 +39,7 @@ import net.sf.jailer.database.TemporaryTableManager;
|
||||
import net.sf.jailer.database.WorkingTableScope;
|
||||
import net.sf.jailer.datamodel.Column;
|
||||
import net.sf.jailer.datamodel.DataModel;
|
||||
import net.sf.jailer.datamodel.PrimaryKey;
|
||||
import net.sf.jailer.datamodel.RowIdSupport;
|
||||
import net.sf.jailer.util.PrintUtil;
|
||||
import net.sf.jailer.util.Quoting;
|
||||
@@ -143,13 +144,17 @@ public class DDLCreator {
|
||||
String template = "script" + File.separator + "ddl-template.sql";
|
||||
String contraint = pkColumnConstraint(session);
|
||||
Map<String, String> typeReplacement = targetDBMS(session).getTypeReplacement();
|
||||
String universalPrimaryKey = rowIdSupport.getUniversalPrimaryKey().toSQL(null, contraint, typeReplacement);
|
||||
PrimaryKey upk = rowIdSupport.getUniversalPrimaryKey();
|
||||
if (upk.getColumns().isEmpty()) {
|
||||
throw new DataModel.NoPrimaryKeyException(null);
|
||||
}
|
||||
String universalPrimaryKey = upk.toSQL(null, contraint, typeReplacement);
|
||||
Map<String, String> arguments = new HashMap<String, String>();
|
||||
arguments.put("upk", universalPrimaryKey);
|
||||
arguments.put("upk-hash", "" + ((universalPrimaryKey + targetDBMS(session).getTableProperties()).hashCode()));
|
||||
arguments.put("pre", rowIdSupport.getUniversalPrimaryKey().toSQL("PRE_", contraint, typeReplacement));
|
||||
arguments.put("from", rowIdSupport.getUniversalPrimaryKey().toSQL("FROM_", contraint, typeReplacement));
|
||||
arguments.put("to", rowIdSupport.getUniversalPrimaryKey().toSQL("TO_", contraint, typeReplacement));
|
||||
arguments.put("pre", upk.toSQL("PRE_", contraint, typeReplacement));
|
||||
arguments.put("from", upk.toSQL("FROM_", contraint, typeReplacement));
|
||||
arguments.put("to", upk.toSQL("TO_", contraint, typeReplacement));
|
||||
arguments.put("version", "" + JailerVersion.WORKING_TABLE_VERSION);
|
||||
arguments.put("constraint", contraint);
|
||||
|
||||
@@ -187,15 +192,15 @@ public class DDLCreator {
|
||||
Map<String, List<String>> listArguments = new HashMap<String, List<String>>();
|
||||
if (indexType == 0) {
|
||||
// full index
|
||||
listArguments.put("column-list", Collections.singletonList(", " + rowIdSupport.getUniversalPrimaryKey().columnList(null)));
|
||||
listArguments.put("column-list-from", Collections.singletonList(", " + rowIdSupport.getUniversalPrimaryKey().columnList("FROM_")));
|
||||
listArguments.put("column-list-to", Collections.singletonList(", " + rowIdSupport.getUniversalPrimaryKey().columnList("TO_")));
|
||||
listArguments.put("column-list", Collections.singletonList(", " + upk.columnList(null)));
|
||||
listArguments.put("column-list-from", Collections.singletonList(", " + upk.columnList("FROM_")));
|
||||
listArguments.put("column-list-to", Collections.singletonList(", " + upk.columnList("TO_")));
|
||||
} else if (indexType == 1) {
|
||||
// single column indexes
|
||||
List<String> cl = new ArrayList<String>();
|
||||
List<String> clFrom = new ArrayList<String>();
|
||||
List<String> clTo = new ArrayList<String>();
|
||||
for (Column c : rowIdSupport.getUniversalPrimaryKey().getColumns()) {
|
||||
for (Column c : upk.getColumns()) {
|
||||
cl.add(", " + c.name);
|
||||
clFrom.add(", FROM_" + c.name);
|
||||
clTo.add(", FROM_" + c.name);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -568,4 +568,19 @@ public abstract class EntityGraph {
|
||||
}
|
||||
}
|
||||
|
||||
protected void addExportedCount(long count) {
|
||||
Long cnt = (Long) getSession().getSessionProperty(EntityGraph.class, "ExportedCount");
|
||||
if (cnt == null) {
|
||||
cnt = count;
|
||||
} else {
|
||||
cnt += count;
|
||||
}
|
||||
getSession().setSessionProperty(EntityGraph.class, "ExportedCount", cnt);
|
||||
}
|
||||
|
||||
public long getExportedCount() {
|
||||
Long cnt = (Long) getSession().getSessionProperty(EntityGraph.class, "ExportedCount");
|
||||
return cnt == null? 0 : cnt;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -254,6 +254,7 @@ public class IntraDatabaseEntityGraph extends RemoteEntityGraph {
|
||||
}
|
||||
}
|
||||
executionContext.getProgressListenerRegistry().fireExported(table, rc);
|
||||
addExportedCount(rc);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -113,6 +113,15 @@ public class LocalEntityGraph extends EntityGraph {
|
||||
return new CellContentConverter(resultSetMetaData, localSession, localSession.dbms);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws SQLException {
|
||||
if (DBMS.POSTGRESQL.equals(remoteSession.dbms) && statementBuilder.size() == 1) {
|
||||
process("(Select " + statementBuilder.getItems().get(0) + " Union Select " + statementBuilder.getItems().get(0) + ") " + name);
|
||||
} else {
|
||||
super.close();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private abstract class LocalInlineViewBuilder extends InlineViewBuilder {
|
||||
@@ -747,6 +756,7 @@ public class LocalEntityGraph extends EntityGraph {
|
||||
orderBy,
|
||||
reader);
|
||||
executionContext.getProgressListenerRegistry().fireExported(table, rc);
|
||||
addExportedCount(rc);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -806,6 +816,7 @@ public class LocalEntityGraph extends EntityGraph {
|
||||
sqlQuery + orderBy,
|
||||
reader);
|
||||
executionContext.getProgressListenerRegistry().fireExported(table, rc);
|
||||
addExportedCount(rc);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -879,6 +890,7 @@ public class LocalEntityGraph extends EntityGraph {
|
||||
rc[0] += lrc;
|
||||
if (fireProgressEvents) {
|
||||
executionContext.getProgressListenerRegistry().fireExported(table, lrc);
|
||||
addExportedCount(lrc);
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -1077,7 +1089,7 @@ public class LocalEntityGraph extends EntityGraph {
|
||||
final int setId = getNextSetId();
|
||||
|
||||
final long[] rc = new long[1];
|
||||
|
||||
|
||||
String selectEB =
|
||||
"Select " + upkColumnList(association.destination, "EB", "") + " from " + dmlTableReference(ENTITY, localSession) + " EB " +
|
||||
"Where " + (deletedEntitiesAreMarked? "EB.birthday>=0 and " : "") +
|
||||
@@ -1088,12 +1100,14 @@ public class LocalEntityGraph extends EntityGraph {
|
||||
@Override
|
||||
protected void process(String inlineView) throws SQLException {
|
||||
|
||||
String sep = upkMatch(association.source).isEmpty()? "" : ", ";
|
||||
|
||||
String selectSource =
|
||||
"Select distinct " + upkColumnList(association.destination, "EB", "") + ", " + pkList(association.source, sourceAlias, "") + " from " + inlineView + " " +
|
||||
"Select distinct " + upkColumnList(association.destination, "EB", "") + sep + pkList(association.source, sourceAlias, "") + " from " + inlineView + " " +
|
||||
"join " + quoting.requote(association.destination.getName()) + " " + destAlias + " on "+ pkEqualsEntityID(association.destination, destAlias, "EB", "", false) + " " +
|
||||
"join " + quoting.requote(association.source.getName()) + " " + sourceAlias + " " + " on " + jc;
|
||||
|
||||
remoteSession.executeQuery(selectSource, new LocalInlineViewBuilder("EBA", upkColumnList(association.destination, null, "EB") + ", " + upkColumnList(association.source, "A"), true) {
|
||||
remoteSession.executeQuery(selectSource, new LocalInlineViewBuilder("EBA", upkColumnList(association.destination, null, "EB") + sep + upkColumnList(association.source, "A"), true) {
|
||||
|
||||
@Override
|
||||
protected void process(String inlineView) throws SQLException {
|
||||
@@ -1114,7 +1128,7 @@ public class LocalEntityGraph extends EntityGraph {
|
||||
"Select distinct " + setId + ", " + typeName(association.destination) + ", " + upkColumnList(association.destination, "EBA", "EB") +
|
||||
" from " + inlineView + (deletedEntitiesAreMarked? " join " : " left join ") + dmlTableReference(ENTITY, localSession) + " EA" +
|
||||
" on EA.r_entitygraph=" + graphID + " and EA.type=" + typeName(association.source) + "" +
|
||||
" and " + eBAEqualsEA +
|
||||
(eBAEqualsEA.length() > 0? " and " + eBAEqualsEA : "") +
|
||||
" Where " + (deletedEntitiesAreMarked? "EA.birthday=-1" : "EA.type is null");
|
||||
|
||||
String remove = "Insert into " + dmlTableReference(ENTITY_SET_ELEMENT, localSession) +
|
||||
@@ -1213,6 +1227,7 @@ public class LocalEntityGraph extends EntityGraph {
|
||||
}
|
||||
long rc = remoteSession.executeQuery(select, reader);
|
||||
executionContext.getProgressListenerRegistry().fireExported(table, rc);
|
||||
addExportedCount(rc);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -527,8 +527,9 @@ public class RemoteEntityGraph extends EntityGraph {
|
||||
pkEqualsEntityID(table, "T", "E") +
|
||||
" Where E.birthday=0 and E.r_entitygraph=" + graphID + " and E.type=" + typeName(table) + "" +
|
||||
orderBy,
|
||||
reader);
|
||||
reader, withExplicitCommit());
|
||||
executionContext.getProgressListenerRegistry().fireExported(table, rc);
|
||||
addExportedCount(rc);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -565,8 +566,9 @@ public class RemoteEntityGraph extends EntityGraph {
|
||||
long rc = session.executeQuery(
|
||||
sqlQuery + (orderByPK? orderBy : ""),
|
||||
reader,
|
||||
(!orderByPK? sqlQuery : null), null, 0);
|
||||
(!orderByPK? sqlQuery : null), null, 0, withExplicitCommit());
|
||||
executionContext.getProgressListenerRegistry().fireExported(table, rc);
|
||||
addExportedCount(rc);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -604,6 +606,7 @@ public class RemoteEntityGraph extends EntityGraph {
|
||||
Session.ResultSetReader reader = getTransformerFactory().create(table);
|
||||
long rc = readEntities(table, orderByPK, reader);
|
||||
executionContext.getProgressListenerRegistry().fireExported(table, rc);
|
||||
addExportedCount(rc);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -631,7 +634,7 @@ public class RemoteEntityGraph extends EntityGraph {
|
||||
String sqlQuery = "Select " + columnList + " From " + dmlTableReference(ENTITY, session) + " E join " + quoting.requote(table.getName()) + " T on " +
|
||||
pkEqualsEntityID(table, "T", "E") +
|
||||
" Where E.birthday>=0 and E.r_entitygraph=" + graphID + " and E.type=" + typeName(table) + "";
|
||||
return session.executeQuery(sqlQuery, reader);
|
||||
return session.executeQuery(sqlQuery, reader, withExplicitCommit());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -648,13 +651,17 @@ public class RemoteEntityGraph extends EntityGraph {
|
||||
if (orderByPK) {
|
||||
String sqlQueryWithOrderBy = sqlQuery +
|
||||
(orderByPK? " order by " + rowIdSupport.getPrimaryKey(table).columnList("T.", quoting) : "");
|
||||
rc = session.executeQuery(sqlQueryWithOrderBy, reader, sqlQuery, null, 0);
|
||||
rc = session.executeQuery(sqlQueryWithOrderBy, reader, sqlQuery, null, 0, withExplicitCommit());
|
||||
} else {
|
||||
rc = session.executeQuery(sqlQuery, reader);
|
||||
rc = session.executeQuery(sqlQuery, reader, withExplicitCommit());
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
private boolean withExplicitCommit() {
|
||||
return DBMS.POSTGRESQL.equals(session.dbms);
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates columns of a table.
|
||||
*
|
||||
@@ -919,8 +926,9 @@ public class RemoteEntityGraph extends EntityGraph {
|
||||
" and D.from_type=" + typeName(association.source) + " and assoc=" + association.getId() +
|
||||
" and D.r_entitygraph=" + graphID;
|
||||
}
|
||||
long rc = session.executeQuery(select, reader);
|
||||
long rc = session.executeQuery(select, reader, withExplicitCommit());
|
||||
executionContext.getProgressListenerRegistry().fireExported(table, rc);
|
||||
addExportedCount(rc);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -960,7 +968,7 @@ public class RemoteEntityGraph extends EntityGraph {
|
||||
" Where (traversed is null or traversed <> 1)" +
|
||||
" and D.from_type=" + typeName(table) + "" +
|
||||
" and D.r_entitygraph=" + graphID;
|
||||
session.executeQuery(select, reader);
|
||||
session.executeQuery(select, reader, withExplicitCommit());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -449,6 +449,10 @@ public class ExtractionModel {
|
||||
if (dmf.size() > 0) {
|
||||
return dmf.get(0).cells.get(0);
|
||||
}
|
||||
List<CsvFile.Line> csv = new CsvFile(new File(fileName), "export modus").getLines();
|
||||
if (csv.isEmpty()) {
|
||||
throw new RuntimeException(fileName + "' is not a valid Jailer extraction model");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
+12
-4
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -412,7 +412,12 @@ public class JDBCMetaDataBasedModelElementFinder implements ModelElementFinder {
|
||||
Map<String, Map<Integer, Column>> pkColumns = new HashMap<String, Map<Integer, Column>>();
|
||||
for (String tableName: tableNames) {
|
||||
Table tmp = new Table(tableName, null, false, false);
|
||||
resultSet = getPrimaryKeys(session, metaData, quoting.unquote(tmp.getOriginalSchema(quoting.quote(introspectionSchema))), quoting.unquote(tmp.getUnqualifiedName()), true);
|
||||
resultSet = null;
|
||||
try {
|
||||
resultSet = getPrimaryKeys(session, metaData, quoting.unquote(tmp.getOriginalSchema(quoting.quote(introspectionSchema))), quoting.unquote(tmp.getUnqualifiedName()), true);
|
||||
} catch (Exception e) {
|
||||
_log.warn("can't get PK for " + tableName, e);
|
||||
}
|
||||
Map<Integer, Column> pk = pkColumns.get(tableName);
|
||||
if (pk == null) {
|
||||
pk = new HashMap<Integer, Column>();
|
||||
@@ -420,7 +425,7 @@ public class JDBCMetaDataBasedModelElementFinder implements ModelElementFinder {
|
||||
}
|
||||
boolean hasPK = false;
|
||||
int nextKeySeq = 0;
|
||||
while (resultSet.next()) {
|
||||
while (resultSet != null && resultSet.next()) {
|
||||
hasPK = true;
|
||||
int keySeq = resultSet.getInt(5);
|
||||
if (DBMS.SQLITE.equals(session.dbms)) {
|
||||
@@ -434,7 +439,9 @@ public class JDBCMetaDataBasedModelElementFinder implements ModelElementFinder {
|
||||
hasPK = findUniqueIndexBasedKey(metaData, quoting, session, tmp, pk, tableTypes.get(tableName));
|
||||
}
|
||||
_log.info((hasPK? "" : "no ") + "primary key found for table " + tableName);
|
||||
resultSet.close();
|
||||
if (resultSet != null) {
|
||||
resultSet.close();
|
||||
}
|
||||
CancellationHandler.checkForCancellation(null);
|
||||
}
|
||||
for (String tableName: tableNames) {
|
||||
@@ -1478,3 +1485,4 @@ public class JDBCMetaDataBasedModelElementFinder implements ModelElementFinder {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -143,8 +143,9 @@ public class MemorizedResultSet implements ResultSet {
|
||||
Object c;
|
||||
if (columnIndex > row.length) {
|
||||
c = null;
|
||||
} else {
|
||||
c = row[columnIndex - 1];
|
||||
}
|
||||
c = row[columnIndex - 1];
|
||||
wasNull = c == null;
|
||||
return c;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -174,7 +174,7 @@ public class MetaDataCache {
|
||||
|
||||
while (rs.next()) {
|
||||
Object[] row = new Object[numCol];
|
||||
for (int i = 1; i < numCol; ++i) {
|
||||
for (int i = 1; i <= numCol; ++i) {
|
||||
if (i >= 22 && DBMS.MSSQL.equals(session.dbms)) {
|
||||
row[i - 1] = null;
|
||||
} else {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -47,6 +47,7 @@ import net.sf.jailer.datamodel.Table;
|
||||
import net.sf.jailer.importfilter.ImportFilterManager;
|
||||
import net.sf.jailer.util.CsvFile;
|
||||
import net.sf.jailer.util.CsvFile.Line;
|
||||
import net.sf.jailer.util.PrintUtil;
|
||||
import net.sf.jailer.util.Quoting;
|
||||
import net.sf.jailer.util.SqlUtil;
|
||||
|
||||
@@ -154,11 +155,11 @@ public class ModelBuilder {
|
||||
for (Line line: source.getLines()) {
|
||||
String key = line.cells.get(keyColumn);
|
||||
destLines.remove(key);
|
||||
result.append(line.toString() + "\n");
|
||||
result.append(line.toString() + PrintUtil.LINE_SEPARATOR);
|
||||
}
|
||||
|
||||
for (Line line: destLines.values()) {
|
||||
result.append(line.toString() + "\n");
|
||||
result.append(line.toString() + PrintUtil.LINE_SEPARATOR);
|
||||
}
|
||||
|
||||
writeFile(destFile, header + result.toString());
|
||||
@@ -210,7 +211,11 @@ public class ModelBuilder {
|
||||
|
||||
StringBuilder columnsDefinition = new StringBuilder();
|
||||
CsvFile excludeTablesCSV = getExcludeTablesCSV(executionContext);
|
||||
Map<String, Table> allTablesSet = new TreeMap<String, Table>();
|
||||
for (Table table: allTables) {
|
||||
allTablesSet.put(table.getName(), table);
|
||||
}
|
||||
for (Table table: allTablesSet.values()) {
|
||||
if (!isJailerTable(table, quoting) &&
|
||||
!excludeTablesCSV.contains(new String[] { table.getName()}) &&
|
||||
!excludeTablesCSV.contains(new String[] { table.getName().toUpperCase() })) {
|
||||
@@ -223,7 +228,7 @@ public class ModelBuilder {
|
||||
columnsDefinition.append(CsvFile.encodeCell(c.toSQL(null) + (c.isIdentityColumn? " identity" : "") + (c.isVirtual? " virtual" : "") + (c.isNullable? " null" : "")) + "; ");
|
||||
knownIdentifiers.putColumnName(table.getName(), c.name);
|
||||
}
|
||||
columnsDefinition.append("\n");
|
||||
columnsDefinition.append(PrintUtil.LINE_SEPARATOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -256,7 +261,7 @@ public class ModelBuilder {
|
||||
|
||||
String warning = "Table '" + table.getName() + "' has no primary key";
|
||||
if (table.primaryKey.getColumns().size() == 0) {
|
||||
warnings.append(warning + "\n");
|
||||
warnings.append(warning + PrintUtil.LINE_SEPARATOR);
|
||||
} else {
|
||||
warning += ", taking manually defined key.";
|
||||
}
|
||||
@@ -266,7 +271,7 @@ public class ModelBuilder {
|
||||
for (Column pk: table.primaryKey.getColumns()) {
|
||||
tableDefinitions += CsvFile.encodeCell(pk.toString()) + ";";
|
||||
}
|
||||
tableDefinitions += " ;" + CsvFile.encodeCell(table.getAuthor()) + ";\n";
|
||||
tableDefinitions += " ;" + CsvFile.encodeCell(table.getAuthor()) + ";" + PrintUtil.LINE_SEPARATOR;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -306,7 +311,6 @@ public class ModelBuilder {
|
||||
}
|
||||
}
|
||||
|
||||
String associationDefinition = "";
|
||||
Set<String> names = new HashSet<String>();
|
||||
for (Table table: dataModel.getTables()) {
|
||||
for (Association association: table.associations) {
|
||||
@@ -315,6 +319,9 @@ public class ModelBuilder {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, String> assocLines = new TreeMap<String, String>();
|
||||
|
||||
for (Association association: associationsToWrite) {
|
||||
String firstInsert = " ";
|
||||
if (association.isInsertSourceBeforeDestination()) {
|
||||
@@ -350,15 +357,19 @@ public class ModelBuilder {
|
||||
}
|
||||
}
|
||||
names.add(name);
|
||||
associationDefinition += CsvFile.encodeCell(association.source.getName()) + "; " + CsvFile.encodeCell(association.destination.getName()) + "; " + firstInsert + "; " + card + "; " + CsvFile.encodeCell(association.getJoinCondition()) +
|
||||
"; " + CsvFile.encodeCell(name) + "; " + CsvFile.encodeCell(association.getAuthor()) + ";\n";
|
||||
assocLines.put(name, CsvFile.encodeCell(association.source.getName()) + "; " + CsvFile.encodeCell(association.destination.getName()) + "; " + firstInsert + "; " + card + "; " + CsvFile.encodeCell(association.getJoinCondition()) +
|
||||
"; " + CsvFile.encodeCell(name) + "; " + CsvFile.encodeCell(association.getAuthor()));
|
||||
}
|
||||
|
||||
resetAssociationFile(associationDefinition, executionContext);
|
||||
StringBuilder associationDefinition = new StringBuilder();
|
||||
for (String line: assocLines.values()) {
|
||||
associationDefinition.append(line + PrintUtil.LINE_SEPARATOR);
|
||||
}
|
||||
|
||||
resetAssociationFile(associationDefinition.toString(), executionContext);
|
||||
}
|
||||
|
||||
private static String ASSOC_HEADER = "# generated by Jailer\n\n" +
|
||||
"# Table A; Table B; first-insert; cardinality (opt); join-condition; name; author\n";
|
||||
private static String ASSOC_HEADER = "# Table A; Table B; First-insert; Cardinality (opt); Join-condition; Name; Author" + PrintUtil.LINE_SEPARATOR;
|
||||
|
||||
private static void resetAssociationFile(String associationDefinition, ExecutionContext executionContext) throws IOException {
|
||||
writeFile(getModelBuilderAssociationsFilename(executionContext),
|
||||
@@ -366,8 +377,7 @@ public class ModelBuilder {
|
||||
associationDefinition);
|
||||
}
|
||||
|
||||
private static String TABLE_HEADER = "# generated by Jailer\n\n" +
|
||||
"# Name; upsert; primary key; ; author\n";
|
||||
private static String TABLE_HEADER = "# Name; Upsert; Primary Key; ; Author" + PrintUtil.LINE_SEPARATOR;
|
||||
|
||||
private static void resetTableFile(String tableDefinitions, ExecutionContext executionContext) throws IOException {
|
||||
writeFile(getModelBuilderTablesFilename(executionContext),
|
||||
@@ -375,8 +385,7 @@ public class ModelBuilder {
|
||||
tableDefinitions);
|
||||
}
|
||||
|
||||
private static String COLUMN_HEADER = "# generated by Jailer\n\n" +
|
||||
"# Table; columns\n";
|
||||
private static String COLUMN_HEADER = "# Table; Columns" + PrintUtil.LINE_SEPARATOR;
|
||||
|
||||
private static void resetColumnsFile(String columnsDefinitions, ExecutionContext executionContext) throws IOException {
|
||||
writeFile(getModelBuilderColumnsFilename(executionContext),
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2007 - 2019 the original author or authors.
|
||||
* Copyright 2007 - 2019 Ralf Wisser.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user