1234567891011121314151617181920212223242526272829303132333435363738 |
- package utils
- import (
- "fmt"
- "regexp"
- "strings"
- )
- func SplitSemicolon(sql string) (string, string) {
-
- semicolonIndex := strings.Index(sql, ";")
- if semicolonIndex != -1 {
-
- front := sql[:semicolonIndex+1]
- rear := sql[semicolonIndex+1:]
- return front, rear
- } else {
- fmt.Println("未找到分号。")
- return "", ""
- }
- }
- func ContainsKeyword(input string, keyword string) bool {
- return strings.Contains(input, keyword)
- }
- func IsInsertBlob(input string) int {
- re := regexp.MustCompile(`values\(([^)]*)\)`)
- match := re.FindStringSubmatch(input)
- if len(match) > 1 {
- return strings.Count(match[1], "?")
- }
- return 0
- }
|