This is the mail archive of the docbook@lists.oasis-open.org mailing list for the DocBook project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Templates for SQL database table doc


Hi Norman,

I've included the refentry for a small table called 'currency'. Sorry, 
text is in german, but that shouldn't matter. If you are interested, I
would mail you the Java source for producing this template from
an Informix SQL-DDL file.

For a two-way comparison between SQL-DDL and DocBook files, 
we need to be able to extract the following data from the XML-file:

the column "datatype" like 'int', 'char ( 30 )', 'date' and so on as 
defined by SQL-92

an optional reference to a column in another table "references"
like "col1 integer references othertable ( othercol )"

restrictions like "not null" or "default 4711"

inheritance info like "on delete cascade"

What I would like to see is an XML-construct like:

-------- cut here --------------- cut here --------------- cut here -------
<dbtable><name>currency</name>
  <dbcolumn><name>curcode</name>
    <coltype>char ( 3 )</coltype>
    <colrestriction>not null</colrestriction>
    <colinfo>blabla</colinfo></dbcolumn>
  <dbcolumn><name>curname</name>
    <coltype>varchar ( 30 )</coltype>
    <colinfo>blabla</colinfo></dbcolumn>
  <dbcolumn><name>curcountry</name>
    <coltype>char ( 2 )</coltype>
    <colref><dbtable>country</dbtable>
      <dbcolumn>ctrcode</dbcolumn></colref>
    <colinfo>blabla</colinfo></dbcolumn>
  <primarykey>curcode</primarykey>
</dbtable>
-------- cut here --------------- cut here --------------- cut here -------


See you


-------- cut here --------------- cut here --------------- cut here -------
<refentry id="tbl_currency">
	
<indexterm><primary>W&auml;hrungen</primary></indexterm>

<refmeta>
	<refentrytitle>Tabelle: Currency</refentrytitle>
</refmeta>

<refnamediv>
	<refname>Tabelle: Currency</refname>
	<refpurpose>W&auml;hrungen nach ISO 4217</refpurpose>
</refnamediv>

<refsect1><title>Umgebung</title>
	<para><informaltable frame="none"><tgroup cols="2"><tbody>
		<row><entry>Typ</entry><entry>Schl&uuml;sselwerte,
			frei</entry></row>
		<row><entry>Scope</entry><entry>systemweit,
			unabh&auml;ngig</entry></row>
		<row><entry>Modul</entry><entry>Kern</entry></row>
	</tbody></tgroup></informaltable></para></refsect1>

<refsect1><title>Definition</title>
	<para><informaltable frame="all">
	<tgroup cols="3">
		<colspec colname="c1"/>
		<colspec colname="c2"/>
		<colspec colname="c3"/>
		<spanspec spanname="hall" namest="c1" nameend="c3"/>
	
<thead><row><entry>Spaltenbez.</entry><entry>Datentyp</entry
>
		<entry>Beschreibung</entry></row></thead>
	<tbody><row><entry spanname="hall">create table
		<database 
class="table">currency</database>(</entry></row>
	<row><entry><database 
class="field">curcode</database></entry>
		<entry>char ( 3 ) not null primary key,</entry>
		<entry>Prim&auml;rschl&uuml;ssel. Systemweit. Freie 
Vergabe.</entry></row>
	<row><entry><database 
class="field">curname</database></entry>
		<entry>varchar ( 30 ) not null,</entry>
		<entry>Bezeichnung dieser W&auml;hrung</entry></row>
	<row><entry><database 
class="field">curcountry</database></entry>
		<entry>char ( 2 ) references
			<link linkend="tbl_country">
				country ( ctrcode )</link></entry>
		<entry>Referenz zum Land</entry></row>
	&tblcol_zsince;
	&tblcol_zuntil;
	</tbody></tgroup>
</informaltable>
</para>
</refsect1>

<refsect1><title>Siehe auch</title>
	<itemizedlist mark="opencircle">
	<listitem><para>
		<link linkend="code_currency">Liste</link>
			aller Eintr&auml;ge</para></listitem>
	</itemizedlist>
</refsect1>
</refentry>
-------- cut here --------------- cut here --------------- cut here -------

To:             	Hajo Lemcke <hajo@lemcke.com>
Copies to:      	docbook@lists.oasis-open.org
Subject:        	Re: Templates for SQL database table doc
From:           	Norman Walsh <ndw@nwalsh.com>
Date sent:      	Wed, 20 Mar 2002 06:15:33 -0500

> / Hajo Lemcke <hajo@lemcke.com> was heard to say:
> | definitions? Currently I use a 'refentry', which is not bad, but lacks 
> | features to produce SQL-DDL output and keep that in alignment 
> | with the real database structure.
> 
> Can you describe what those features are?
> 
>                                         Be seeing you,
>                                           norm
> 
> -- 
> Norman Walsh <ndw@nwalsh.com>      | O for a Muse of fire, that would
> http://www.oasis-open.org/docbook/ | ascend / The brightest heaven of
> Chair, DocBook Technical Committee | invention, / A kingdom for a
>                                    | stage, princes to act / And
>                                    | monarchs to behold the swelling
>                                    | scene!--William Shakespeare, Henry
>                                    | V
> 



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]