core: Move datetime.rs to vdbe/

The file contains SQL functions invoked by the VDBE so let's move the
file there.
This commit is contained in:
Pekka Enberg
2024-08-02 17:29:19 +03:00
parent 9c479734be
commit 0affdada2a
3 changed files with 8 additions and 8 deletions

View File

@@ -1,4 +1,3 @@
mod datetime;
mod error;
mod function;
mod io;

View File

@@ -21,7 +21,8 @@ pub mod builder;
pub mod explain;
pub mod sorter;
use crate::datetime::{exec_date, exec_time};
mod datetime;
use crate::error::LimboError;
use crate::function::{AggFunc, ScalarFunc};
use crate::pseudo::PseudoCursor;
@@ -31,6 +32,8 @@ use crate::storage::{btree::BTreeCursor, pager::Pager};
use crate::types::{AggContext, Cursor, CursorResult, OwnedRecord, OwnedValue, Record};
use crate::Result;
use datetime::{exec_date, exec_time};
use regex::Regex;
use std::borrow::BorrowMut;
use std::cell::RefCell;
@@ -1277,9 +1280,8 @@ impl Program {
}
ScalarFunc::Date => {
if *start_reg == 0 {
let date_str = exec_date(&OwnedValue::Text(Rc::new(
"now".to_string(),
)))?;
let date_str =
exec_date(&OwnedValue::Text(Rc::new("now".to_string())))?;
state.registers[*dest] = OwnedValue::Text(Rc::new(date_str));
} else {
let time_value = &state.registers[*start_reg];
@@ -1300,9 +1302,8 @@ impl Program {
}
ScalarFunc::Time => {
if *start_reg == 0 {
let time_str = exec_time(&OwnedValue::Text(
Rc::new("now".to_string()),
))?;
let time_str =
exec_time(&OwnedValue::Text(Rc::new("now".to_string())))?;
state.registers[*dest] = OwnedValue::Text(Rc::new(time_str));
} else {
let datetime_value = &state.registers[*start_reg];