MCPcopy
hub / github.com/go-sql-driver/mysql / RegisterLocalFile

Function RegisterLocalFile

infile.go:36–45  ·  view source on GitHub ↗

RegisterLocalFile adds the given file to the file allowlist, so that it can be used by "LOAD DATA LOCAL INFILE ". Alternatively you can allow the use of all local files with the DSN parameter 'allowAllFiles=true' filePath := "/home/gopher/data.csv" mysql.RegisterLocalFile(filePath) err

(filePath string)

Source from the content-addressed store, hash-verified

34// if err != nil {
35// ...
36func RegisterLocalFile(filePath string) {
37 fileRegisterLock.Lock()
38 // lazy map init
39 if fileRegister == nil {
40 fileRegister = make(map[string]struct{})
41 }
42
43 fileRegister[strings.Trim(filePath, `"`)] = struct{}{}
44 fileRegisterLock.Unlock()
45}
46
47// DeregisterLocalFile removes the given filepath from the allowlist.
48func DeregisterLocalFile(filePath string) {

Callers 1

TestLoadDataFunction · 0.85

Calls 2

LockMethod · 0.80
UnlockMethod · 0.80

Tested by 1

TestLoadDataFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…