public execdb() {
this.rst=null;
mydb=new myconnect();
this.boardid="";
this.recordid="";
istrue=false;
statement="";
}
public void setBoardid(String boardid)
{
this.boardid=boardid;
}
public void setRecordid(String recordid)
{
this.recordid=recordid;
}
public void setUserid(String userid){
this.userid=userid;
}
public String getUserid(){
return this.userid;
}
public String getBoardid(){
return this.boardid;
}
public String getRecordid(){
return this.recordid;
}
public void listit(String xx){
if (xx.equals("board"))
this.rst=mydb.myquery("select * from board") ;
if (xx.equals("record") )
this.rst=mydb.myquery("select * from record where boardid='" +this.boardid+"'");
if (xx.equals("contents"))
this.rst=mydb.myquery("select * from board where userid='"+this.userid+"' " );;
if (xx.equals("users"))
this.rst=mydb.myquery("select * from users ");
}
public void delit(String xx, String delid){
if (xx.equals("board"))
this.statement="delete from board where boardid='"+delid+"'";
if (xx.equals("record") )
this.statement="delete from record where recordid='"+delid+"'";
if (xx.equals("users"))
this.statement="delete from users where userid='"+delid+"'";
mydb.myupdate(this.statement );
}
public String getData(String colname)
{
String tempvalue="";
try{
if (this.rst.getString(colname)!=null)
tempvalue=this.rst.getString(colname);
else
tempvalue="";
}
catch(SQLException sqlexception){
System.err.println(sqlexception.getMessage());
}
return tempvalue;
}
public int countit(String recordid){
int countvalue=0;
rst=null;
String vv="select count(*) as aa from record where followid='"+recordid+"'";
try{
rst=mydb.myquery(vv) ;
if (rst.next())
countvalue=rst.getInt("aa");
else
countvalue=0;
}
catch(SQLException sqlexception){
System.err.println(sqlexception.getMessage());
}
return countvalue;
}
public int countit(){
int countvalue=0;
rst=null;
String vv="select count(*) as aa from record where followid='0' and boardid='"+this.boardid+"'";
try{
rst=mydb.myquery(vv) ;
if (rst.next())
countvalue=rst.getInt("aa");
else
countvalue=0;