📄 operatecomment.java
字号:
package comment;
import server.database.*;
import java.sql.*;
/**
* @author Administrator
*
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Templates.
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
public class operateComment {
commentData cd=new commentData();
Operation op=new Operation();
ResultSet rs;
boolean updated=false;
boolean insertData(String id,String ip,String datetime,String context)
{
String sql="insert into "+commentData.TABLE+" values(\'"+id+"\',\'"+ip+"\',\'"+datetime+"\',\'"+context+"\')";
System.out.println(sql);
try{int column=op.IDU(sql);
if(column==1)
return true;}
catch(ClassNotFoundException e){}
catch(SQLException e){}
catch(InstantiationException e){}
catch(IllegalAccessException e){}
return false;
}
ResultSet getRS(int t,String id)
{
String str="select * from "+commentData.TABLE+" where "+commentData.propety[0]+"=\'"+id+"\'";
try{
rs=op.select(str);
rs.last();
rs.next();
moveRS(t);
}
catch(ClassNotFoundException e){}
catch(SQLException e){System.out.println(33);}
catch(InstantiationException e){System.out.println(33);}
catch(IllegalAccessException e){System.out.println(33);}
return rs;
}
int CalSize(String id)
//throws SQLException,InstantiationException,IllegalAccessException,ClassNotFoundException
{
String sql="select * from "+commentData.TABLE+" where "+commentData.propety[0]+"=\'"+id+"\'";
ResultSet rs_temp=null;
int size=0;
int wholePage=0;
try{
if(rs_temp==null)
rs_temp=op.select(sql);
while(rs_temp.next())
{
size++;
}
rs_temp.close();}
catch(ClassNotFoundException e){}
catch(SQLException e){}
catch(InstantiationException e){}
catch(IllegalAccessException e){}
return size;
}
void moveRS(int t)
throws SQLException,InstantiationException,IllegalAccessException,ClassNotFoundException
{
t=(t-1)*cd.getContent();
while(t>0&&rs.previous())
{
t--;
}
System.out.print(t);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -