Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add incremental blob support #4

Open
tenderlove opened this issue Jun 21, 2010 · 0 comments
Open

Add incremental blob support #4

tenderlove opened this issue Jun 21, 2010 · 0 comments
Labels

Comments

@tenderlove
Copy link
Member

BLOB-reading/writing can be done apart from SQL-Queries.


EXAMPLE:

..

filename = "test.png"

stmt = db.prepare("insert into files (filename, data) values (:filename,:data)")
stmt.bind_param("filename", filename)
stmt.bind_zeroblob("data", File.size(filename)
stmt.execute

f = File.new(filename, "w")

blob = db.blob_open('main','files','data',db.last_insert_row_id,1)
result = blob.write(f.read)

..


The space of the BLOB MUST be reserved. This can be done inside a SQL-query to:

"insert into files (filename, data) values ('test.png', zeroblob(2442))"

Moved from RubyForge

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants