Source Code Cross Referenced for QueryInsertRowCt.java in  » Database-JDBC-Connection-Pool » octopus » org » webdocwf » util » loader » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database JDBC Connection Pool » octopus » org.webdocwf.util.loader 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:          Loader - tool for transfering data from one JDBC source to another and
003:          doing transformations during copy.
004:            Copyright (C) 2002-2003  Together
005:            This library is free software; you can redistribute it and/or
006:            modify it under the terms of the GNU Lesser General Public
007:            License as published by the Free Software Foundation; either
008:            version 2.1 of the License, or (at your option) any later version.
009:            This library is distributed in the hope that it will be useful,
010:            but WITHOUT ANY WARRANTY; without even the implied warranty of
011:            MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
012:            Lesser General Public License for more details.
013:            You should have received a copy of the GNU Lesser General Public
014:            License along with this library; if not, write to the Free Software
015:            Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
016:         Loader.java
017:         Date: 03.03.2003.
018:         @version 2.1 alpha
019:         @author:
020:         Radoslav Dutina  rale@prozone.co.yu
021:         */
022:
023:        package org.webdocwf.util.loader;
024:
025:        import java.util.*;
026:        import java.math.*;
027:        import java.sql.*;
028:
029:        /**
030:         *
031:         * QueryInsertRowCt class is used for creating string representation of
032:         * prepereStatement for inserting the tables (<copyTable> tag)
033:         * @author Radoslav Dutina
034:         * @version 1.0
035:         */
036:        public class QueryInsertRowCt {
037:            private String tableName = "";
038:            private Vector columnNamesPstmt = new Vector();
039:            private BigDecimal bdecOidNumber;
040:            private boolean bOidLogicCurrentTable = false;
041:            private boolean isTOS = false;
042:            private String oidColumnName = "oid";
043:            private String versionColumnName = "version";
044:            private String oidType = "decimal";
045:            private String versionType = "bigint";
046:            private Hashtable sqlToJavaMap = new Hashtable();
047:
048:            /**
049:             * Public constructor of QueryInsertRowCt class. Construct object QueryInsertRowCt with
050:             * an associated parameters.
051:             * @param bOidLogicCurrentTable is boolean object, which decide is oid logic true or false
052:             * @param isTOS is boolean object, which decide is oid logic true or false
053:             * @param vecNewColumnNames defines Vector object of column names
054:             * @param vecNewColumnTypes defines Vector object of column types
055:             * @param tableName defines current table name
056:             * @param bdecOidNumber defines value of oid column
057:             */
058:            public QueryInsertRowCt(boolean bOidLogicCurrentTable,
059:                    boolean isTOS, Vector vecNewColumnNames,
060:                    Vector vecNewColumnTypes, String tableName,
061:                    BigDecimal bdecOidNumber, String oidColumnName,
062:                    String versionColumnName, String oidType,
063:                    String versionType, Hashtable sqlToJavaMap) {
064:
065:                this .tableName = tableName;
066:                this .oidColumnName = oidColumnName;
067:                this .versionColumnName = versionColumnName;
068:                this .oidType = oidType;
069:                this .versionType = versionType;
070:                this .sqlToJavaMap = sqlToJavaMap;
071:                this .bOidLogicCurrentTable = bOidLogicCurrentTable;
072:                this .bdecOidNumber = bdecOidNumber;
073:                this .isTOS = isTOS;
074:                if (bOidLogicCurrentTable) {
075:                    if (isTOS) {
076:                        columnNamesPstmt.add(this .oidColumnName);
077:                    } else {
078:                        columnNamesPstmt.add(this .oidColumnName);
079:                        columnNamesPstmt.add(this .versionColumnName);
080:                    }
081:                }
082:
083:                for (int i = 0; i < vecNewColumnNames.size(); i++) {
084:                    columnNamesPstmt.add(vecNewColumnNames.get(i).toString());
085:                }
086:
087:            }
088:
089:            /**
090:             * This method read value of pstmt parameter, which represent prepereStatement
091:             * @return value of parameter
092:             */
093:            public String getPreperedStatementForInsert() {
094:                String pstmt = "insert into " + tableName + " (";
095:                int count = columnNamesPstmt.size();
096:                for (int i = 0; i < count; i++) {
097:                    if (i != count - 1)
098:                        pstmt += columnNamesPstmt.get(i).toString() + ",";
099:                    else
100:                        pstmt += columnNamesPstmt.get(i).toString() + ")";
101:                }
102:                pstmt += " VALUES (";
103:                for (int i = 0; i < count; i++) {
104:                    if (i != count - 1) {
105:                        pstmt += "?,";
106:                    } else {
107:                        pstmt += "?)";
108:                    }
109:                }
110:                if (bOidLogicCurrentTable) {
111:                    if (isTOS) {
112:                        int oid = pstmt.indexOf("?");
113:                        pstmt = pstmt.substring(0, oid) + "'" + bdecOidNumber
114:                                + "'" + pstmt.substring(oid + 1);
115:                    } else {
116:                        int oid = pstmt.indexOf("?");
117:                        pstmt = pstmt.substring(0, oid)
118:                                + bdecOidNumber.toString()
119:                                + pstmt.substring(oid + 1);
120:                        int version = pstmt.indexOf("?");
121:                        pstmt = pstmt.substring(0, version) + String.valueOf(0)
122:                                + pstmt.substring(version + 1);
123:                    }
124:                }
125:
126:                return pstmt;
127:            }
128:
129:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.