pub enum Writes {
No,
Yes,
PerStatement,
}Expand description
What a command does to the database, for the two questions that asks.
Three states rather than two, because run is neither (task-2066
section 4.2, item 26). The flag this replaces answered one question with
one bit and two different callers read it: --readonly refuses a command
that writes, and a command that writes creates the file it was pointed at.
run drives the shell, so it may do either, and marking it true refused
inillucent --readonly run "SELECT count(*) FROM t;" and the
inillucent_run MCP tool with it - while marking it false would stop
inillucent --db new.rdb run ".read schema.sql" from making the file.
The shell it drives already refuses a write statement by statement when it
is read only, from inillucent_driver::readonly::admits, which is the same
classification Context::refuse_if_it_writes and the driver use. So run
needs the verb gate to stand aside and let that refusal happen, which is
the third state.
Variants§
No
It only reads. --readonly admits it and it never creates a file.
Yes
It changes the database. --readonly refuses it by name.
PerStatement
It may change the database, and refuses each statement that does.
--readonly admits the verb and the shell underneath refuses the
writes, one statement at a time, with “attempt to write a readonly
database”.
Implementations§
Source§impl Writes
impl Writes
Sourcepub fn refused_when_read_only(self) -> bool
pub fn refused_when_read_only(self) -> bool
Whether --readonly refuses this command before it runs.
Sourcepub fn may_create(self) -> bool
pub fn may_create(self) -> bool
Whether this command may create the database file it was pointed at.
A read verb does not make the file it was pointed at, so
inillucent --db typo.rdb tables reports a missing database rather
than leaving an empty one behind. run may, because
sqlite3 new.db ".read schema.sql" does.
Trait Implementations§
impl Copy for Writes
impl Eq for Writes
impl StructuralPartialEq for Writes
Auto Trait Implementations§
impl Freeze for Writes
impl RefUnwindSafe for Writes
impl Send for Writes
impl Sync for Writes
impl Unpin for Writes
impl UnsafeUnpin for Writes
impl UnwindSafe for Writes
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more