import java.sql.*;
class MK_Hotel
{
final FK_ConnectDB db;
static MK_Hotel hotel=null;
MK_Hotel()
{
db = FK_ConnectDB.getInstance("jdbc:
interbase://localhost/C:/hotelAdm.gdb","sysdba","masterkey");
hotel=this;
}
public void indsaetHotel(int hotelNr,String navn,String adresse)
{
db.insert("insert into hotels values("+hotelNr+",'"+navn+"','"+adresse+"')");
}
public ResultSet hentHotel()
{
return db.select( "select * from hotels");
}
public void sletHotel(int nr)
{
db.insert("delete from hotels where hotel_no = "+nr);
}
public int hotelTaeller()
{
int ialt=0;
try {
ResultSet row = db.select( "select count(*) from hotels" );
row.next();
ialt = row.getInt(1);
}
catch( SQLException cs )
{
System.out.println(cs);
}
return ialt;
}
public static MK_Hotel getInstance()
{
if(hotel==null) return new MK_Hotel();
else return hotel;
}
}