Crates.io | sql-comment-parser |
lib.rs | sql-comment-parser |
version | 0.1.0 |
source | src |
created_at | 2024-03-17 12:20:55.133977 |
updated_at | 2024-03-17 12:20:55.133977 |
description | sql comment parser |
homepage | https://github.com/wpf375516041/sql-comment-parser |
repository | |
max_upload_size | |
id | 1176434 |
size | 20,884 |
移植于: https://github.com/wangjie-fourth/SqlParser/blob/main/src/main/java/myself/SqlCommentParser.java
解析sql语句中的注释,具备以下两个能力:
use sql_comment_parser::SqlCommentParser;
fn main() {
let sql = "SELECT * FROM table--; -- This is a single line comment";
let mut parser = SqlCommentParser::new(&sql);
let comment_sql = parser.get_comment_sql();
let cleaned_sql = parser.remove_comment_sql();
println!("{}", cleaned_sql); //打印SELECT * FROM table
println!("{}", comment_sql); //打印--; -- This is a single line comment
}
https://wangjie-fourth.github.io/2021/01/30/experience/remove-comment-in-sql/