/*
 *   FreeAdhocUDF - copyright (c) 2004/2006 adhoc dataservice GmbH
 *   Christoph Theuring / Peter Mandrella / Georg Horn
 *   (bug-)reports only to udf@adhoc-data.de
 *
 *   !!!!!!!!!!!!!!!!!! IMPORTANT !!!!!!!!!!!!!!!!!!!
 *   This is a update-script for your FreeAdhocUDf-blob-functions
 *   if you want to use the posibility of return NULL in FireBird 2.0 (only!!!)
 *   if you want to use the version adhoc200612xx (or further versions)
 *   AND you have DECLAIRED your UDFs with an older version then adhoc200612xx
 *   OR with a compatible version of this UDFs like FreeUDFLib, FreeUDFLibC, GrUDF ...
 *   You MUST run FIRST the adhoc20061131update_conv.sql-script!
 *   You can run the COMPLETE script even you have NOT all UDFs declaired.
 *
 *   AFTER running this update-script you must REconnect to your database before you test 
 *
 *   Software distributed under the License is distributed on an
 *   "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
 *   or implied. See the License for the specific language governing
 *   rights and limitations under the License.
 *
 */

/* all FreeAdhocUDFs using entrypoint 'blobsize' f.e. F_BLOBSIZE */ 
UPDATE RDB$FUNCTION_ARGUMENTS FA SET FA.RDB$MECHANISM = 5 
WHERE FA.RDB$ARGUMENT_POSITION > 0
AND EXISTS (SELECT 1 FROM RDB$FUNCTIONS F WHERE FA.RDB$FUNCTION_NAME = F.RDB$FUNCTION_NAME 
AND F.RDB$MODULE_NAME CONTAINING 'FreeAdhocUDF' AND F.RDB$ENTRYPOINT = 'blobsize');

/* all FreeAdhocUDFs using entrypoint 'blobsegmentcount' f.e. F_BLOBSEGMENTCOUNT */ 
UPDATE RDB$FUNCTION_ARGUMENTS FA SET FA.RDB$MECHANISM = 5 
WHERE FA.RDB$ARGUMENT_POSITION > 0
AND EXISTS (SELECT 1 FROM RDB$FUNCTIONS F WHERE FA.RDB$FUNCTION_NAME = F.RDB$FUNCTION_NAME 
AND F.RDB$MODULE_NAME CONTAINING 'FreeAdhocUDF' AND F.RDB$ENTRYPOINT = 'blobsegmentcount');

/* all FreeAdhocUDFs using entrypoint 'blobmaxsegmentlength' f.e. F_BLOBMAXSEGMENTLENGTH */ 
UPDATE RDB$FUNCTION_ARGUMENTS FA SET FA.RDB$MECHANISM = 5 
WHERE FA.RDB$ARGUMENT_POSITION > 0
AND EXISTS (SELECT 1 FROM RDB$FUNCTIONS F WHERE FA.RDB$FUNCTION_NAME = F.RDB$FUNCTION_NAME 
AND F.RDB$MODULE_NAME CONTAINING 'FreeAdhocUDF' AND F.RDB$ENTRYPOINT = 'blobmaxsegmentlength');

/* all FreeAdhocUDFs using entrypoint 'bloblinecount' f.e. F_BLOBLINECOUNT */ 
UPDATE RDB$FUNCTION_ARGUMENTS FA SET FA.RDB$MECHANISM = 5 
WHERE FA.RDB$ARGUMENT_POSITION > 0
AND EXISTS (SELECT 1 FROM RDB$FUNCTIONS F WHERE FA.RDB$FUNCTION_NAME = F.RDB$FUNCTION_NAME 
AND F.RDB$MODULE_NAME CONTAINING 'FreeAdhocUDF' AND F.RDB$ENTRYPOINT = 'bloblinecount');


/* adhoc 2006-12-12 */
