1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
|
--
-- $Id$
--
-- This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
-- project.
--
-- Copyright (C) 1998-2012 OpenLink Software
--
-- This project is free software; you can redistribute it and/or modify it
-- under the terms of the GNU General Public License as published by the
-- Free Software Foundation; only version 2 of the License, dated June 1991.
--
-- This program is distributed in the hope that it will be useful, but
-- WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-- General Public License for more details.
--
-- You should have received a copy of the GNU General Public License along
-- with this program; if not, write to the Free Software Foundation, Inc.,
-- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--
--
create procedure DB.DBA.ddl_load_script (in _filename varchar)
{
declare cnt, parts, errors any;
cnt := file_to_string (_filename);
parts := sql_split_text (cnt);
foreach (varchar s in parts) do
{
declare stat, msg any;
stat := '00000';
exec (s, stat, msg);
if (stat <> '00000')
{
log_message (sprintf ('Error in autoexec.isql: [%s] %s', stat, msg));
rollback work;
}
else
{
commit work;
}
}
}
;
create procedure DB.DBA.ddl_load_script_safe (in _filename varchar)
{
declare _status, _message varchar;
_status := '';
_message := 'OK';
if (not file_stat (_filename))
return;
exec (concat ('DB.DBA.ddl_load_script (', WS.WS.STR_SQL_APOS(_filename), ')'), _status, _message);
if (_message<>'OK')
{
dbg_printf ('\nError on loading file \'%s\'', _filename );
dbg_printf ('Status returned: %s %s', _status, _message);
}
}
;
create procedure ddl_autoexec (in _filename varchar)
{
if (_filename = '')
_filename := 'autoexec.isql';
-- Uncomment this if you want to use this feature
DB.DBA.ddl_load_script_safe (_filename);
}
;
create procedure ddl_dav_replicate_rdf_quad ()
{
if (1 <> sys_stat ('cl_run_local_only'))
return;
DB.DBA.DAV_AUTO_REPLICATE_TO_RDF_QUAD ();
}
;
--!AFTER
ddl_dav_replicate_rdf_quad ()
;
--!AFTER
VAD.DBA.VAD_AUTO_UPGRADE ()
;
--!AFTER
ddl_autoexec ('')
;
|