mirror of
https://github.com/Wisser/Jailer.git
synced 2026-01-04 01:29:57 -06:00
435 lines
23 KiB
HTML
435 lines
23 KiB
HTML
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
|
|
<title>Jailer - Design</title>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii" />
|
|
<meta name="description" content="Data Export Tool" />
|
|
<meta name="keywords" content="data export referential integrity java jdbc dbms" />
|
|
<link rel="stylesheet" type="text/css" href="styles.css" />
|
|
<link rel="shortcut icon" href="favicon.ico" />
|
|
</head>
|
|
|
|
<body left-margin="0" top-margin="0">
|
|
<div align="left">
|
|
<table style="text-align: left; position: absolute; left: 0pt; top: 0pt;" border="0"
|
|
cellpadding="0" cellspacing="0" height="407" width="100%">
|
|
<tbody>
|
|
<tr>
|
|
<td colspan="2" class="bannerbackground" height="33" width="100%">
|
|
<table border="0" cellpadding="4" cellspacing="0" width="100%">
|
|
<tbody>
|
|
<tr>
|
|
<td><a href="https://github.com/Wisser/Jailer"><img src="logo.png" hspace="10" /></td></a>
|
|
|
|
<td class="slogan" width="100%"></td>
|
|
|
|
<td style="text-align: right; width: 100%;"><table border="0" cellpadding="0" cellspacing="0">
|
|
<tbody>
|
|
<tr>
|
|
<td><a href="https://github.com/Wisser/Jailer"><img src="GitHub-Mark-64px.png" title="GitHub" /></a> </td></tr><tr style="height: 100%;"><td> </td>
|
|
</tr>
|
|
</tbody>
|
|
</table> </td>
|
|
</tr>
|
|
</tbody></table>
|
|
<tr>
|
|
<td colspan="2" class="nav1background" width="100%">
|
|
<b><font color="#FFFFFF"><a href="home.htm" target="_self" class=
|
|
"tlink"> Home </a> <a href="quicktour.htm" target=
|
|
"_self" class="tlink"> Quick Tour </a> <a href=
|
|
"exporting-data.htm" target="_self" class="tlink"> Tutorial </a>
|
|
<a href="data-browsing.html" target="_self" class=
|
|
"tlink"> Data Browser </a> <a class="tlink" href="videos.html" target="_self"> Videos </a> <a href="faq.html" target=
|
|
"_self" class="tlink"> FAQ </a> <a href="api.html"
|
|
target="_self" class="tlink"> API </a> <a href=
|
|
"design.htm" target="_self" class="tlinkA"> Documentation </a>
|
|
<a href=
|
|
"http://sourceforge.net/forum/?group_id=197260" target="_self" class=
|
|
"tlink"> Forum </a> <a href=
|
|
"http://sourceforge.net/project/showfiles.php?group_id=197260" target=
|
|
"_self" class="tlink"> Download </a>
|
|
</font></b></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td colspan="2" class="spacer" width="100%"></td> </tr><tr><td class="lmenucontainer"> </td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="lmenucontainer" height="100%" valign="top" width="14%">
|
|
<div align="center">
|
|
<center>
|
|
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
|
<tbody>
|
|
<tr>
|
|
<td height="6px" width="100%"> </td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</center>
|
|
</div>
|
|
|
|
<ul>
|
|
<li><a href="design.htm" target="_self" class=
|
|
"mlinkA">Algorithm</a> </li>
|
|
|
|
<li><a href="file-formats.htm" target="_self" class="mlink">File
|
|
Formats</a> </li>
|
|
</ul>
|
|
|
|
<table border="0" cellpadding="5" cellspacing="0" width="100%">
|
|
<tbody>
|
|
<tr>
|
|
<td class="content2background"><img style=
|
|
"width: 160px; height: 1px;" alt="" src=
|
|
"architecture-Dateien/vgradp.gif" /></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
<p> </p>
|
|
</td>
|
|
|
|
<td class="contentbackground" height="418" valign="top" width="86%">
|
|
<div align="right">
|
|
<table border="0" cellpadding="0" cellspacing="0" height="542"
|
|
width="98%">
|
|
<tbody>
|
|
<tr>
|
|
<td class="contentbackground" height="21" width="100%">
|
|
<br /></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td class="content" height="520" valign="top" width="100%">
|
|
<h4><a name="modell_des_entitaetsgraphen">The Entity
|
|
Graph</a> </h4>During the export, a graph of the entities is created in the database. Three tables are created for this purpose:
|
|
|
|
<div class="level3">
|
|
<ul>
|
|
<li class="level1">
|
|
<div class="li">
|
|
<strong>JAILER_ENTITYGRAPH</strong> the graph<br />
|
|
</div>
|
|
</li>
|
|
|
|
<li class="level1">
|
|
<div class="li">
|
|
<strong>JAILER_ENTITY</strong> entity in the graph<br />
|
|
</div>
|
|
</li>
|
|
|
|
<li class="level1">
|
|
<div class="li">
|
|
<strong>JAILER_DEPENDENCY</strong> dependencies between
|
|
entities
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
|
|
<p>For each entity in the graph the primary-key and the
|
|
type (as table name) is stored. The <em>birthday</em> of
|
|
an entity is the day of the insertion into the
|
|
graph.<br />
|
|
<br />
|
|
<br /></p>
|
|
</div>
|
|
|
|
<h4><a name=
|
|
"berechnung_des_transitiven_abschlusses">Finding the
|
|
transitive closure</a> </h4>The graph will be
|
|
constructed day after day (step-by-step) starting at day 1:
|
|
|
|
<div class="level3">
|
|
<ul>
|
|
<li class="level1">
|
|
<div class="li">
|
|
at day 1 all subject entities are inserted into the
|
|
graph<br />
|
|
</div>
|
|
</li>
|
|
|
|
<li class="level1">at day <big style=
|
|
"font-style: italic;"><span style=
|
|
"font-family: monospace;"><font size=
|
|
"4">n</font></span></big> all entities referenced by
|
|
one of the entities born at day <big style=
|
|
"font-style: italic; font-family: monospace;"><font size="4">
|
|
n-1</font></big> are inserted into the graph.
|
|
Dependencies between entities are stored.<br /></li>
|
|
</ul>
|
|
|
|
<p>The <em>progression set</em> of a day is the set of
|
|
all tables from which entities are inserted at that day.
|
|
The progession set of day 1 is the subject set. The
|
|
process stops if the progression set of a day is
|
|
empty.<br />
|
|
<br /></p>
|
|
</div>
|
|
|
|
<h5>Algorithm</h5>
|
|
|
|
<div style="font-family: arial;" class="level4">
|
|
1. insert <font style="font-style: italic;"
|
|
size="4"><small>subject</small></font> into
|
|
graph <br />
|
|
<small><small><em><font size="4"><small> 2.
|
|
progression-set := { subject
|
|
}</small></font></em></small> </small><br />
|
|
3. while <em><font size=
|
|
"4"><small>progression-set !=
|
|
{}</small></font></em><small> </small><br />
|
|
<em><font size=
|
|
"4"><small>
|
|
1. progression-of-today := {}</small></font></em><br />
|
|
2.
|
|
for all (restricted) associations <em>A between tables
|
|
T<small><font size="2">1</font></small> and
|
|
T<small><font size="2">2</font></small></em><span style=
|
|
"font-style: italic;">, if</span><em>T<small><font size=
|
|
"2">1</font></small></em> or <em>T<small><font size=
|
|
"2">2</font></small></em> in
|
|
<em>progression-set:</em><br />
|
|
|
|
1. if <em>T<small><font size="2">2</font></small></em>
|
|
<span style="font-style: italic;">(T<small><font size=
|
|
"2">1</font></small>)</span> depends on
|
|
<em>T<small><font size="2">1
|
|
<big>(T<small>2</small>)</big></font></small></em>:<br />
|
|
|
|
add dependencies from <em>T<small><font size=
|
|
"2">2</font></small></em>(T<small><font size=
|
|
"2">1</font></small>)-entities born yesterday<br />
|
|
|
|
to the entities they are associated with according to
|
|
<span style="font-style: italic;">A</span><br />
|
|
|
|
2. insert all entities of <em>T<small><font size=
|
|
"2">1</font></small> (T<small><font size=
|
|
"2">2</font></small>)</em>, which are associated
|
|
according to <span style="font-style: italic;">A</span>
|
|
with an entity of <span style=
|
|
"font-style: italic;">T<small><font size=
|
|
"2">2</font></small> (T<small><font size=
|
|
"2">1</font></small>)</span> born yesterday
|
|
|
|
<div class="li">
|
|
|
|
3. if at least one entity of T<small><font size=
|
|
"2">1</font></small> (T<small><font size=
|
|
"2">2</font></small>) is inserted then <em><font size=
|
|
"4"><small>progression-of-today := progression-of-today
|
|
+ { </small></font></em><font size=
|
|
"4"><small>T</small></font><small>1</small> <font size=
|
|
"4"><small>(T</small></font><small>2</small><font size=
|
|
"4"><small>)</small></font> <em><font size=
|
|
"4"><small>}</small></font></em>
|
|
</div>
|
|
<em><font size="4"><small>3. progression-set :=
|
|
progression-of-today</small></font></em>
|
|
</div><br />
|
|
|
|
<div class="level4">
|
|
<p><font size="4"> Example<br /></font></p>
|
|
|
|
<p> Subject = <em>{
|
|
A<small><font size="2">1</font></small></em>,
|
|
<em>A<small><font size="2">2</font></small></em>
|
|
}<br /></p>
|
|
|
|
<table style="width: 100%; text-align: left;" border="0"
|
|
cellpadding="2" cellspacing="2">
|
|
<tbody>
|
|
<tr>
|
|
<td style="vertical-align: top;">
|
|
<br /></td>
|
|
|
|
<td style="vertical-align: top;"><img style=
|
|
"border: 0px solid ;" alt="desing" src=
|
|
"design-Dateien/example.png" /></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
|
|
<p><br /></p>
|
|
|
|
<p><br />
|
|
<br /></p>
|
|
|
|
<table class="inline" border="1" cellpadding="2"
|
|
cellspacing="0">
|
|
<tbody>
|
|
<tr>
|
|
<td style="background-color: rgb(153, 255, 255);">
|
|
<strong>day</strong></td>
|
|
|
|
<td style="background-color: rgb(153, 255, 255);">
|
|
<strong>progression set</strong></td>
|
|
|
|
<td style="background-color: rgb(153, 255, 255);">
|
|
<strong>entities</strong></td>
|
|
|
|
<td style="background-color: rgb(153, 255, 255);">
|
|
<strong>dependencies</strong></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>1</td>
|
|
|
|
<td>A</td>
|
|
|
|
<td>A1, A2</td>
|
|
|
|
<td><br /></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>2</td>
|
|
|
|
<td>B, C</td>
|
|
|
|
<td>+ B1, B2, C3, C4</td>
|
|
|
|
<td>A2->C3, A2->C4</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>3</td>
|
|
|
|
<td>B, C</td>
|
|
|
|
<td>+ C1, C2, B3, B5</td>
|
|
|
|
<td>+ B1->C1, B1->C2</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>4</td>
|
|
|
|
<td>B</td>
|
|
|
|
<td>+ B6</td>
|
|
|
|
<td><em>no change</em></td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td>5</td>
|
|
|
|
<td><br /></td>
|
|
|
|
<td><em>no change</em></td>
|
|
|
|
<td><em>no change</em></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<h4><br /></h4>
|
|
|
|
<h4><a name="sql-anweisungen">SQL-Statements</a> </h4>
|
|
|
|
<p>Line 1, insert subject<br />
|
|
<span style="font-family: monospace;"><br />
|
|
INSERT INTO JAILER_ENTITY(PK, birthday, type)</span><br style=
|
|
"font-family: monospace;" />
|
|
<span style="font-family: monospace;"> SELECT
|
|
<subject>.PK, 1, '<subject>'</span><br style=
|
|
"font-family: monospace;" />
|
|
<span style="font-family: monospace;"> FROM
|
|
<subject></span><br style=
|
|
"font-family: monospace;" />
|
|
<span style="font-family: monospace;">
|
|
WHERE (<condition> AND 103</span><br style=
|
|
"font-family: monospace;" />
|
|
<span style=
|
|
"font-family: monospace;">
|
|
NOT EXISTS (SELECT * FROM JAILER_ENTITY WHERE
|
|
<subject>.PK=Entity.PK)</span><br style=
|
|
"font-family: monospace;" />
|
|
<span style="font-family: monospace;">
|
|
[fetch first <limit> rows only]</span><br style=
|
|
"font-family: monospace;" />
|
|
<br />
|
|
<br />
|
|
Line 3.2.1, adding dependencies<br />
|
|
<br />
|
|
<span style="font-family: monospace;">INSERT INTO
|
|
JAILER_DEPENDENCY(from_PK, to_PK)</span><br style=
|
|
"font-family: monospace;" />
|
|
<span style="font-family: monospace;"> SELECT
|
|
<T2>.PK, <T1>.PK</span><br style=
|
|
"font-family: monospace;" />
|
|
<span style="font-family: monospace;"> FROM JAILER_ENTITY
|
|
E1, JAILER_ENTITY E2,</span><br style="font-family: monospace;" />
|
|
<span style=
|
|
"font-family: monospace;">
|
|
<T2> JOIN <T1> ON
|
|
<join-condition></span><br style=
|
|
"font-family: monospace;" />
|
|
<span style="font-family: monospace;"> WHERE
|
|
E1.type='<T1>' AND
|
|
E2.type='<T2>'</span><br style=
|
|
"font-family: monospace;" />
|
|
<span style=
|
|
"font-family: monospace;">
|
|
AND E1.PK=<T1>.PK</span><br style=
|
|
"font-family: monospace;" />
|
|
<span style=
|
|
"font-family: monospace;">
|
|
AND E2.PK=<T2>.PK<br />
|
|
<br />
|
|
<br /></span> Line 3.2.2, adding referenced entities<br />
|
|
<br />
|
|
<span style="font-family: monospace;">INSERT INTO
|
|
JAILER_ENTITY(PK, birthday, type)</span><br style=
|
|
"font-family: monospace;" />
|
|
<span style="font-family: monospace;"> SELECT
|
|
DISTINCT <T2>.PK, <today>,
|
|
'<T2>'</span><br style="font-family: monospace;" />
|
|
<span style="font-family: monospace;"> FROM
|
|
<T1> JOIN <T2> ON
|
|
<join-condition>,</span><br style=
|
|
"font-family: monospace;" />
|
|
<span style=
|
|
"font-family: monospace;">
|
|
Entity</span><br style="font-family: monospace;" />
|
|
<span style="font-family: monospace;"> WHERE
|
|
<T1>.PK=JAILER_ENTITY.PK AND JAILER_ENTITY.birthday =
|
|
<yesterday></span><br style=
|
|
"font-family: monospace;" />
|
|
<span style=
|
|
"font-family: monospace;">
|
|
AND NOT EXISTS</span><br style="font-family: monospace;" />
|
|
<span style=
|
|
"font-family: monospace;">
|
|
(SELECT * FROM JAILER_ENTITY WHERE
|
|
<T2>.PK=JAILER_ENTITY.PK)</span><br style=
|
|
"font-family: monospace;" />
|
|
<br /></p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<p> </p>
|
|
</td>
|
|
</tr>
|
|
|
|
<tr>
|
|
<td height="12" valign="top" width="14%"><br /></td>
|
|
|
|
<td><br /></td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</body>
|
|
</html>
|