pub struct OptimizeTableStatement { /* private fields */ }Expand description
OPTIMIZE TABLE statement builder
This struct provides a fluent API for constructing OPTIMIZE TABLE queries. OPTIMIZE TABLE reorganizes the physical storage of table data and associated index data.
MySQL-only: Other backends will panic with a helpful error message.
§Examples
use reinhardt_query::prelude::*;
// OPTIMIZE TABLE users
let query = Query::optimize_table()
.table("users");
// OPTIMIZE NO_WRITE_TO_BINLOG TABLE users, posts
let query = Query::optimize_table()
.table("users")
.table("posts")
.no_write_to_binlog();
// OPTIMIZE LOCAL TABLE users
let query = Query::optimize_table()
.table("users")
.local();Implementations§
Source§impl OptimizeTableStatement
impl OptimizeTableStatement
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new OPTIMIZE TABLE statement
§Examples
use reinhardt_query::prelude::*;
let query = Query::optimize_table();Sourcepub fn take(&mut self) -> Self
pub fn take(&mut self) -> Self
Take the ownership of data in the current OptimizeTableStatement
Sourcepub fn table<T>(&mut self, table: T) -> &mut Selfwhere
T: IntoIden,
pub fn table<T>(&mut self, table: T) -> &mut Selfwhere
T: IntoIden,
Add a table to optimize
§Examples
use reinhardt_query::prelude::*;
let query = Query::optimize_table()
.table("users");Sourcepub fn no_write_to_binlog(&mut self) -> &mut Self
pub fn no_write_to_binlog(&mut self) -> &mut Self
Set NO_WRITE_TO_BINLOG option
Suppresses binary logging for this operation (same as LOCAL).
§Examples
use reinhardt_query::prelude::*;
let query = Query::optimize_table()
.table("users")
.no_write_to_binlog();Sourcepub fn local(&mut self) -> &mut Self
pub fn local(&mut self) -> &mut Self
Set LOCAL option
Suppresses binary logging for this operation (same as NO_WRITE_TO_BINLOG).
§Examples
use reinhardt_query::prelude::*;
let query = Query::optimize_table()
.table("users")
.local();Sourcepub fn options(&mut self, opt: OptimizeTableOption) -> &mut Self
pub fn options(&mut self, opt: OptimizeTableOption) -> &mut Self
Set options from OptimizeTableOption
§Examples
use reinhardt_query::prelude::*;
use reinhardt_query::types::OptimizeTableOption;
let opt = OptimizeTableOption::new().no_write_to_binlog(true);
let query = Query::optimize_table()
.table("users")
.options(opt);Trait Implementations§
Source§impl Clone for OptimizeTableStatement
impl Clone for OptimizeTableStatement
Source§fn clone(&self) -> OptimizeTableStatement
fn clone(&self) -> OptimizeTableStatement
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OptimizeTableStatement
impl Debug for OptimizeTableStatement
Source§impl Default for OptimizeTableStatement
impl Default for OptimizeTableStatement
Source§fn default() -> OptimizeTableStatement
fn default() -> OptimizeTableStatement
Returns the “default value” for a type. Read more
Source§impl QueryStatementBuilder for OptimizeTableStatement
impl QueryStatementBuilder for OptimizeTableStatement
Source§fn build_any(&self, query_builder: &dyn QueryBuilderTrait) -> (String, Values)
fn build_any(&self, query_builder: &dyn QueryBuilderTrait) -> (String, Values)
Build SQL statement for a database backend and collect query parameters Read more
impl QueryStatementWriter for OptimizeTableStatement
Auto Trait Implementations§
impl Freeze for OptimizeTableStatement
impl !RefUnwindSafe for OptimizeTableStatement
impl !Send for OptimizeTableStatement
impl !Sync for OptimizeTableStatement
impl Unpin for OptimizeTableStatement
impl UnsafeUnpin for OptimizeTableStatement
impl !UnwindSafe for OptimizeTableStatement
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more