com.poscoict.glueframework.dao.jdbc
Class GlueQueryStringHelper

java.lang.Object
  extended by com.poscoict.glueframework.dao.jdbc.GlueQueryStringHelper

public abstract class GlueQueryStringHelper
extends Object

Internal Use Only. Query ¹®ÀåÀ» ´Ù¾çÇÑ Æ÷¸ËÀ¸·Î º¯°æÇØÁÖ´Â À¯Æ¿¸®Æ¼ Ŭ·¡½º.


Field Summary
static String CLOSE_PARENTHESIS
           
static String CLOSE_PARENTHESIS_NAVI_PAGE
           
static String COUNT_STMT
           
static String COUNT_STMT_MYSQL
           
static String INSERT_AUDIT_ATTR_STMT
           
static String INSERT_AUDIT_VALUE_STMT
           
static String OPEN_PARENTHESIS
           
static String ORDER_BY_CLAUSE
           
static String SELECT
           
static String SELECT_HEADER
           
static String SELECT_II
           
static String SELECT_TAIL
           
static String SQLSERVER_TOP_KEYWORD
           
static String UPDATE_AUDIT_STMT
           
static String WHERE
           
 
Constructor Summary
GlueQueryStringHelper()
           
 
Method Summary
static String createQueryStmtWhereOrderByClause(String query, String whereClause, String orderByClause)
          ÀÚ¹Ùµ¶À» ÀÚ¼¼ÇÏ°Ô ÀÛ¼ºÇÑ´Ù.
static String getAuditStatement(String query, int dmltype)
           
static String getAuditStatementForInsert(String query)
           
static String getAuditStatementForUpdate(String query)
           
static String getBindingName(String str)
          Internal Use only.
static String getCountQuery(String query)
          Argument·Î ÁÖ¾îÁö´Â Äõ¸®¹®ÀåÀ» ±â¹ÝÀ¸·Î ·¹ÄÚµå ÃÑ °³¼ö¸¦ ¾òÀ» ¼ö ÀÖ´Â Äõ¸®¸¦ »ý¼ºÇÑ´Ù.
static int getDmlType(String queryStmt)
           
static boolean isMSSQLDriver()
           
static boolean isOracleDriver()
           
static String makeOrderByClause(String str1, String str2)
          Internal Use only.
static void setDatabaseProductName(String databaseProductName)
          DBMS¿¡ µû¸¥ JDBC Driver ¼³Á¤.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPEN_PARENTHESIS

public static final String OPEN_PARENTHESIS
See Also:
Constant Field Values

CLOSE_PARENTHESIS

public static final String CLOSE_PARENTHESIS
See Also:
Constant Field Values

CLOSE_PARENTHESIS_NAVI_PAGE

public static final String CLOSE_PARENTHESIS_NAVI_PAGE
See Also:
Constant Field Values

SELECT

public static final String SELECT
See Also:
Constant Field Values

SELECT_II

public static final String SELECT_II
See Also:
Constant Field Values

WHERE

public static final String WHERE
See Also:
Constant Field Values

COUNT_STMT_MYSQL

public static final String COUNT_STMT_MYSQL
See Also:
Constant Field Values

COUNT_STMT

public static final String COUNT_STMT
See Also:
Constant Field Values

SQLSERVER_TOP_KEYWORD

public static final String SQLSERVER_TOP_KEYWORD
See Also:
Constant Field Values

UPDATE_AUDIT_STMT

public static final String UPDATE_AUDIT_STMT
See Also:
Constant Field Values

INSERT_AUDIT_ATTR_STMT

public static final String INSERT_AUDIT_ATTR_STMT
See Also:
Constant Field Values

INSERT_AUDIT_VALUE_STMT

public static final String INSERT_AUDIT_VALUE_STMT
See Also:
Constant Field Values

SELECT_HEADER

public static final String SELECT_HEADER
See Also:
Constant Field Values

SELECT_TAIL

public static final String SELECT_TAIL
See Also:
Constant Field Values

ORDER_BY_CLAUSE

public static final String ORDER_BY_CLAUSE
See Also:
Constant Field Values
Constructor Detail

GlueQueryStringHelper

public GlueQueryStringHelper()
Method Detail

getCountQuery

public static String getCountQuery(String query)
                            throws GlueBadSqlGrammarException
