01: /*
02: * Copyright 2006-2007 Pentaho Corporation. All rights reserved.
03: * This software was developed by Pentaho Corporation and is provided under the terms
04: * of the Mozilla Public License, Version 1.1, or any later version. You may not use
05: * this file except in compliance with the license. If you need a copy of the license,
06: * please go to http://www.mozilla.org/MPL/MPL-1.1.txt.
07: *
08: * Software distributed under the Mozilla Public License is distributed on an "AS IS"
09: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. Please refer to
10: * the license for the specific language governing your rights and limitations.
11: *
12: * Additional Contributor(s): Martin Schmid gridvision engineering GmbH
13: */
14: package org.pentaho.reportdesigner.crm.report.datasetplugin.composer;
15:
16: import org.jetbrains.annotations.NotNull;
17: import org.pentaho.reportdesigner.crm.report.components.ProgressListener;
18: import org.pentaho.reportdesigner.crm.report.datasetplugin.sampledb.SampleDB;
19: import org.pentaho.reportdesigner.lib.common.graph.Graph;
20:
21: import java.sql.Connection;
22: import java.sql.DriverManager;
23:
24: /**
25: * User: Martin
26: * Date: 06.03.2006
27: * Time: 08:06:26
28: */
29: @SuppressWarnings({"ALL"})
30: public class AnalyzerTester {
31: public static void main(String[] args) throws Exception {
32: SampleDB.initSampleDB();
33:
34: Connection c = DriverManager.getConnection(
35: "jdbc:hsqldb:mem:sample", "sa", "");
36:
37: Graph graph = JDBCAnalyzer.buildGraph("", "PUBLIC", c,
38: new ProgressListener() {
39: public void taskStarted(@NotNull
40: String task) {
41: System.out.println("task = " + task);//NON-NLS
42: }
43: });
44: System.out.println("graph = " + graph);
45:
46: //DatabaseMetaData metaData = c.getMetaData();
47: //
48: //String catalogTerm = metaData.getCatalogTerm();
49: //System.out.println("catalogTerm = " + catalogTerm);
50: //String catalogSeparator = metaData.getCatalogSeparator();
51: //System.out.println("catalogSeparator = " + catalogSeparator);
52: //
53: //System.out.println("Schemas");
54: //ResultSet schemas = metaData.getSchemas();
55: //ResultSetPrinter.printResultSet(schemas);
56: //
57: //System.out.println("Tables");
58: //ResultSet tables = metaData.getTables("", "PUBLIC", "%", null);
59: //ResultSetPrinter.printResultSet(tables);
60: //
61: ////System.out.println("PrimaryKeys");
62: ////ResultSet primaryKeys = metaData.getPrimaryKeys("", "PUBLIC", "ORDERS");
63: ////ResultSetPrinter.printResultSet(primaryKeys);
64: //
65: ////System.out.println("ExportedKeys");
66: ////ResultSet exportedKeys = metaData.getExportedKeys("", "PUBLIC", "ORDERS");
67: ////ResultSetPrinter.printResultSet(exportedKeys);
68: //
69: //System.out.println("ImportedKeys");
70: //ResultSet importedKeys = metaData.getImportedKeys("", "PUBLIC", "ORDERS");
71: //ResultSetPrinter.printResultSet(importedKeys);
72:
73: /*
74: SELECT
75: CUSTOMERS.FIRST_NAME, CUSTOMERS.LAST_NAME,
76: PRODUCTS.PRODUCT_NAME, PRODUCTS.PRODUCT_DESCRIPTION, PRODUCTS.PRICE
77: FROM CUSTOMERS
78: JOIN ORDERS ON CUSTOMERS.CUSTOMER_ID=ORDERS.CUSTOMER_ID
79: JOIN ORDER_ITEMS ON ORDER_ITEMS.ORDER_ID=ORDERS.ORDER_ID
80: JOIN PRODUCTS ON ORDER_ITEMS.PRODUCT_ID=PRODUCTS.PRODUCT_ID
81: ORDER BY
82: CUSTOMERS.FIRST_NAME, PRODUCTS.PRODUCT_NAME
83: */
84: }
85: }
|