1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
//! Custom SQL dialect for file management operations.
//!
//! This module defines a custom SQL dialect that supports file-specific syntax
//! and keywords, building upon the sqlparser crate. The dialect is specifically
//! designed to handle file paths, file attributes, and file-specific operations
//! that regular SQL dialects might not support.
//!
//! # Features
//!
//! - Support for file system paths as identifiers (including ~, /, ., etc.)
//! - Recognition of file-specific attributes (size, modification time, etc.)
//! - Support for file path patterns and wildcards in queries
//!
//! # Examples
//!
//! This dialect allows SQL queries like:
//!
//! ```sql
//! -- Query with file paths
//! SELECT * FROM ~/Documents WHERE name LIKE '%.txt'
//!
//! -- Query with file attributes
//! SELECT * FROM /var/log WHERE size > 1000000 AND modified < '2023-01-01'
//!
//! -- Windows-style paths
//! SELECT * FROM C:/Users/Documents WHERE extension = 'pdf'
//! ```
use ;
/// A custom SQL dialect for file management operations.
///
/// This dialect extends the GenericDialect with specific syntax elements
/// for file operations, allowing SQL queries to reference file paths,
/// use file-specific attributes, and perform file management operations.
///
/// # Examples
///
/// The dialect can be used to parse SQL queries containing file paths:
///
/// ```no_run
/// use fmql::sql::dialect::FileDialect;
/// use sqlparser::parser::Parser;
///
/// let sql = "SELECT * FROM ~/Documents WHERE name LIKE '%.pdf'";
/// let dialect = FileDialect::default();
/// let ast = Parser::parse_sql(&dialect, sql).unwrap();
/// // Process the parsed AST...
/// ```