blob

How to render a blob on a canvas element?

假如想象 提交于 2019-12-22 10:00:08
问题 How to render an image blob to a canvas element? So far i have these two (simplified) functions to capture an image, transform it to a blob and eventually render the blob on a canvas in this codepen, it just returns the default black image. var canvas = document.getElementById('canvas'); var input = document.getElementById('input'); var ctx = canvas.getContext('2d'); var photo; function picToBlob() { var file = input.files[0]; canvas.toBlob(function(blob) { var newImg = document.createElement

The first argument to execute must be a string or unicode query

你说的曾经没有我的故事 提交于 2019-12-22 08:46:38
问题 I am trying to upload a blob data to ms-sql db, using pyodbc. And I get "the first argument to execute must be a string or unicode query" error. The code is file = pyodbc.Binary(open("some_pdf_file.pdf", "r").read()) cur.execute("INSERT INTO BlobDataForPDF(ObjectID, FileData, Extension) VALUES ('1', " + file + ", '.PDF')") cur.commit() The first argument, ObjectID, is sent as a string. I don't see any problem but am I missing something? 回答1: Use parameterized insert: file = pyodbc.Binary(open

HSQLDB and .lobs file size

不问归期 提交于 2019-12-22 07:04:42
问题 I'm using a HSQLDB database in Java which stores files in a column defined as a BLOB. When I add a table row with a file/BLOB to my table the .lobs file increases in size of the file/BLOB. When I add another file to my table it increases in size again (2 x BLOB size). So, I implemented a test method which iterates 10 times and writes the same file to my table and deletes it right after the insert. Now, my .lobs file is 10 x file size... even though I've deleted all the table rows which

How do I use the BLOB data type with Hibernate?

耗尽温柔 提交于 2019-12-22 05:30:19
问题 I am retrieving a blob field containing JSON file from Oracle 10g database. I want to convert it in to a string in my DAO and give it to an incoming service request. My entity class is: @Lob @Column(name = "DTA_BLOB") private Blob DataBlob; /** * @return the DataBlob * */ public Blob getDataBlob(){ return DataBlob; } /** * @param DataBlob the DataBlob to set */ public void setDataBlob(Blob DataBlob) { this.DataBlob = DataBlob; } My DAO have the method to get the string from the blob as shown

How do I send a Blob of type octet/stream to server using AJAX?

拥有回忆 提交于 2019-12-22 05:26:42
问题 I have unsuccessfully been trying to send a Blob file (which is an .OBJ file type) to the server using AJAX. I want to be able to do this without using an input file field. I am making an online avatar creator, so the Blob file to be sent to the server is generated from the character that is initially imported into my Three.js scene. I have been able to send a Blob file that contains a String to the server and save this to a specified folder (which I am aiming to do with the Blob .OBJ file).

Hibernate 4.2.2 create blob from unknown-length input stream

江枫思渺然 提交于 2019-12-22 04:46:10
问题 Hi i want to create a blob in hibernate from an inputstream, but i don't know the length of the stream. Hibernate.getLobCreator(sessionFactory.getCurrentSession()).createBlob(stream, length) how can i crate a blob without knowing the length of the stream? EDIT1 in older hibernate versions it was possible http://viralpatel.net/blogs/tutorial-save-get-blob-object-spring-3-mvc-hibernate/ Blob blob = Hibernate.createBlob(file.getInputStream()); EDIT2 ok but it had an buggy implementation return

Create thumbnail from image and insert in SQLite as blob

放肆的年华 提交于 2019-12-22 01:43:24
问题 I'd like to create a thumbnail from an image and then insert that thumbnail in SQLite as BLOB. (without saving thumbnail as file first) My code; from PIL import Image size = 120,120 file = "a.jpg" imgobj = Image.open(file) imgobj.thumbnail(size) But how to save it to SQLite as BLOB 回答1: Well, there are many ways, and this is one of them: import sqlite3 from PIL import Image size = 120, 120 file = "/tmp/a.jpg" imgobj = Image.open(file) imgobj.thumbnail(size) con = sqlite3.connect("/tmp

FILESTREAM files being left behind after row deleted

最后都变了- 提交于 2019-12-22 01:26:31
问题 I have successfully set up FILESTREAM on my SQL 2008 server; however I've noticed that even when I have deleted rows containing FILESTREAM data, the physical data file doesn't seem to get deleted. By the physical file, I mean the file in SQLServer's managed directory with a uniqueidentifer as the filename not the original file added to the dbase. Does anyone know if SQLServer will delete the file eventually? If there are a lot of large files removed from the dbase I'd expect to be able to

Search for value within BLOB column in MySQL

我怕爱的太早我们不能终老 提交于 2019-12-22 01:26:27
问题 How can I search inside Blob column in MySQL for some values ? and Is that possible ? 回答1: You should be able to search blobs like other text fields: SELECT * FROM tablename WHERE blob_field_name LIKE '%value%' One thing to notice is that search will be case-sensitive! Anyway, if possible, it's better to use a TEXT field. 回答2: If you want to make it work for both uppercase, lowercase or mixed... Make the search string in lower case before applying in mysql query and use LOWER() mysql function

BLOB data returned in MySQL using AES_DECRYPT with ORDER clause

ⅰ亾dé卋堺 提交于 2019-12-22 00:05:26
问题 I'm creating a system in which users can store messages via PHP with a MySQL database, and I am using the MySQL AES_ENCRYPT function to encrypt the contents of these messages. Here is my posts table: CREATE TABLE IF NOT EXISTS `posts` ( `id` int(11) NOT NULL AUTO_INCREMENT, `user` int(11) DEFAULT NULL, `group` int(11) DEFAULT NULL, `body` varbinary(1000) NOT NULL, `ip` varchar(45) NOT NULL, `date` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, `replyto` int(11) DEFAULT NULL, PRIMARY KEY (`id`)