/// <summary> /// Sends the specified file to the server. /// This supports the LOAD DATA LOCAL INFILE /// </summary> /// <param name="filename"></param> private void SendFileToServer(string filename) { byte[] buffer = new byte[8196]; long len = 0; try { using (FileStream fs = new FileStream(filename, FileMode.Open, FileAccess.Read)) { len = fs.Length; while (len > 0) { int count = fs.Read(buffer, 4, (int)(len > 8192 ? 8192 : len)); stream.SendEntirePacketDirectly(buffer, count); len -= count; } stream.SendEntirePacketDirectly(buffer, 0); } } catch (Exception ex) { throw new MySqlException("Error during LOAD DATA LOCAL INFILE", ex); } }
internal void SendEmptyPacket() { byte[] buffer = new byte[4]; stream.SendEntirePacketDirectly(buffer, 0); }