Another progress commit
This commit is contained in:
parent
861069abe7
commit
834cd358b6
@ -39,6 +39,10 @@ impl DefaultDriver {
|
||||
}
|
||||
|
||||
impl DatabaseDriver for DefaultDriver {
|
||||
// fn query(&self, sql: &str) -> Result<(), ()> {
|
||||
// Ok(())
|
||||
// }
|
||||
|
||||
fn explain(&self, sql: &str) -> String {
|
||||
format!("EXPLAIN {}", sql)
|
||||
}
|
||||
|
@ -24,6 +24,10 @@ impl DatabaseDriver for MSSQL {
|
||||
('[', ']')
|
||||
}
|
||||
|
||||
// fn query(&self, sql: &str) -> Result<(), ()> {
|
||||
// unimplemented!();
|
||||
// }
|
||||
|
||||
fn explain(&self, sql: &str) -> String {
|
||||
sql.to_string()
|
||||
}
|
||||
|
@ -23,6 +23,10 @@ impl DatabaseDriver for MySQLDriver {
|
||||
('`', '`')
|
||||
}
|
||||
|
||||
// fn query(&self, sql: &str) -> Result<(), ()> {
|
||||
// unimplemented!();
|
||||
// }
|
||||
|
||||
fn limit(&self, sql: &str, limit: Option<usize>, offset: Option<usize>) -> String {
|
||||
if limit.is_none() {
|
||||
return sql.to_string();
|
||||
|
@ -1,20 +1,33 @@
|
||||
//! Database Driver for SQLite
|
||||
//!
|
||||
//! Use of this driver requires enabling the `sqlite` feature.
|
||||
//!
|
||||
//! Contains database-specific query data
|
||||
use super::*;
|
||||
|
||||
use slite::{Connection};
|
||||
use std::cell::RefCell;
|
||||
|
||||
/// The struct implementing the `DatabaseDriver` trait
|
||||
#[derive(Debug)]
|
||||
pub struct SQLiteDriver;
|
||||
pub struct SQLiteDriver {
|
||||
connection: RefCell<Option<Connection>>
|
||||
}
|
||||
|
||||
impl SQLiteDriver {
|
||||
/// Create an SQLiteDriver driver
|
||||
pub fn new() -> Self {
|
||||
SQLiteDriver {}
|
||||
SQLiteDriver {
|
||||
connection: RefCell::new(None)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl DatabaseDriver for SQLiteDriver {
|
||||
// fn query(&self, sql: &str) -> Result<(), ()> {
|
||||
// unimplemented!();
|
||||
// }
|
||||
|
||||
fn explain(&self, sql: &str) -> String {
|
||||
format!("EXPLAIN QUERY PLAN {}", sql)
|
||||
}
|
||||
|
20
src/types.rs
20
src/types.rs
@ -6,12 +6,20 @@ struct Type(pub Box<dyn Any>);
|
||||
|
||||
/// Enum struct for mapping between database and Rust types
|
||||
#[derive(Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Debug, Hash)]
|
||||
enum SQLType<T> {
|
||||
Boolean(T),
|
||||
SmallInt(T),
|
||||
BigInt(T),
|
||||
Text(T),
|
||||
None,
|
||||
struct SQLType<T> {
|
||||
value: Option<T>,
|
||||
}
|
||||
|
||||
fn is_str(s: &(dyn Any)) {
|
||||
s.is::<&str>()
|
||||
}
|
||||
|
||||
fn is_string(s: &(dyn Any)) {
|
||||
s.is::<String>()
|
||||
}
|
||||
|
||||
fn is_bool(v: &(dyn Any)) {
|
||||
v.is::<bool>()
|
||||
}
|
||||
|
||||
impl<T> SQLType<T> {
|
||||
|
Loading…
Reference in New Issue
Block a user