/* $Id$ */
/*============================================================================*
 |                 Copyright (c) 2010 Applaud Solutions UK Ltd                |
 |                             All rights reserved                            |
 *===========================================================================*/

SET VERIFY OFF
SET FEEDBACK OFF
SET SCAN OFF
WHENEVER OSERROR  EXIT FAILURE ROLLBACK
WHENEVER SQLERROR EXIT FAILURE ROLLBACK

DECLARE

  --
  -- Local constants and variables
  --
  l_sql varchar2(32000);

BEGIN

  --
  -- Register Query Person Image for iPhone
  --
  l_sql :=
'        SELECT xxas_com_srv_mgr_pkg.set_blob(i.image) result
              ,i.mime_type
              ,''perimage.''||lower(i.format) filename
              ,''I'' inline_or_attachment
              ,i.content_length
        FROM   TABLE(xxas_per_image_pkg.image_tbl(:pPersonId, :pThumbSize)) i ';

  xxas_com_sr_pkg.seed_query_service
    (p_service_name      => 'QueryPersonImageforiPhone'
    ,p_securing_function => 'XXAS_SRV_Q_PER_IMAGE_IP_PERM'
    ,p_sql               => l_sql
    ,p_authenticate      => TRUE
    ,p_parameters        => xxas_com_sr_param_varray
                              (xxas_com_sr_param_type('pPersonId', xxas_com_sr_pkg.g_NUMBER)
                              ,xxas_com_sr_param_type('pThumbSize', xxas_com_sr_pkg.g_VARCHAR2)));

END;
/
COMMIT;
EXIT;
