1 package org.thema.scriptware.teste;
2 import java.sql.*;
3 import java.util.regex.Pattern;
4 import org.thema.Util;
5
6 /***
7 * Classe utilizada para testes...
8 *
9 * @author Eduardo M. Sasso
10 * @since Jan 12, 2004
11 */
12
13 public class teste {
14 public teste() {
15 }
16
17 public static void main(String[] args) {
18 teste teste = new teste();
19 Connection conn=null;
20
21 String sql = "select object_name,object_type from user_objects where object_type=':type'";
22 Pattern pattern = Pattern.compile(":Type",Pattern.CASE_INSENSITIVE);
23 boolean matches = pattern.matcher(sql).find();
24 String resultado = pattern.matcher(sql).replaceAll("TABLE");
25 System.out.println(matches);
26 System.out.println(resultado);
27
28
29 String x = sql.replaceAll(":type", "Table");
30 System.out.println(x);
31
32 resultado = Util.replace(sql, ":Type", "Table", true);
33 System.out.println(resultado);
34
35
36 /*
37 try{
38 OracleDataSource ods = new OracleDataSource();
39 ods.setDriverType("oci");
40 ods.setServerName("blackbelt");
41 ods.setNetworkProtocol("tcp");
42 ods.setDatabaseName("acme");
43 ods.setPortNumber(1521);
44
45 conn = ods.getConnection("scott","tiger");
46 } catch (Exception e) {
47 e.printStackTrace(System.out);
48 }
49
50 int whichFactory = 2;
51 DAOFactory daoFactory = DAOFactory.getDAOFactory(whichFactory);
52 DmlDAO dml = daoFactory.getDmlDAO(conn);
53 DdlDAO ddl = daoFactory.getDdlDAO(conn);
54
55 try {
56 System.out.println(ddl.getScript("EMP","TABLE"));
57 }catch(SQLException e) {
58 e.printStackTrace(System.out);
59 }
60 */
61 }
62
63 }