1------------------------------------------------------------------------------ 2-- -- 3-- Matreshka Project -- 4-- -- 5-- SQL Database Access -- 6-- -- 7-- Runtime Library Component -- 8-- -- 9------------------------------------------------------------------------------ 10-- -- 11-- Copyright © 2012, Vadim Godunko <vgodunko@gmail.com> -- 12-- All rights reserved. -- 13-- -- 14-- Redistribution and use in source and binary forms, with or without -- 15-- modification, are permitted provided that the following conditions -- 16-- are met: -- 17-- -- 18-- * Redistributions of source code must retain the above copyright -- 19-- notice, this list of conditions and the following disclaimer. -- 20-- -- 21-- * Redistributions in binary form must reproduce the above copyright -- 22-- notice, this list of conditions and the following disclaimer in the -- 23-- documentation and/or other materials provided with the distribution. -- 24-- -- 25-- * Neither the name of the Vadim Godunko, IE nor the names of its -- 26-- contributors may be used to endorse or promote products derived from -- 27-- this software without specific prior written permission. -- 28-- -- 29-- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -- 30-- "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -- 31-- LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -- 32-- A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -- 33-- HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -- 34-- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -- 35-- TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR -- 36-- PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF -- 37-- LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -- 38-- NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -- 39-- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- 40-- -- 41------------------------------------------------------------------------------ 42-- $Revision: 3381 $ $Date: 2012-11-11 16:41:14 +0400 (Sun, 11 Nov 2012) $ 43------------------------------------------------------------------------------ 44-- Plugin interface for Oracle database. 45------------------------------------------------------------------------------ 46with System.Storage_Elements; 47with SQL.Databases; 48 49package Matreshka.Internals.SQL_Drivers.Oracle.Plug_In is 50 51 type Control_Side is (Driver, Plug_In); 52 53 type Column_Description is record 54 Column_Type : aliased Data_Type; -- OCI_ATTR_DATA_TYPE 55 Size : aliased Ub2; -- OCI_ATTR_DATA_SIZE 56 Precision : aliased Sb2; -- OCI_ATTR_PRECISION 57 Scale : aliased Sb1; -- OCI_ATTR_SCALE 58 end record; 59 60 type Abstract_Plug_In is abstract tagged private; 61 62 not overriding procedure Check_Parameter 63 (Self : Abstract_Plug_In; 64 Holder : League.Holders.Holder; 65 Control : in out Control_Side; 66 SQLT_Type : out Data_Type; 67 Extra_Size : out System.Storage_Elements.Storage_Count) is abstract; 68 -- If given plugin supports given Holder as statement parameter 69 -- set Control to Plug_In, SQLT_Type to expected data type and Extra_Size 70 -- to size of binding area 71 72 not overriding procedure Check_Column 73 (Self : Abstract_Plug_In; 74 Column : Column_Description; 75 Control : in out Control_Side; 76 SQLT_Type : out Data_Type; 77 Extra_Size : out System.Storage_Elements.Storage_Count) is abstract; 78 -- If given plugin supports Column set Control to Plug_In and Extra_Size 79 -- to size of define area 80 81 not overriding procedure Encode 82 (Self : Abstract_Plug_In; 83 Holder : League.Holders.Holder; 84 Buffer : in out System.Storage_Elements.Storage_Array) is abstract; 85 -- Convert Holder to Storage_Array 86 87 not overriding procedure Decode 88 (Self : Abstract_Plug_In; 89 Holder : in out League.Holders.Holder; 90 Buffer : System.Storage_Elements.Storage_Array) is abstract; 91 -- Convert Storage_Array to Holder 92 93 procedure Register 94 (Database : in out SQL.Databases.SQL_Database; 95 Plug_In : access Abstract_Plug_In'Class); 96 -- register plugin in given Database 97 98 function Next 99 (Self : Abstract_Plug_In'Class) 100 return access Abstract_Plug_In'Class; 101 -- To iterate over registered plugins 102 103private 104 105 type Abstract_Plug_In is abstract tagged record 106 Next : access Abstract_Plug_In'Class; 107 end record; 108 109end Matreshka.Internals.SQL_Drivers.Oracle.Plug_In; 110