sql rust interaction file update
This commit is contained in:
@@ -14,39 +14,11 @@ impl DataBase {
|
||||
self.connection.execute(arg).unwrap();
|
||||
}
|
||||
|
||||
fn create_table(&self, table: String){
|
||||
self.data_execute("CREATE TABLE ".to_owned() + &table + ";");
|
||||
fn create_table(&self, table: String, var: String){
|
||||
self.data_execute("CREATE TABLE ".to_owned() + &table + "(" + &var + ");");
|
||||
}
|
||||
|
||||
fn add_column(&self, table: String, arg: String){
|
||||
self.data_execute("ALTER TABLE ".to_owned() + &table + " ADD " + &arg + ";");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pub fn main() {
|
||||
let db = DataBase::open(String::from("test"));
|
||||
db.create_table("test".to_string());
|
||||
db.add_column("test".to_string(), "name TEXT".to_string());
|
||||
// println!("Hello, world!");
|
||||
|
||||
// let connection = sqlite::open("test.db").unwrap();
|
||||
|
||||
// let query = "
|
||||
// CREATE TABLE users (name TEXT, age INTEGER);
|
||||
// INSERT INTO users VALUES ('Alice', 42);
|
||||
// INSERT INTO users VALUES ('Bob', 69);
|
||||
// ";
|
||||
|
||||
// connection.execute(query).unwrap();
|
||||
}
|
||||
// struct User {
|
||||
// name : string,
|
||||
// level : int,
|
||||
// }
|
||||
|
||||
// impl User {
|
||||
// fn Create(&self){
|
||||
|
||||
// }
|
||||
// }
|
||||
}
|
||||
Reference in New Issue
Block a user