|
|
@ -13,8 +13,10 @@ pub struct Db(pub Connection);
|
|
|
|
impl Db {
|
|
|
|
impl Db {
|
|
|
|
/// Open the database
|
|
|
|
/// Open the database
|
|
|
|
pub fn open<P: AsRef<Path>>(path: P) -> RudeResult<Self> {
|
|
|
|
pub fn open<P: AsRef<Path>>(path: P) -> RudeResult<Self> {
|
|
|
|
|
|
|
|
// open the database
|
|
|
|
let connection = try_log!(Connection::open(path), "Unable to open database");
|
|
|
|
let connection = try_log!(Connection::open(path), "Unable to open database");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// make sure the connected_players table is cleared out
|
|
|
|
{
|
|
|
|
{
|
|
|
|
let mut statement = try_log!(
|
|
|
|
let mut statement = try_log!(
|
|
|
|
connection.prepare("delete from connected_players;"),
|
|
|
|
connection.prepare("delete from connected_players;"),
|
|
|
|