https://wiki.openoffice.org/w/index.php?title=Documentation/DevGuide/Database/The_Descriptor_Pattern&feed=atom&action=history
Documentation/DevGuide/Database/The Descriptor Pattern - Revision history
2024-03-29T14:32:14Z
Revision history for this page on the wiki
MediaWiki 1.23.13
https://wiki.openoffice.org/w/index.php?title=Documentation/DevGuide/Database/The_Descriptor_Pattern&diff=246403&oldid=prev
DiGro at 15:12, 21 December 2020
2020-12-21T15:12:48Z
<p></p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 15:12, 21 December 2020</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 30:</td>
<td colspan="2" class="diff-lineno">Line 30:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>After the columns are appended, add the <code>TableDescriptor</code> object to its container or define some key objects, such as a primary key.  </div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>After the columns are appended, add the <code>TableDescriptor</code> object to its container or define some key objects, such as a primary key.  </div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><!--[SOURCE:Database/sdbcx.java]--></div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div><!--[SOURCE:Database/sdbcx.java]--></div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> </div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline"><syntaxhighlight lang="java"></ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   // create the table salesmen</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   // create the table salesmen</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   public static void createTableSalesMen(XNameAccess xTables) throws Exception, SQLException {</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   public static void createTableSalesMen(XNameAccess xTables) throws Exception, SQLException {</div></td></tr>
<tr><td colspan="2" class="diff-lineno">Line 112:</td>
<td colspan="2" class="diff-lineno">Line 112:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>       }</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>       }</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   }</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>   }</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div> </div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline"></syntaxhighlight></ins></div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>{{PDL1}}</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>{{PDL1}}</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>[[Category:Documentation/Developer's Guide/Database Access]]</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>[[Category:Documentation/Developer's Guide/Database Access]]</div></td></tr>
</table>
DiGro
https://wiki.openoffice.org/w/index.php?title=Documentation/DevGuide/Database/The_Descriptor_Pattern&diff=127041&oldid=prev
OOoWikiBot: FINAL VERSION FOR L10N
2009-05-15T12:52:10Z
<p>FINAL VERSION FOR L10N</p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 12:52, 15 May 2009</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 6:</td>
<td colspan="2" class="diff-lineno">Line 6:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>|NextPage=Documentation/DevGuide/Database/Adding an Index</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>|NextPage=Documentation/DevGuide/Database/Adding an Index</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>}}</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>}}</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>{{DISPLAYTITLE:The Descriptor Pattern}}</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline">{{Documentation/DevGuideLanguages|Documentation/DevGuide/Database/{{SUBPAGENAME}}}} </ins></div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div><ins class="diffchange diffchange-inline"> </ins>{{DISPLAYTITLE:The Descriptor Pattern}}</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>The descriptor is a special kind of object that mirrors the structure of the object which should be appended to a container object. This means that a descriptor, once created, can be appended more than once with only small changes to the structure. For example, when appending columns to the columns container, we:</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>The descriptor is a special kind of object that mirrors the structure of the object which should be appended to a container object. This means that a descriptor, once created, can be appended more than once with only small changes to the structure. For example, when appending columns to the columns container, we:</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
</table>
OOoWikiBot
https://wiki.openoffice.org/w/index.php?title=Documentation/DevGuide/Database/The_Descriptor_Pattern&diff=81030&oldid=prev
OOoWikiBot: Robot: Changing Category:Documentation/Developers Guide/Database Access
2008-06-05T08:02:27Z
<p>Robot: Changing Category:Documentation/Developers Guide/Database Access</p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 08:02, 5 June 2008</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 114:</td>
<td colspan="2" class="diff-lineno">Line 114:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>{{PDL1}}</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>{{PDL1}}</div></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>[[Category:Documentation/<del class="diffchange diffchange-inline">Developers </del>Guide/Database Access]]</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>[[Category:Documentation/<ins class="diffchange diffchange-inline">Developer's </ins>Guide/Database Access]]</div></td></tr>
</table>
OOoWikiBot
https://wiki.openoffice.org/w/index.php?title=Documentation/DevGuide/Database/The_Descriptor_Pattern&diff=80474&oldid=prev
OOoWikiBot: Robot: Changing Category:Database Access
2008-06-04T11:49:09Z
<p>Robot: Changing Category:Database Access</p>
<table class='diff diff-contentalign-left'>
<col class='diff-marker' />
<col class='diff-content' />
<col class='diff-marker' />
<col class='diff-content' />
<tr style='vertical-align: top;'>
<td colspan='2' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='2' style="background-color: white; color:black; text-align: center;">Revision as of 11:49, 4 June 2008</td>
</tr><tr><td colspan="2" class="diff-lineno">Line 113:</td>
<td colspan="2" class="diff-lineno">Line 113:</td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>{{PDL1}}</div></td><td class='diff-marker'> </td><td style="background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;"><div>{{PDL1}}</div></td></tr>
<tr><td class='diff-marker'>−</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;"><div>[[Category: Database Access]]</div></td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div> </div></td></tr>
<tr><td colspan="2"> </td><td class='diff-marker'>+</td><td style="color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;"><div>[[Category:<ins class="diffchange diffchange-inline">Documentation/Developers Guide/</ins>Database Access]]</div></td></tr>
</table>
OOoWikiBot
https://wiki.openoffice.org/w/index.php?title=Documentation/DevGuide/Database/The_Descriptor_Pattern&diff=63808&oldid=prev
Ccornell: 1 revision(s)
2008-02-15T12:37:33Z
<p>1 revision(s)</p>
<table class='diff diff-contentalign-left'>
<tr style='vertical-align: top;'>
<td colspan='1' style="background-color: white; color:black; text-align: center;">← Older revision</td>
<td colspan='1' style="background-color: white; color:black; text-align: center;">Revision as of 12:37, 15 February 2008</td>
</tr><tr><td colspan='2' style='text-align: center;'><div class="mw-diff-empty">(No difference)</div>
</td></tr></table>
Ccornell
https://wiki.openoffice.org/w/index.php?title=Documentation/DevGuide/Database/The_Descriptor_Pattern&diff=63807&oldid=prev
Jsc: Initial author Sun Microsystems, Inc.
2007-11-01T12:09:33Z
<p>Initial author Sun Microsystems, Inc.</p>
<p><b>New page</b></p><div>{{Documentation/DevGuide/DatabaseTOC<br />
|Database2d=block<br />
|DatabaseSDBCX=block<br />
|ShowPrevNext=block<br />
|PrevPage=Documentation/DevGuide/Database/User Service<br />
|NextPage=Documentation/DevGuide/Database/Adding an Index<br />
}}<br />
{{DISPLAYTITLE:The Descriptor Pattern}}<br />
The descriptor is a special kind of object that mirrors the structure of the object which should be appended to a container object. This means that a descriptor, once created, can be appended more than once with only small changes to the structure. For example, when appending columns to the columns container, we:<br />
<br />
* Create one descriptor with <idl>com.sun.star.sdbcx.XDataDescriptorFactory</idl>.<br />
* Set the needed properties.<br />
* Add the descriptor to the container.<br />
* Adjust some properties, such as the name.<br />
* Add the modified descriptor to the container.<br />
* Repeat the steps, as necessary.<br />
therefore, only create one descriptor to append more than one column.<br />
<br />
[[Image:Descriptor.png|none|thumb|400px|Descriptor Pattern]]<br />
<br />
* Creating a Table<br />
<br />
An important use of the SDBCX layer is that it is possible to programmatically create tables, along with their columns, indexes, and keys.<br />
<br />
The method of creating a table is the same as creating a table with a graphical table design. To create it programmatically is easy. First, create a table object by asking the tables container for its <idl>com.sun.star.sdbcx.XDataDescriptorFactory</idl> interface. When the <code>createDataDescriptor</code> method is called, the <idl>com.sun.star.beans.XPropertySet</idl> interface of an object that implements the service <idl>com.sun.star.sdbcx.TableDescriptor</idl> is returned. As described above, use this descriptor to create a new table in the database, by adding the descriptor to the Tables container. Before appending the descriptor, append the columns to the table descriptor. Use the same method as with the containers used in the SDBCX layer. On the column object, some properties need to be set, such as <code>Name</code>, and <code>Type</code>. The properties to be set depend on the SDBC data type of the column.<br />
<br />
The column name must be unique in the columns container. <br />
<br />
After the columns are appended, add the <code>TableDescriptor</code> object to its container or define some key objects, such as a primary key. <br />
<!--[SOURCE:Database/sdbcx.java]--><br />
<br />
// create the table salesmen<br />
public static void createTableSalesMen(XNameAccess xTables) throws Exception, SQLException {<br />
XDataDescriptorFactory xTabFac = (XDataDescriptorFactory)UnoRuntime.queryInterface(<br />
XDataDescriptorFactory.class, xTables);<br />
<br />
if (xTabFac != null) {<br />
// create the new table<br />
XPropertySet xTable = xTabFac.createDataDescriptor();<br />
// set the name of the new table<br />
xTable.setPropertyValue("Name", "SALESMAN");<br />
<br />
// append the columns<br />
XColumnsSupplier xColumSup = (XColumnsSupplier)UnoRuntime.queryInterface(<br />
XColumnsSupplier.class,xTable);<br />
XDataDescriptorFactory xColFac = (XDataDescriptorFactory)UnoRuntime.queryInterface(<br />
XDataDescriptorFactory.class, xColumSup.getColumns());<br />
XAppend xAppend = (XAppend)UnoRuntime.queryInterface(XAppend.class, xColFac);<br />
<br />
// we only need one descriptor<br />
XPropertySet xCol = xColFac.createDataDescriptor();<br />
<br />
// create first column and append<br />
xCol.setPropertyValue("Name", "SNR");<br />
xCol.setPropertyValue("Type", new Integer(DataType.INTEGER));<br />
xCol.setPropertyValue("IsNullable", new Integer(ColumnValue.NO_NULLS));<br />
xAppend.appendByDescriptor(xCol);<br />
// 2nd only set the properties which differ<br />
xCol.setPropertyValue("Name", "FIRSTNAME");<br />
xCol.setPropertyValue("Type", new Integer(DataType.VARCHAR));<br />
xCol.setPropertyValue("IsNullable", new Integer(ColumnValue.NULLABLE));<br />
xCol.setPropertyValue("Precision", new Integer(50));<br />
xAppend.appendByDescriptor(xCol);<br />
// 3rd only set the properties which differ<br />
xCol.setPropertyValue("Name", "LASTNAME");<br />
xCol.setPropertyValue("Precision", new Integer(100));<br />
xAppend.appendByDescriptor(xCol);<br />
// 4th only set the properties which differ<br />
xCol.setPropertyValue("Name", "STREET");<br />
xCol.setPropertyValue("Precision",n ew Integer(50));<br />
xAppend.appendByDescriptor(xCol);<br />
// 5th only set the properties which differ<br />
xCol.setPropertyValue("Name", "STATE");<br />
xAppend.appendByDescriptor(xCol);<br />
// 6th only set the properties which differ<br />
xCol.setPropertyValue("Name", "ZIP");<br />
xCol.setPropertyValue("Type", new Integer(DataType.INTEGER));<br />
xCol.setPropertyValue("Precision", new Integer(10)); // default value integer<br />
xAppend.appendByDescriptor(xCol);<br />
// 7th only set the properties which differs<br />
xCol.setPropertyValue("Name", "BIRTHDATE");<br />
xCol.setPropertyValue("Type", new Integer(DataType.DATE));<br />
xCol.setPropertyValue("Precision", new Integer(10)); // default value integer<br />
xAppend.appendByDescriptor(xCol);<br />
<br />
// now we create the primary key<br />
XKeysSupplier xKeySup = (XKeysSupplier)UnoRuntime.queryInterface(XKeysSupplier.class, xTable);<br />
XDataDescriptorFactory xKeyFac = (XDataDescriptorFactory)UnoRuntime.queryInterface(<br />
XDataDescriptorFactory.class,xKeySup.getKeys());<br />
XAppend xKeyAppend = (XAppend)UnoRuntime.queryInterface(XAppend.class, xKeyFac);<br />
<br />
XPropertySet xKey = xKeyFac.createDataDescriptor();<br />
xKey.setPropertyValue("Type", new Integer(KeyType.PRIMARY));<br />
// now append the columns to key<br />
XColumnsSupplier xKeyColumSup = (XColumnsSupplier)UnoRuntime.queryInterface(<br />
XColumnsSupplier.class, xKey);<br />
XDataDescriptorFactory xKeyColFac = (XDataDescriptorFactory)UnoRuntime.queryInterface(<br />
XDataDescriptorFactory.class,xKeyColumSup.getColumns());<br />
XAppend xKeyColAppend = (XAppend)UnoRuntime.queryInterface(XAppend.class, xKeyColFac);<br />
<br />
// we only need one descriptor<br />
XPropertySet xKeyCol = xKeyColFac.createDataDescriptor();<br />
xKeyCol.setPropertyValue("Name", "SNR");<br />
// append the key column<br />
xKeyColAppend.appendByDescriptor(xKeyCol);<br />
// append the key<br />
xKeyAppend.appendByDescriptor(xKey);<br />
// the last step is to append the new table to the tables collection<br />
XAppend xTableAppend = (XAppend)UnoRuntime.queryInterface(XAppend.class, xTabFac);<br />
xTableAppend.appendByDescriptor(xTable);<br />
}<br />
}<br />
<br />
{{PDL1}}<br />
[[Category: Database Access]]</div>
Jsc