                     cb()
             (cb) =>
                 if rows.length == 0
-                    # nothing in DB, so we insert the blob.
+                    dbg("nothing in DB, so we insert the blob.")
                     ttl = opts.ttl
+                    dbg("blob='#{opts.blob}'; type=#{typeof(opts.blob)}")
                     @_query
                         query  : "INSERT INTO blobs"
                         values :
                             id         : opts.uuid
-                            blob       : opts.blob
+                            blob       : '\\x'+opts.blob.toString('hex')
                             project_id : opts.project_id
                             count      : 0
                             size       : opts.blob.length

                            expire     : if ttl then expire_time(ttl)
                        cb     : cb
                else
                    # blob already in the DB, so see if we need to change the expire time
                    @_extend_blob_ttl
                        expire : rows[0].expire
                        ttl    : opts.ttl

                        rows = x.rows; cb(err)
            (cb) =>
                if rows.length == 0 and opts.compress
                    dbg("compression requested and blob not already saved, so we compress blob")
                    switch opts.compress
                        when 'gzip'
                            zlib.gzip opts.blob, {level:opts.level}, (err, blob) =>
