From: Eric Bollengier Date: Tue, 7 Oct 2008 18:41:41 +0000 (+0000) Subject: ebl add base64_decode_lstat function to Mysql (require mysql > 5) X-Git-Tag: Release-3.0.0~856 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8dbf1b81438fa4686b4b5224b08ecf93a38332d5;p=bacula%2Fbacula ebl add base64_decode_lstat function to Mysql (require mysql > 5) git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@7727 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/gui/bweb/script/bweb-mysql.sql b/gui/bweb/script/bweb-mysql.sql index 0fb5bb457e..9494e104d9 100644 --- a/gui/bweb/script/bweb-mysql.sql +++ b/gui/bweb/script/bweb-mysql.sql @@ -1,3 +1,37 @@ +-- -------------------------------------------------- +-- Upgrade from 2.4 +-- -------------------------------------------------- + +delimiter | + +DROP FUNCTION IF EXISTS base64_decode_lstat | +CREATE FUNCTION base64_decode_lstat (field INTEGER, input BLOB) + RETURNS BIGINT + CONTAINS SQL + DETERMINISTIC + SQL SECURITY INVOKER +BEGIN + DECLARE first_char BINARY(1); + DECLARE accum_value BIGINT UNSIGNED DEFAULT 0; + + -- The number of fields can vary, so we need 2 calls to SUBSTRING_INDEX + SET input = SUBSTRING_INDEX(SUBSTRING_INDEX(input, ' ', field), + ' ', -1); + + WHILE LENGTH(input) > 0 DO + SET first_char = SUBSTRING(input, 1, 1); + SET input = SUBSTRING(input, 2); + + SET accum_value = (accum_value << 6) + + INSTR('ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/', + first_char)-1; + END WHILE; + + RETURN accum_value; +END | + +delimiter ; + -- -------------------------------------------------- -- Upgrade from 2.2 -- --------------------------------------------------