Argument·Î ÁÖ¾îÁö´Â Äõ¸®¹®ÀåÀ» ±â¹ÝÀ¸·Î ·¹ÄÚµå ÃÑ °³¼ö¸¦ ¾òÀ» ¼ö ÀÖ´Â Äõ¸®¸¦ »ý¼ºÇÑ´Ù. µ¥ÀÌÅͺ£À̽º°¡ MS SQL ServerÀÎ °æ¿ì¿¡´Â ÀζóÀÎ Äõ¸®¿¡ ORDER BY ÀýÀÌ ÀÖÀ¸¸é TOP Å°¿öµå¸¦ »ç¿ëÇØ¾ß Çϱ⠶§¹®¿¡ ´ÙÀ½°ú °°ÀÌ TOP Å°¿öµå¸¦ Ç×»ó Ãß°¡Çؼ­ Ä«¿îÆ® Äõ¸®¸¦ »ý¼ºÇÑ´Ù.
 1. SQL Server) 
 ¿øº» Äõ¸®: 
  "SELECT EMPNO, SAL FROM TABLE WHERE SAL > ? ORDER BY SAL" 
 ¹ÝȯµÇ´Â Äõ¸®: 
  "SELECT COUNT(1) FROM (SELECT TOP 100 PERCENT EMPNO, SAL FROM TABLE WHERE SAL > ? ORDER BY SAL) FIND_FOR_NAVIGATION_PAGE"
 
 2. Oracle) 
 ¿øº» Äõ¸®: 
  "SELECT EMPNO, SAL FROM TABLE WHERE SAL > ? ORDER BY SAL"
 ¹ÝȯµÇ´Â Äõ¸®: 
  "SELECT COUNT(1) FROM (SELECT EMPNO, SAL FROM TABLE WHERE SAL > ? ORDER BY SAL) FIND_FOR_NAVIGATION_PAGE
 
 3. MySQL
 ¿øº» Äõ¸®: 
  "SELECT EMPNO, SAL FROM TABLE WHERE SAL > ? ORDER BY SAL"
 ¹ÝȯµÇ´Â Äõ¸®: 
  "SELECT COUNT(0) FROM (SELECT EMPNO, SAL FROM TABLE WHERE SAL > ? ORDER BY SAL) FIND_FOR_NAVIGATION_PAGE
 

Parameters:
query - Äõ¸® ¹®Àå
Returns:
·¹ÄÚµå ÃÑ °³¼ö¸¦ ¾òÀ» ¼ö ÀÖ´Â Äõ¸®
Throws:
GlueBadSqlGrammarException

getAuditStatementForUpdate

public static String getAuditStatementForUpdate(String query)
Parameters:
query -
Returns:
String

getAuditStatementForInsert

public static String getAuditStatementForInsert(String query)
Parameters:
query -
Returns:
String

getAuditStatement

public static String getAuditStatement(String query,
                                       int dmltype)
Parameters:
query -
dmltype -
Returns:
String

setDatabaseProductName

public static void setDatabaseProductName(String databaseProductName)
DBMS¿¡ µû¸¥ JDBC Driver ¼³Á¤.
 1. Oracle
 DBMS Name: Oracle
 2. DB2
 DBMS Name: DB2/NT
 3. MSSQL
 DBMS Name: Microsoft SQL Server
 4. MySQL
 DBMS Name: MySQL
 5. Postgre
 DBMS Name: PostgreSQL
 6. SQLLite
 DBMS Name: SQLite
 

Parameters:
databaseProductName -

isMSSQLDriver

public static boolean isMSSQLDriver()
Returns:
boolean

isOracleDriver

public static boolean isOracleDriver()
Returns:
boolean

createQueryStmtWhereOrderByClause

public static String createQueryStmtWhereOrderByClause(String query,
                                                       String whereClause,
                                                       String orderByClause)
ÀÚ¹Ùµ¶À» ÀÚ¼¼ÇÏ°Ô ÀÛ¼ºÇÑ´Ù.

Parameters:
orderByClause -
whereClause -
query -
Returns:
String

getDmlType

public static int getDmlType(String queryStmt)
Parameters:
queryStmt -
Returns:
int - 2 : update, 3 : insert, 4 : delete

getBindingName

public static String getBindingName(String str)
Internal Use only.
 Code : 
 String name = GlueQueryStringHelper.getBindingName("empno=:EmpnoP");
 System.out.println(name);
 
 Result : 
 EmpnoP
 

Parameters:
str -
Returns:
String

makeOrderByClause

public static String makeOrderByClause(String str1,
                                       String str2)
Internal Use only.
 Code : 
 String orderby = GlueQueryStringHelper.makeOrderByClause("deptno asc","empno");
 System.out.println(orderby);
 
 Result : 
 deptno asc, empno
 

Parameters:
str1 -
str2 -
Returns:
String


Copyright © 2013–2014 POSCO ICT SWÁ¦Ç°±â¼úÆÀ. All rights reserved.