/*
* 개요 : 글삭제
* 작성일 : 2005-08-12
* 작성자 : 김길재
* 수정자 :
*/
public String delete( String board_code ,
String board_no ,
String board_grade ,
String write_date )
{
try
{
con = DriverManager.getConnection(ConnectionPoolManager.URL_PREFIX+"multiboard");
sql = " DELETE FROM BOARD ";
sql += " WHERE BOARD_CODE = ? ";
sql += " AND BOARD_NO = ? ";
sql += " AND BOARD_GRADE = ? ";
sql += " AND WRITE_DATE = ? ";
pstmt = con.prepareStatement(sql);
pstmt.setString( 1 , board_code );
pstmt.setInt( 2 , Integer.parseInt( board_no ) );
pstmt.setInt( 3 , Integer.parseInt( board_grade ) );
pstmt.setString( 4 , write_date );
pstmt.executeUpdate();
con.commit();
return "success";
}
catch( Exception e )
{
try
{
con.rollback();
}
catch( Exception e1 )
{}
KKJLog.info( "//////////////////////////////////////////////" );
KKJLog.info( "delete Error : " + e.toString() );
KKJLog.info( "//////////////////////////////////////////////" );
return "fail";
}
finally
{
try
{
if ( rs != null )
rs.close();
if ( pstmt != null )
pstmt.close();
if ( con != null )
con.close();
}
catch ( Exception ignore )
{
}
}
}
/*
* 개요 : 게시판 번호 최고값 리턴
* 작성일 : 2005-08-13
* 작성자 : 김길재
* 수정자 :
*/
public int max_no( String board_code )
{
int max_no = 0;
try
{
con = DriverManager.getConnection(ConnectionPoolManager.URL_PREFIX+"multiboard");
String sql = " SELECT MAX( BOARD_NO )";
sql += " FROM BOARD ";
sql += " WHERE BOARD_CODE = ? ";
pstmt = con.prepareStatement(sql);
pstmt.setString( 1 , board_code );
rs = pstmt.executeQuery();
if(rs.next())
{
max_no = rs.getInt( 1 );
}
con.commit();
}
catch (Exception e)
{
try
{
con.rollback();
}
catch( Exception e1 )
{}
KKJLog.info( "//////////////////////////////////////////////" );
KKJLog.info( "max_no Error : " + e.toString() );
KKJLog.info( "//////////////////////////////////////////////" );
return 0;
}
finally
{
try
{
if ( rs != null )
rs.close();
if ( pstmt != null )
pstmt.close();
if ( con != null )
con.close();
}
catch ( Exception ignore )
{
}
}
return max_no;
}
/*
* 개요 : 게시물 조회수 증가
* 작성일 : 2005-08-13
* 작성자 : 김길재
* 수정자 :
*/
public void update_hit( String board_code ,
String board_no ,
String board_grade ,
String write_date )
{
try
{
con = DriverManager.getConnection(ConnectionPoolManager.URL_PREFIX+"multiboard");
String sql = " UPDATE BOARD SET HIT = HIT + 1 ";
sql += " WHERE BOARD_CODE = ? ";
sql += " AND BOARD_NO = ? ";
sql += " AND BOARD_GRADE = ? ";
sql += " AND WRITE_DATE = ? ";
pstmt = con.prepareStatement(sql);
pstmt.setString( 1 , board_code );
pstmt.setInt( 2 , Integer.parseInt( board_no ) );
pstmt.setInt( 3 , Integer.parseInt( board_grade ) );
pstmt.setString( 4 , write_date );
pstmt.executeUpdate();
con.commit();
}
catch (Exception e)
{
try
{
con.rollback();
}
catch( Exception e1 )
{}
KKJLog.info( "//////////////////////////////////////////////" );
KKJLog.info( "update_hit Error : " + e.toString() );
KKJLog.info( "//////////////////////////////////////////////" );
}
finally
{
try
{
if ( rs != null )
rs.close();
if ( pstmt != null )
pstmt.close();
if ( con != null )
con.close();
}
catch ( Exception ignore )
{
}
}
}
/*
* 개요 : 현재 시간( 초단위 ) 리턴
* 작성일 : 2005-08-15
* 작성자 : 김길재
* 수정자 :
*/
public String getCurrentTime()
{
String time = null;
try
{
con = DriverManager.getConnection(ConnectionPoolManager.URL_PREFIX+"multiboard");
sql = " SELECT TO_CHAR( SYSDATE , 'YYYY/MM/DD HH24:MI:SS' )";
sql += " FROM DUAL ";
pstmt = con.prepareStatement(sql);
rs = pstmt.executeQuery();
if(rs.next())
{
time = rs.getString( 1 );
}
con.commit();
}
catch (Exception e)
{
try
{
con.rollback();
}
catch( Exception e1 )
{}
KKJLog.info( "//////////////////////////////////////////////" );
KKJLog.info( "getTime() Error : " + e.toString() );
KKJLog.info( "//////////////////////////////////////////////" );
return null;
}
finally
{
try
{
if ( rs != null )
rs.close();
if ( pstmt != null )
pstmt.close();
if ( con != null )
con.close();
}
catch ( Exception ignore )
{
}
}
return time;
}
/*
* 개요 : 해당 게시판의 게시물 갯수 리턴
* 작성일 : 2005-08-16
* 작성자 : 김길재
* 수정자 :
*/
public int count( String board_code )
{
int count = 0;
try
{
con = DriverManager.getConnection(ConnectionPoolManager.URL_PREFIX+"multiboard");
String sql = " SELECT COUNT( * )";
sql += " FROM BOARD ";
sql += " WHERE BOARD_CODE = ? ";
pstmt = con.prepareStatement(sql);
pstmt.setString( 1 , board_code );
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt( 1 );
}
con.commit();
}
catch (Exception e)
{
try
{
con.rollback();
}
catch( Exception e1 )
{}
KKJLog.info( "//////////////////////////////////////////////" );
KKJLog.info( "count Error : " + e.toString() );
KKJLog.info( "//////////////////////////////////////////////" );
return 0;
}
finally
{
try
{
if ( rs != null )
rs.close();
if ( pstmt != null )
pstmt.close();
if ( con != null )
con.close();
}
catch ( Exception ignore )
{
}
}
return count;
}
/*
* 개요 : 해당 게시판의 게시물 갯수 리턴
* 작성일 : 2005-08-16
* 작성자 : 김길재
* 수정자 :
*/
public int count( String board_code , String search_type , String search_keyword )
{
int count = 0;
try
{
con = DriverManager.getConnection(ConnectionPoolManager.URL_PREFIX+"multiboard");
String sql = " SELECT COUNT( * )";
sql += " FROM BOARD ";
sql += " WHERE BOARD_CODE = ? ";
sql += " AND " + search_type + " LIKE '%' || ? || '%' ";
pstmt = con.prepareStatement(sql);
pstmt.setString( 1 , board_code );
pstmt.setString( 2 , Util.uni2ksc( search_keyword ) );
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt( 1 );
}
con.commit();
}
catch (Exception e)
{
try
{
con.rollback();
}
catch( Exception e1 )
{}
KKJLog.info( "//////////////////////////////////////////////" );
KKJLog.info( "count( String , String , String ) Error : " + e.toString() );
KKJLog.info( "//////////////////////////////////////////////" );
return 0;
}
finally
{
try
{
if ( rs != null )
rs.close();
if ( pstmt != null )
pstmt.close();
if ( con != null )
con.close();
}
catch ( Exception ignore )
{
}
}
return count;
}
}
* 개요 : 글삭제
* 작성일 : 2005-08-12
* 작성자 : 김길재
* 수정자 :
*/
public String delete( String board_code ,
String board_no ,
String board_grade ,
String write_date )
{
try
{
con = DriverManager.getConnection(ConnectionPoolManager.URL_PREFIX+"multiboard");
sql = " DELETE FROM BOARD ";
sql += " WHERE BOARD_CODE = ? ";
sql += " AND BOARD_NO = ? ";
sql += " AND BOARD_GRADE = ? ";
sql += " AND WRITE_DATE = ? ";
pstmt = con.prepareStatement(sql);
pstmt.setString( 1 , board_code );
pstmt.setInt( 2 , Integer.parseInt( board_no ) );
pstmt.setInt( 3 , Integer.parseInt( board_grade ) );
pstmt.setString( 4 , write_date );
pstmt.executeUpdate();
con.commit();
return "success";
}
catch( Exception e )
{
try
{
con.rollback();
}
catch( Exception e1 )
{}
KKJLog.info( "//////////////////////////////////////////////" );
KKJLog.info( "delete Error : " + e.toString() );
KKJLog.info( "//////////////////////////////////////////////" );
return "fail";
}
finally
{
try
{
if ( rs != null )
rs.close();
if ( pstmt != null )
pstmt.close();
if ( con != null )
con.close();
}
catch ( Exception ignore )
{
}
}
}
/*
* 개요 : 게시판 번호 최고값 리턴
* 작성일 : 2005-08-13
* 작성자 : 김길재
* 수정자 :
*/
public int max_no( String board_code )
{
int max_no = 0;
try
{
con = DriverManager.getConnection(ConnectionPoolManager.URL_PREFIX+"multiboard");
String sql = " SELECT MAX( BOARD_NO )";
sql += " FROM BOARD ";
sql += " WHERE BOARD_CODE = ? ";
pstmt = con.prepareStatement(sql);
pstmt.setString( 1 , board_code );
rs = pstmt.executeQuery();
if(rs.next())
{
max_no = rs.getInt( 1 );
}
con.commit();
}
catch (Exception e)
{
try
{
con.rollback();
}
catch( Exception e1 )
{}
KKJLog.info( "//////////////////////////////////////////////" );
KKJLog.info( "max_no Error : " + e.toString() );
KKJLog.info( "//////////////////////////////////////////////" );
return 0;
}
finally
{
try
{
if ( rs != null )
rs.close();
if ( pstmt != null )
pstmt.close();
if ( con != null )
con.close();
}
catch ( Exception ignore )
{
}
}
return max_no;
}
/*
* 개요 : 게시물 조회수 증가
* 작성일 : 2005-08-13
* 작성자 : 김길재
* 수정자 :
*/
public void update_hit( String board_code ,
String board_no ,
String board_grade ,
String write_date )
{
try
{
con = DriverManager.getConnection(ConnectionPoolManager.URL_PREFIX+"multiboard");
String sql = " UPDATE BOARD SET HIT = HIT + 1 ";
sql += " WHERE BOARD_CODE = ? ";
sql += " AND BOARD_NO = ? ";
sql += " AND BOARD_GRADE = ? ";
sql += " AND WRITE_DATE = ? ";
pstmt = con.prepareStatement(sql);
pstmt.setString( 1 , board_code );
pstmt.setInt( 2 , Integer.parseInt( board_no ) );
pstmt.setInt( 3 , Integer.parseInt( board_grade ) );
pstmt.setString( 4 , write_date );
pstmt.executeUpdate();
con.commit();
}
catch (Exception e)
{
try
{
con.rollback();
}
catch( Exception e1 )
{}
KKJLog.info( "//////////////////////////////////////////////" );
KKJLog.info( "update_hit Error : " + e.toString() );
KKJLog.info( "//////////////////////////////////////////////" );
}
finally
{
try
{
if ( rs != null )
rs.close();
if ( pstmt != null )
pstmt.close();
if ( con != null )
con.close();
}
catch ( Exception ignore )
{
}
}
}
/*
* 개요 : 현재 시간( 초단위 ) 리턴
* 작성일 : 2005-08-15
* 작성자 : 김길재
* 수정자 :
*/
public String getCurrentTime()
{
String time = null;
try
{
con = DriverManager.getConnection(ConnectionPoolManager.URL_PREFIX+"multiboard");
sql = " SELECT TO_CHAR( SYSDATE , 'YYYY/MM/DD HH24:MI:SS' )";
sql += " FROM DUAL ";
pstmt = con.prepareStatement(sql);
rs = pstmt.executeQuery();
if(rs.next())
{
time = rs.getString( 1 );
}
con.commit();
}
catch (Exception e)
{
try
{
con.rollback();
}
catch( Exception e1 )
{}
KKJLog.info( "//////////////////////////////////////////////" );
KKJLog.info( "getTime() Error : " + e.toString() );
KKJLog.info( "//////////////////////////////////////////////" );
return null;
}
finally
{
try
{
if ( rs != null )
rs.close();
if ( pstmt != null )
pstmt.close();
if ( con != null )
con.close();
}
catch ( Exception ignore )
{
}
}
return time;
}
/*
* 개요 : 해당 게시판의 게시물 갯수 리턴
* 작성일 : 2005-08-16
* 작성자 : 김길재
* 수정자 :
*/
public int count( String board_code )
{
int count = 0;
try
{
con = DriverManager.getConnection(ConnectionPoolManager.URL_PREFIX+"multiboard");
String sql = " SELECT COUNT( * )";
sql += " FROM BOARD ";
sql += " WHERE BOARD_CODE = ? ";
pstmt = con.prepareStatement(sql);
pstmt.setString( 1 , board_code );
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt( 1 );
}
con.commit();
}
catch (Exception e)
{
try
{
con.rollback();
}
catch( Exception e1 )
{}
KKJLog.info( "//////////////////////////////////////////////" );
KKJLog.info( "count Error : " + e.toString() );
KKJLog.info( "//////////////////////////////////////////////" );
return 0;
}
finally
{
try
{
if ( rs != null )
rs.close();
if ( pstmt != null )
pstmt.close();
if ( con != null )
con.close();
}
catch ( Exception ignore )
{
}
}
return count;
}
/*
* 개요 : 해당 게시판의 게시물 갯수 리턴
* 작성일 : 2005-08-16
* 작성자 : 김길재
* 수정자 :
*/
public int count( String board_code , String search_type , String search_keyword )
{
int count = 0;
try
{
con = DriverManager.getConnection(ConnectionPoolManager.URL_PREFIX+"multiboard");
String sql = " SELECT COUNT( * )";
sql += " FROM BOARD ";
sql += " WHERE BOARD_CODE = ? ";
sql += " AND " + search_type + " LIKE '%' || ? || '%' ";
pstmt = con.prepareStatement(sql);
pstmt.setString( 1 , board_code );
pstmt.setString( 2 , Util.uni2ksc( search_keyword ) );
rs = pstmt.executeQuery();
if(rs.next())
{
count = rs.getInt( 1 );
}
con.commit();
}
catch (Exception e)
{
try
{
con.rollback();
}
catch( Exception e1 )
{}
KKJLog.info( "//////////////////////////////////////////////" );
KKJLog.info( "count( String , String , String ) Error : " + e.toString() );
KKJLog.info( "//////////////////////////////////////////////" );
return 0;
}
finally
{
try
{
if ( rs != null )
rs.close();
if ( pstmt != null )
pstmt.close();
if ( con != null )
con.close();
}
catch ( Exception ignore )
{
}
}
return count;
}
}
댓글 없음:
댓글 쓰기