Skip to content

feat(mysql): support load data local infile#4265

Open
joelwurtz wants to merge 1 commit into
launchbadge:mainfrom
joelwurtz:feat/local-infile
Open

feat(mysql): support load data local infile#4265
joelwurtz wants to merge 1 commit into
launchbadge:mainfrom
joelwurtz:feat/local-infile

Conversation

@joelwurtz
Copy link
Copy Markdown

Hello,

This PR intend to add support for query like LOAD DATA LOCAL INFILE ...

It fixes #1766
I have taken some inspiration from this PR : #2738 (which has been closed)

I also look at the comment to see blockers of the previous PR, i think this one should be in the right direction :

  • It does not use a new buffer (it uses the same "hacky" implementation as pgsql by reserving four bytes before copy to existing buffer and rewrite it before flush)
  • It support directly the query LOAD DATA LOCAL INFILE there is no new api for end user
  • However it is generic enough in the implementation to be able to send any stream (which means we could create a new method above it to send any stream to mysql not just a file, not done in this PR as i think this is out of scope, let's just support the basic query for now
  • I added a new method to get an AsyncRead from any file so it can support all runtimes

The only thing that i'm not sure off, is the "hack" when copying the stream, since normal packet have a check for size excedding 16mb (0xFF_FF_FF) this is not done here to not complexify, but since the buffer capacity is 8192 i don't see case where this may happens ?

Let me know if this need to be checked also.

@joelwurtz joelwurtz force-pushed the feat/local-infile branch 3 times, most recently from c8b3067 to 6022947 Compare May 14, 2026 10:19
@joelwurtz joelwurtz force-pushed the feat/local-infile branch from 6022947 to e1cd86f Compare May 14, 2026 10:33
@joelwurtz joelwurtz changed the title feat(mysql): support load data infile feat(mysql): support load data local infile May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support LOAD DATA LOCAL INFILE command for MySQL

1 participant