From e64c57453f8f0d4a8ca696d1da1e6925902c4d49 Mon Sep 17 00:00:00 2001 From: Julien Schmidt Date: Fri, 26 Apr 2013 09:25:41 +0200 Subject: [PATCH] INFILE deregister functions Provide functions to remove ReaderHandler and filepaths from the registry --- infile.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/infile.go b/infile.go index 3485032e1..635dbd572 100644 --- a/infile.go +++ b/infile.go @@ -35,6 +35,11 @@ func RegisterLocalFile(filepath string) { fileRegister[strings.Trim(filepath, `"`)] = true } +// DeregisterLocalFile removes the given filepath from the whitelist. +func DeregisterLocalFile(filepath string) { + delete(fileRegister, strings.Trim(filepath, `"`)) +} + // RegisterReaderHandler registers a handler function which is used // to receive a io.Reader. // The Reader can be used by "LOAD DATA LOCAL INFILE Reader::". @@ -44,6 +49,12 @@ func RegisterReaderHandler(name string, handler func() io.Reader) { readerRegister[name] = handler } +// DeregisterReaderHandler removes the ReaderHandler function with +// the given name from the registry. +func DeregisterReaderHandler(name string) { + delete(readerRegister, name) +} + func (mc *mysqlConn) handleInFileRequest(name string) (err error) { var rdr io.Reader data := make([]byte, 4+mc.maxWriteSize)