silverp1/pb — pull request #22 by buhman (2014-12-04 02:24:25+00:00)
Title: more verbs

Needs:

```sql
ALTER TABLE paste ADD uuid BINARY(16) NOT NULL AFTER id;
ALTER TABLE paste ADD UNIQUE (uuid);

DELIMITER @@

DROP PROCEDURE IF EXISTS insert_paste@@
CREATE PROCEDURE insert_paste (
p_uuid BINARY(16),
p_content MEDIUMBLOB,
p_raw BIT(1),
OUT p_id MEDIUMINT
)
BEGIN
START TRANSACTION;
INSERT paste (uuid, digest, content, raw)
VALUES (p_uuid, UNHEX(SHA1(p_content)), p_content, p_raw);
SELECT last_insert_id() INTO p_id;
COMMIT;
END;
@@

DROP PROCEDURE IF EXISTS delete_paste@@
CREATE PROCEDURE delete_paste (
p_uuid BINARY(16),
OUT p_count MEDIUMINT
)
BEGIN
START TRANSACTION;
DELETE
FROM paste
WHERE uuid = p_uuid;
SELECT row_count() INTO p_count;
COMMIT;
END;
@@

DROP PROCEDURE IF EXISTS put_paste@@
CREATE PROCEDURE put_paste (
p_uuid BINARY(16),
p_content MEDIUMBLOB,
OUT p_count MEDIUMINT
)
BEGIN
START TRANSACTION;
UPDATE paste
SET digest = UNHEX(SHA1(p_content)), content = p_content
WHERE uuid = p_uuid;
SELECT row_count() INTO p_count;
COMMIT;
END;
@@
```