--------------------------
자바에서 LongRaw 예 --------------------------
1. 읽을때(detail이란 컬럼이 longraw 입니다.)
try{
InputStream vIcode =null;
BufferedReader vvcode =null;
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(" select name,title,detail,re_id,ip,count,to_char(ilsi,'dd/MON/yyyy(hh:mi)'),path,e_mail,root_id,depth from db_board where id = "+szID);
rs.next();
szName = rs.getString(1);
szTitle = rs.getString(2);
szDetail= hangul.han(new String(rs.getBytes(3),0));
szRe_Id = rs.getString(4);
szIp = rs.getString(5);
iCount = rs.getInt(6);
szIlsi = rs.getString(7);
szPath = rs.getString(8);
szE_mail = rs.getString(9);
szRoot_Id = rs.getString(10);
szDepth = rs.getString(11);
iCount++;
rs.close();
stmt.executeUpdate(" update db_board set count=count+1 where id = "+szID);
stmt.close();
}
2. 저장하는 예
PreparedStatement ps = con.prepareStatement("insert into db_board(id,re_id,name,title,detail,passwd,count,ip,ilsi,e_mail,is_re,board_gbn,path,root_id,depth) values (?,0,?,?,?,?,0,?,sysdate,?,'N',?,?,?,0)");
ps.setInt(1,iId);
ps.setString(2,hangul.han(szName));
ps.setString(3,hangul.han(szTitle));
//////////////////////////////////////////////////////////////////////////
StringBuffer szbWriteDetail = new StringBuffer();
for( int i = 0,len=szDetail.length() ; i < len ; i++){
if( szDetail.charAt(i) == ' ')
szbWriteDetail.append(" ");
else if( szDetail.charAt(i) == '<')
szbWriteDetail.append("<");
else if( szDetail.charAt(i) == '>')
szbWriteDetail.append(">");
else if( szDetail.charAt(i) == '\n')
szbWriteDetail.append("<br>");
else
szbWriteDetail.append(szDetail.charAt(i));
}
////////////////////////////////////////////////////////////////////////////
StringBufferInputStream abc = new StringBufferInputStream(szbWriteDetail.toString());
ps.setBinaryStream(4,abc,szbWriteDetail.length());
ps.setString(5,szPasswd);
ps.setString(6,szIp);
ps.setString(7,szE_mail);
ps.setString(8,szBoard_Gbn);
ps.setString(9,szPath);
ps.setInt(10,iId);
ps.executeUpdate( );
![]() | ![]() ![]() | 12-27 | 1639 | |
![]() | ![]() ![]() | 12-11 | 1165 | |
53 | ![]() ![]() | 03-15 | 924 | |
52 | ![]() ![]() | 01-31 | 1088 | |
51 | ![]() ![]() | 01-31 | 827 | |
50 | ![]() ![]() | 01-31 | 784 | |
49 | ![]() ![]() | 01-19 | 1055 | |
48 | ![]() ![]() | 01-11 | 953 | |
47 | ![]() ![]() | 01-03 | 1459 | |
46 | ![]() ![]() | 12-27 | 1639 | |
45 | ![]() ![]() | 12-19 | 1184 | |
44 | ![]() ![]() | 12-14 | 1185 | |
43 | ![]() ![]() | 12-11 | 1165 | |
42 | ![]() ![]() | 12-09 | 937 | |
41 | ![]() ![]() | 12-01 | 1095 | |
40 | ![]() ![]() | 12-01 | 1359 | |
39 | ![]() ![]() | 12-01 | 829 |
댓글 없음:
댓글 쓰기