diff --git a/Doc/DbDevel/dbDevel.xml b/Doc/DbDevel/dbDevel.xml index 00d40b2ea7d1d1e88c7b7cf324d0bb67a6324685..c18854e2ed6403612f8dc4ddafb278cb1aa63adc 100644 --- a/Doc/DbDevel/dbDevel.xml +++ b/Doc/DbDevel/dbDevel.xml @@ -8316,72 +8316,246 @@ em.getTransaction().commit(); </section> </chapter> - <chapter xml:id="dbDevel_chap_projects"> + <chapter annotations="slide" xml:id="dbDevel_chap_projects"> <title>Project ideas</title> <para>All projects require the following steps:</para> - <orderedlist> - <listitem> - <para>Creating an initial project repository at <uri - xlink:href="https://gitlab.mi.hdm-stuttgart.de">https://gitlab.mi.hdm-stuttgart.de</uri>. - Include your lecturer into your team having at least read - access.</para> - </listitem> + <figure xml:id="dbDevelProjectCommon01"> + <title>Common project steps #1/3</title> - <listitem> - <para>Committing a <filename>Readme.md</filename> file describing the - project's goals. This includes a precise description of the - prototype's desired functionality. This part may be extended along - with your project's progress.</para> - </listitem> + <orderedlist> + <listitem> + <para>Creating an initial project repository at <uri + xlink:href="https://gitlab.mi.hdm-stuttgart.de">https://gitlab.mi.hdm-stuttgart.de</uri>.</para> + + <tip> + <para>Include your lecturer into your team providing at least read + access.</para> + </tip> + </listitem> + + <listitem> + <para>Committing a <filename>Readme.md</filename> file describing + the project's goals.</para> + + <para>This includes a precise description of the prototype's desired + functionality likely to be extended along with your project's + progress.</para> + </listitem> + </orderedlist> + </figure> - <listitem> - <para>Identifying individual tasks like e.g.:</para> + <figure xml:id="dbDevelProjectCommon02"> + <title>Common project steps #2/3</title> + + <orderedlist continuation="continues"> + <listitem> + <para>Identify individual tasks like e.g.:</para> + + <itemizedlist> + <listitem> + <para>Creating sample data.</para> + </listitem> + + <listitem> + <para>Setting up test scenarios.</para> + </listitem> + + <listitem> + <para>Selecting a documentation tool set.</para> + </listitem> + </itemizedlist> + </listitem> + + <listitem> + <para>Assign team members to tasks.</para> + </listitem> + </orderedlist> + </figure> + + <figure xml:id="dbDevelProjectCommon03"> + <title>Common project steps #3/3</title> + + <orderedlist continuation="continues"> + <listitem> + <para>Implementation resulting in:</para> + + <itemizedlist> + <listitem> + <para>A deployable piece of software</para> + </listitem> + + <listitem> + <para>Both functional and software internal + documentation.</para> + + <tip> + <para>Don't start this step too late. The »Real programmers + don't document, the code is obvious« myth no longer + works!</para> + </tip> + </listitem> + </itemizedlist> + </listitem> + </orderedlist> + </figure> + + <section xml:id="dbDevel_chap_projects_dbGrep"> + <title>Extending UNIX <command + xlink:href="https://linux.die.net/man/1/grep">grep</command> to + databases</title> + + <figure xml:id="dbDevelGrepPrinciple"> + <title>UNIX <command>grep</command> sample</title> + + <screen>> <link xlink:href="https://linux.die.net/man/1/grep">grep</link> --color <co + linkends="dbDevelGrepPrinciple-1" + xml:id="dbDevelGrepPrinciple-1-co"/> -i <co + linkends="dbDevelGrepPrinciple-2" + xml:id="dbDevelGrepPrinciple-2-co"/> fraction App.java +package de.hdm_stuttgart.mi.sd1.<emphasis role="red">fraction</emphasis>; + * Playing with <emphasis role="red">fraction</emphasis> objects. + final <emphasis role="red">Fraction</emphasis> threeSeven = + new <emphasis role="red">Fraction</emphasis>(3, 7); + final <emphasis role="red">Fraction</emphasis></screen> + + <calloutlist role="slideExclude"> + <callout arearefs="dbDevelGrepPrinciple-1-co" + xml:id="dbDevelGrepPrinciple-1"> + <para>Colorize matched text in output</para> + </callout> + + <callout arearefs="dbDevelGrepPrinciple-2-co" + xml:id="dbDevelGrepPrinciple-2"> + <para>Ignore case when matching text.</para> + </callout> + </calloutlist> + </figure> + + <para>The <command + xlink:href="https://linux.die.net/man/1/grep">grep</command> command + among with its myriad of options allows searching text files for the + occurrence of strings or patterns. This can be extended both to <xref + linkend="glo_RDBMS"/> and non-SQL databases like + <productname>Mongodb</productname>.</para> + + <para>The database query problem however is more complex than simply + query lines of text files. A practically useful <link + xlink:href="https://en.wikipedia.org/wiki/Command-line_interface">CLI</link> + must address:</para> + + <figure xml:id="dbDevelDbGrepRequire"> + <title>Database <command>grep</command> requirements</title> <itemizedlist> <listitem> - <para>Creating sample data.</para> + <para>Connection profile handling</para> </listitem> <listitem> - <para>Setting up test scenarios.</para> - </listitem> + <para>Search level specification:</para> - <listitem> - <para>Selecting a documentation tool set.</para> + <informaltable border="0"> + <tr> + <td valign="top"><itemizedlist> + <listitem> + <para>Whole database</para> + </listitem> + + <listitem> + <para>Table(s)</para> + </listitem> + </itemizedlist></td> + + <td valign="top"><itemizedlist> + <listitem> + <para>Table column(s)</para> + </listitem> + + <listitem> + <para>Recordsets</para> + </listitem> + </itemizedlist></td> + </tr> + </informaltable> </listitem> <listitem> - <para>...</para> + <para>Output formatting, limiting/filtering and paging</para> </listitem> </itemizedlist> - </listitem> + </figure> - <listitem> - <para>Assigning team members to tasks.</para> - </listitem> + <figure xml:id="dbDevelDbGrepSpecProfile"> + <title>Connection profile handling</title> - <listitem> - <para>Implementation resulting in:</para> + <informaltable border="1"> + <tr> + <th>Command</th> - <itemizedlist> - <listitem> - <para>A deployable piece of software</para> - </listitem> + <th>File ~/.dbgrep/Profiles/<emphasis + role="red">postgresTest</emphasis>.cfg</th> + </tr> - <listitem> - <para>Both functional and software internal documentation.</para> + <tr> + <td valign="top"><screen>dbgrep --profile <emphasis role="red">postgresTest</emphasis> ...</screen></td> + + <td valign="top"><programlisting>host=myserver.companynet.com +port=5432 +database=main_test_data +user=testuser +password=secret +driver=Driver/postgresql-42.6.0.jar</programlisting></td> + </tr> + </informaltable> + </figure> - <tip> - <para>Don't start this step too late. The »Real programmers - don't document, the code is obvious« myth no longer - works!</para> - </tip> - </listitem> - </itemizedlist> - </listitem> - </orderedlist> + <figure xml:id="dbDevelDbGrepSpecLevel"> + <title>Search level specification</title> + + <screen>dbgrep ... <co linkends="dbDevelDbGrepSpecLevel-1" + xml:id="dbDevelDbGrepSpecLevel-1-co"/> +dbgrep ... --table User --table Stocks <co linkends="dbDevelDbGrepSpecLevel-2" + xml:id="dbDevelDbGrepSpecLevel-2-co"/>... +dbgrep ... --column User.userId <co linkends="dbDevelDbGrepSpecLevel-3" + xml:id="dbDevelDbGrepSpecLevel-3-co"/> ... +dbgrep ... --table Stocks --column User.userId ... <co + linkends="dbDevelDbGrepSpecLevel-4" + xml:id="dbDevelDbGrepSpecLevel-4-co"/></screen> + + <calloutlist role="slideExclude"> + <callout arearefs="dbDevelDbGrepSpecLevel-1-co" + xml:id="dbDevelDbGrepSpecLevel-1"> + <para>Search whole database <abbrev>i.e.</abbrev> all tables (and + views?).</para> + </callout> + + <callout arearefs="dbDevelDbGrepSpecLevel-2-co" + xml:id="dbDevelDbGrepSpecLevel-2"> + <para>Search all compatible columns from tables + <classname>User</classname> and + <classname>Stocks</classname>.</para> + </callout> + + <callout arearefs="dbDevelDbGrepSpecLevel-3-co" + xml:id="dbDevelDbGrepSpecLevel-3"> + <para>Search column <property>userId</property> from table + <classname>User</classname>.</para> + </callout> + + <callout arearefs="dbDevelDbGrepSpecLevel-4-co" + xml:id="dbDevelDbGrepSpecLevel-4"> + <para>Combined search of <coref + linkend="dbDevelDbGrepSpecLevel-2-co"/> and <coref + linkend="dbDevelDbGrepSpecLevel-3-co"/>.</para> + </callout> + </calloutlist> + </figure> + + <para>A tool might be implemented either as a single command or as a + terminal based application keeping state information.</para> + </section> <section xml:id="dbDevel_chap_projects_dbCopy"> <title>Database copy tool</title> @@ -8392,7 +8566,7 @@ em.getTransaction().commit(); <glosslist> <glossentry> - <glossterm>Database 1:</glossterm> + <glossterm>Source database:</glossterm> <glossdef> <para>Hosting an active instance <abbrev>i.e.</abbrev> a set of @@ -8401,7 +8575,7 @@ em.getTransaction().commit(); </glossentry> <glossentry> - <glossterm>Database 2</glossterm> + <glossterm>Destination database</glossterm> <glossdef> <para>Yet empty or containing non-conflicting table and view @@ -8410,14 +8584,15 @@ em.getTransaction().commit(); </glossentry> </glosslist> - <para>We assume full <xref linkend="glo_JDBC"/> administrative read - access to database 1 and full read/write access to database 2. The copy - tool shall allow for the following sequence of operations:</para> + <para>We assume full <xref linkend="glo_JDBC"/> read access to our + source database and full read/write access to the destination database. + The copy tool shall allow for the following sequence of + operations:</para> <orderedlist> <listitem> - <para>Copying all tables among with related records from database 1 - to database 2.</para> + <para>Copying all tables among with related records from source to + destination database.</para> <para>Vendor specific <xref linkend="glo_SQL"/> syntax rules <abbrev>e.g.</abbrev> when dealing with generated ID values (<link @@ -8429,7 +8604,7 @@ em.getTransaction().commit(); </listitem> <listitem> - <para>Transver as much integrity constraints as possible:</para> + <para>Transfer as many integrity constraints as possible:</para> <itemizedlist> <listitem> @@ -8469,7 +8644,7 @@ em.getTransaction().commit(); </listitem> <listitem> - <para>Database 2 may be a non-SQL database like + <para>The destination database may be a non-SQL database like <productname>Mongodb</productname> supporting a limited subset of <link xlink:href="https://docs.mongodb.com/manual/core/schema-validation">schema @@ -8555,52 +8730,5 @@ em.getTransaction().commit(); </listitem> </itemizedlist> </section> - - <section xml:id="dbDevel_chap_projects_dbGrep"> - <title>Extending UNIX <command - xlink:href="https://linux.die.net/man/1/grep">grep</command> to - databases</title> - - <para>The <command - xlink:href="https://linux.die.net/man/1/grep">grep</command> command - among with its myriad of options allows searching text files for the - occurrence of strings or patterns. This can be extended both to <xref - linkend="glo_RDBMS"/> and non-SQL databases like - <productname>Mongodb</productname>.</para> - - <para>The problem however is more complex than simply query lines of - text files. A practically useful <link - xlink:href="https://en.wikipedia.org/wiki/Command-line_interface">CLI</link> - must address:</para> - - <itemizedlist> - <listitem> - <para>Database connections containing network addresses, database id - values, username/password combinations.</para> - </listitem> - - <listitem> - <para>Search restrictions to:</para> - - <itemizedlist> - <listitem> - <para>Tables</para> - </listitem> - - <listitem> - <para>columns</para> - </listitem> - - <listitem> - <para>Records <abbrev>i.e.</abbrev> defined by - <code>WHERE</code> clauses.</para> - </listitem> - </itemizedlist> - </listitem> - </itemizedlist> - - <para>A tool might be implemented either as a single command or as a - terminal based application keeping state information.</para> - </section> </chapter> </part>