Tag: cws_dev300_odbmacros3
User: fs      
Date: 2008-07-23 13:07:05+0000
Modified:
   dba/dbaccess/qa/complex/dbaccess/CRMDatabase.java

Log:
 copying following changes from CWS dba30g to CWS odbmacros3:

   2008/07/22 06:52:27 fs 1.6.58.1: copying following changes from CWS dba30h 
to CWS dba30g:


     2008/07/21 10:06:09 fs 1.6.62.1: #i91857# +categories table


File Changes:

Directory: /dba/dbaccess/qa/complex/dbaccess/
=============================================

File [changed]: CRMDatabase.java
Url: 
http://dba.openoffice.org/source/browse/dba/dbaccess/qa/complex/dbaccess/CRMDatabase.java?r1=1.6&r2=1.6.2.1
Delta lines:  +24 -8
--------------------
--- CRMDatabase.java    2008-04-10 12:15:43+0000        1.6
+++ CRMDatabase.java    2008-07-23 13:07:02+0000        1.6.2.1
@@ -7,7 +7,7 @@
  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: CRMDatabase.java,v $
- * $Revision: 1.6 $
+ * $Revision: 1.6.2.1 $
  *
  * This file is part of OpenOffice.org.
  *
@@ -30,6 +30,7 @@
 package complex.dbaccess;
 
 import com.sun.star.container.ElementExistException;
+import com.sun.star.io.IOException;
 import com.sun.star.lang.WrappedTargetException;
 import com.sun.star.lang.XMultiServiceFactory;
 import com.sun.star.sdb.XSingleSelectQueryComposer;
@@ -85,23 +86,37 @@
     }
 
     // 
--------------------------------------------------------------------------------------------------------
-    public void close()
+    public void close() throws SQLException, IOException
     {
+        m_database.store();
         m_database.close();
     }
 
     // 
--------------------------------------------------------------------------------------------------------
     private void createTables() throws SQLException
     {
-        HsqlTableDescriptor table = new HsqlTableDescriptor( "products",
+        HsqlTableDescriptor table = new HsqlTableDescriptor( "categories",
             new HsqlColumnDescriptor[] {
                 new HsqlColumnDescriptor( "ID", "INTEGER", 
HsqlColumnDescriptor.PRIMARY ),
-                new HsqlColumnDescriptor( "Name", "VARCHAR(50)" ) } );
+                new HsqlColumnDescriptor( "Name", "VARCHAR(50)" ),
+                new HsqlColumnDescriptor( "Description", "VARCHAR(1024)" ),
+                new HsqlColumnDescriptor( "Image", "LONGVARBINARY" ) } );
+        m_database.createTable( table, true );
+
+        m_database.executeSQL( "INSERT INTO \"categories\" ( \"ID\", \"Name\" 
) VALUES ( 1, 'Food' )" );
+        m_database.executeSQL( "INSERT INTO \"categories\" ( \"ID\", \"Name\" 
) VALUES ( 2, 'Furniture' )" );
+
+        table = new HsqlTableDescriptor( "products",
+            new HsqlColumnDescriptor[] {
+                new HsqlColumnDescriptor( "ID", "INTEGER", 
HsqlColumnDescriptor.PRIMARY ),
+                new HsqlColumnDescriptor( "Name", "VARCHAR(50)" ),
+                new HsqlColumnDescriptor( "CategoryID", "INTEGER", 
HsqlColumnDescriptor.REQUIRED, "categories", "ID" ) } );
         m_database.createTable( table, true );
 
-        m_database.executeSQL( "INSERT INTO \"products\" VALUES ( 1, 'Oranges' 
)" );
-        m_database.executeSQL( "INSERT INTO \"products\" VALUES ( 2, 'Apples' 
)" );
-        m_database.executeSQL( "INSERT INTO \"products\" VALUES ( 3, 'Pears' 
)" );
+        m_database.executeSQL( "INSERT INTO \"products\" VALUES ( 1, 
'Oranges', 1 )" );
+        m_database.executeSQL( "INSERT INTO \"products\" VALUES ( 2, 'Apples', 
1 )" );
+        m_database.executeSQL( "INSERT INTO \"products\" VALUES ( 3, 'Pears', 
1 )" );
+        m_database.executeSQL( "INSERT INTO \"products\" VALUES ( 4, 
'Strawberries', 1 )" );
 
         table = new HsqlTableDescriptor( "customers",
             new HsqlColumnDescriptor[] {
@@ -115,6 +130,7 @@
         m_database.executeSQL( "INSERT INTO \"customers\" VALUES(1,'Food, 
Inc.','Down Under','Melbourne','509') " );
         m_database.executeSQL( "INSERT INTO \"customers\" VALUES(2,'Simply 
Delicious','Down Under','Melbourne','518') " );
         m_database.executeSQL( "INSERT INTO \"customers\" VALUES(3,'Pure 
Health','10 Fish St.','San Francisco','94107') " );
+        m_database.executeSQL( "INSERT INTO \"customers\" VALUES(4,'Milk And 
More','Arlington Road 21','Dublin','31021') " );
 
         table = new HsqlTableDescriptor( "orders",
             new HsqlColumnDescriptor[] {




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to