Skip to content

infopark/mysql_blob_streaming

Folders and files

NameName
Last commit message
Last commit date
May 10, 2023
Aug 29, 2022
Mar 29, 2022
Oct 31, 2019
Aug 29, 2022
May 10, 2023
May 10, 2023
Apr 13, 2011
Mar 28, 2022
Mar 28, 2022
May 10, 2023

Repository files navigation

MysqlBlobStreaming

Build Status

A blob streaming extension for the native Ruby-MySQL2 adaptor. It provides the class MysqlBlobStreaming, which gives the mysql2 adaptor the ability of streaming blobs right out of the MySQL database.

(c) 2008-2012 Infopark AG. See MIT-LICENSE for licensing details.

Usage

require 'mysql_blob_streaming'
require 'mysql2'

client = Mysql2::Client.new(...)
query = "SELECT data FROM table_name WHERE id = '23'"
buffer_size = 1024000 # number of bytes per chunk

MysqlBlobStreaming.stream(client, query, buffer_size) do |chunk|
  # do something with the chunk e.g. write it to file.
end

Dependencies

Building

gem build mysql_blob_streaming.gemspec

Installation

Install it like any other Gem:

gem install mysql_blob_streaming-X.X.X.gem

Run it with root privileges if needed.

Development/Tests

rake