mirror of
https://github.com/aljazceru/turso.git
synced 2026-02-06 16:54:23 +01:00
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:
@@ -1,4 +1,3 @@
|
||||
mod datetime;
|
||||
mod error;
|
||||
mod function;
|
||||
mod io;
|
||||
|
||||
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user