Extract table name from SELECT query
(&self, query: &str)
| 411 | |
| 412 | /// Extract table name from SELECT query |
| 413 | fn extract_table_name(&self, query: &str) -> Option<String> { |
| 414 | let query_upper = query.to_uppercase(); |
| 415 | |
| 416 | // Find FROM clause |
| 417 | if let Some(from_pos) = query_upper.find(" FROM ") { |
| 418 | let after_from = &query[from_pos + 6..].trim(); |
| 419 | |
| 420 | // Find end of table name |
| 421 | let end = after_from.find(' ') |
| 422 | .or_else(|| after_from.find(';')) |
| 423 | .or_else(|| after_from.find('\n')) |
| 424 | .unwrap_or(after_from.len()); |
| 425 | |
| 426 | let table_name = after_from[..end].trim(); |
| 427 | |
| 428 | // Remove quotes if present |
| 429 | let table_name = table_name.trim_matches('"').trim_matches('\''); |
| 430 | |
| 431 | if !table_name.is_empty() { |
| 432 | return Some(table_name.to_string()); |
| 433 | } |
| 434 | } |
| 435 | |
| 436 | None |
| 437 | } |
| 438 | |
| 439 | /// Classify query complexity for optimization decisions |
| 440 | fn classify_query_complexity(&self, query: &str) -> QueryComplexity { |
no test coverage detected