From: <car...@us...> - 2014-05-12 09:08:38
|
Revision: 963 http://sourceforge.net/p/instantobjects/code/963 Author: carlobar Date: 2014-05-12 09:08:33 +0000 (Mon, 12 May 2014) Log Message: ----------- Version 2.2 (2.2.0.0) (2014-05-12) - Full UNICODE support: based on UseUnicode flag of InstantConnection: Exposers uses TWideStringField or TWideMemoField mapping string attributes - Virtual Containers (for SQL brokers): Master-Detail relationship using a contaier without storage (read VirtualContainers.txt for more informations) - Updated UnitTesting for Exposers and Unicode Support Modified Paths: -------------- trunk/Demos/PrimerCross/Main.pas trunk/Demos/PrimerCross/Primer_D2010.xml trunk/Demos/PrimerCross/Primer_DXE3.xml trunk/Docs/Changes.txt trunk/Docs/Install.txt trunk/Readme1st.txt trunk/Source/Brokers/ADO/D2010/DclIOADO.dproj trunk/Source/Brokers/ADO/D2010/IOADO.dproj trunk/Source/Brokers/ADO/DXE3/IOADO.dproj trunk/Source/Brokers/DBX/D2010/DclIODBX.dproj trunk/Source/Brokers/DBX/D2010/IODBX.dproj trunk/Source/Brokers/DBX/DXE3/IODBX.dproj trunk/Source/Brokers/DBX/InstantDBX.pas trunk/Source/Brokers/DBX/InstantDBXConnectionDefEdit.dfm trunk/Source/Brokers/DBX/InstantDBXConnectionDefEdit.pas trunk/Source/Brokers/IBX/D2010/DclIOIBX.dproj trunk/Source/Brokers/IBX/D2010/IOIBX.dproj trunk/Source/Brokers/IBX/DXE3/IOIBX.dproj trunk/Source/Brokers/IBX/InstantIBX.pas trunk/Source/Brokers/XML/D2010/DclIOXML.dproj trunk/Source/Brokers/XML/D2010/IOXML.dproj trunk/Source/Brokers/XML/DXE3/IOXML.dproj trunk/Source/Brokers/XML/InstantXML.pas trunk/Source/Brokers/XML/InstantXMLCatalog.pas trunk/Source/Catalogs/IBFb/D2010/IOIBFbCatalog.dproj trunk/Source/Catalogs/IBFb/DXE3/IOIBFbCatalog.dproj trunk/Source/Core/D2010/IOCore.dproj trunk/Source/Core/DXE3/IOCore.dproj trunk/Source/Core/InstantBrokers.pas trunk/Source/Core/InstantCode.pas trunk/Source/Core/InstantCommand.pas trunk/Source/Core/InstantConnectionManagerFormUnit.pas trunk/Source/Core/InstantConsts.pas trunk/Source/Core/InstantExplorer.pas trunk/Source/Core/InstantPersistence.pas trunk/Source/Core/InstantPresentation.pas trunk/Source/Core/InstantTypes.pas trunk/Source/Design/D2010/DclIOCore.dproj trunk/Source/Design/DXE3/DclIOCore.dproj trunk/Source/InstantDefines.inc trunk/Source/PackageGroups/DXE3/DesignTimePackages.groupproj trunk/Source/PackageGroups/DXE3/RunTimePackages.groupproj trunk/Source/PackageGroups/Install.txt trunk/Tests/TestIO.dpr trunk/Tests/TestIO.dproj trunk/Tests/TestIO_DXE3.dpr trunk/Tests/TestIO_DXE3.dproj trunk/Tests/TestInstantObjectStore.pas trunk/Tests/TestInstantPresentation.pas trunk/Tests/TestModel.pas trunk/Tests/TestXMLBroker.pas trunk/Tests/ubmock/src/GuiTestRunner.dfm Modified: trunk/Demos/PrimerCross/Main.pas =================================================================== --- trunk/Demos/PrimerCross/Main.pas 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Demos/PrimerCross/Main.pas 2014-05-12 09:08:33 UTC (rev 963) @@ -19,8 +19,9 @@ QMenus, QExtCtrls, QComCtrls, QGrids, QDBGrids, QImgList, QActnList, {$ENDIF} InstantPersistence, BasicView, Stopwatch, - InstantConnectionManagerFormUnit, InstantConnectionManager - {$IFDEF D17+}, System.Actions{$ENDIF}; + InstantConnectionManagerFormUnit, InstantConnectionManager, + {$IFDEF D17+}System.Actions,{$ENDIF} + WideStrings, SqlExpr; type TMainForm = class(TForm) @@ -148,7 +149,10 @@ {$IFNDEF VER130} InstantDBX, {$ENDIF} - InstantADO, InstantBDE, InstantIBX, + InstantADO, InstantIBX, InstantBDE, + {$IFDEF D19+} + InstantFireDAC, + {$ENDIF} {$IFDEF D14+} // These are required for DBExpress to load the drivers in newer // versions of Delphi. If you get a compilation error it means you Modified: trunk/Demos/PrimerCross/Primer_D2010.xml =================================================================== --- trunk/Demos/PrimerCross/Primer_D2010.xml 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Demos/PrimerCross/Primer_D2010.xml 2014-05-12 09:08:33 UTC (rev 963) @@ -1,39 +1,41 @@ <TInstantConnectionDefs> - <TInstantBDEConnectionDef> - <Name>ParadoxDB</Name> + <TInstantIBXConnectionDef> + <Name>IBX_Firebird</Name> <IsBuilt>TRUE</IsBuilt> <BlobStreamFormat>sfXML</BlobStreamFormat> <LoginPrompt>FALSE</LoginPrompt> - <DriverName>STANDARD</DriverName> - <Parameters>PATH=.\ParadoxDB -DEFAULT DRIVER=PARADOX -ENABLE BCD=TRUE -</Parameters> - </TInstantBDEConnectionDef> + <ConnectionString>.\FirebirdDB\PRIMERDB.FDB</ConnectionString> + <Options></Options> + <Params>user_name=SYSDBA +password=masterkey +lc_ctype=ISO8859_1</Params> + </TInstantIBXConnectionDef> + <TInstantXMLConnectionDef> + <Name>XmlDB</Name> + <IsBuilt>TRUE</IsBuilt> + <RootFolder>.\XmlDB</RootFolder> + </TInstantXMLConnectionDef> <TInstantDBXConnectionDef> - <Name>FirebirdDB</Name> + <Name>DBX_Firebird</Name> <IsBuilt>TRUE</IsBuilt> <BlobStreamFormat>sfXML</BlobStreamFormat> <LoginPrompt>FALSE</LoginPrompt> - <ConnectionName>PrimerCrossISO</ConnectionName> + <ConnectionName>FBConnection</ConnectionName> <DriverName>Firebird</DriverName> - <GetDriverFunc>getSQLDriverINTERBASE</GetDriverFunc> - <LibraryName>dbxfb.dll</LibraryName> - <Params>drivername=Firebird + <Params>DriverName=Firebird Database=.\FirebirdDB\PRIMERDB.FDB -User_Name=SYSDBA +RoleName=RoleName +User_Name=sysdba Password=masterkey -blobsize=-1 -localecode=0000 -devartinterbase transisolation=ReadCommited -productname=Interbase -ServerCharSet=ISO8859_1 +ServerCharSet= +SQLDialect=3 +ErrorResourceFile= +LocaleCode=0000 +BlobSize=-1 +CommitRetain=False +WaitOnLocks=True +IsolationLevel=ReadCommitted +Trim Char=False </Params> - <VendorLib>fbclient.dll</VendorLib> </TInstantDBXConnectionDef> - <TInstantXMLConnectionDef> - <Name>XmlDB</Name> - <IsBuilt>TRUE</IsBuilt> - <RootFolder>.\XmlDB</RootFolder> - </TInstantXMLConnectionDef> </TInstantConnectionDefs> Modified: trunk/Demos/PrimerCross/Primer_DXE3.xml =================================================================== --- trunk/Demos/PrimerCross/Primer_DXE3.xml 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Demos/PrimerCross/Primer_DXE3.xml 2014-05-12 09:08:33 UTC (rev 963) @@ -11,19 +11,42 @@ </Parameters> </TInstantBDEConnectionDef> <TInstantIBXConnectionDef> - <Name>FirebirdDB</Name> + <Name>IBX_Firebird</Name> <IsBuilt>TRUE</IsBuilt> <BlobStreamFormat>sfXML</BlobStreamFormat> <LoginPrompt>FALSE</LoginPrompt> - <ConnectionString>localhost:c:\db\primercrossutf8.fdb</ConnectionString> + <ConnectionString>.\FirebirdDB\PRIMERDB.FDB</ConnectionString> <Options></Options> <Params>user_name=SYSDBA password=masterkey -lc_ctype=UTF8</Params> +lc_ctype=ISO8859_1</Params> </TInstantIBXConnectionDef> <TInstantXMLConnectionDef> <Name>XmlDB</Name> <IsBuilt>TRUE</IsBuilt> <RootFolder>.\XmlDB</RootFolder> </TInstantXMLConnectionDef> + <TInstantDBXConnectionDef> + <Name>DBX_Firebird</Name> + <IsBuilt>TRUE</IsBuilt> + <BlobStreamFormat>sfXML</BlobStreamFormat> + <LoginPrompt>FALSE</LoginPrompt> + <ConnectionName>FBConnection</ConnectionName> + <DriverName>Firebird</DriverName> + <Params>DriverName=Firebird +Database=.\FirebirdDB\PRIMERDB.FDB +RoleName=RoleName +User_Name=sysdba +Password=masterkey +ServerCharSet= +SQLDialect=3 +ErrorResourceFile= +LocaleCode=0000 +BlobSize=-1 +CommitRetain=False +WaitOnLocks=True +IsolationLevel=ReadCommitted +Trim Char=False +</Params> + </TInstantDBXConnectionDef> </TInstantConnectionDefs> Modified: trunk/Docs/Changes.txt =================================================================== --- trunk/Docs/Changes.txt 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Docs/Changes.txt 2014-05-12 09:08:33 UTC (rev 963) @@ -1,6 +1,20 @@ VERSION HISTORY --------------- +Version 2.2 (2.2.0.0) (2014-05-12) +- Full UNICODE support: based on UseUnicode flag of InstantConnection: + Exposers uses TWideStringField or TWideMemoField mapping string attributes + +- Virtual Containers (for SQL brokers): + Master-Detail relationship using a contaier without storage + (read VirtualContainers.txt for more informations) + +- Added Broker for Embarcadero FireDac + +- Added support for Delphi XE5 and XE6 + +- Updated UnitTesting for Exposers and Unicode Support + Version 2.1 (2.1.0.0) (2007-02-26) - Support for SQL Server 2005; catalog support for SQL Server 7; Modified: trunk/Docs/Install.txt =================================================================== --- trunk/Docs/Install.txt 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Docs/Install.txt 2014-05-12 09:08:33 UTC (rev 963) @@ -1,6 +1,6 @@ ------------------------------------------------------------------ - InstantObjects for Delphi, Kylix, FPC + InstantObjects for Delphi Mozilla Public License 1.1 Based on Seleqt InstantObjects. @@ -60,8 +60,8 @@ <installdir>/Source/Core/<version>/IOCore.dpk (build) <installdir>/Source/Design/<version>/DclIOCore.dpk (install) - Where <version> identifies your version of Delphi, Kylix or - FPC. Examples: D5, D6, D7, K3, D2005, D2006, etc. + Where <version> identifies your version of Delphi + Examples: D7, D2005, D2006, etc. 4. Build and install the desired catalog and broker package(s): @@ -79,11 +79,6 @@ <installdir>/Source/Brokers/XML/<version>/DclIOXML.dpk (install) Please note that not all brokers are available in all versions - of Delphi/Kylix/FPC. If you think you can make a supplied broker + of Delphi. If you think you can make a supplied broker work in an unsupported version, or create a new broker from scratch - then please contact us. - - NOTE TO DELPHI 5 USERS: - dpk files in Delphi 5 have an additional suffix "_D5". This is - because Delphi 5 does not support the LIBSUFFIX compiler directive - that InstantObjects uses in newer versions of Delphi. \ No newline at end of file + then please contact us. \ No newline at end of file Modified: trunk/Readme1st.txt =================================================================== --- trunk/Readme1st.txt 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Readme1st.txt 2014-05-12 09:08:33 UTC (rev 963) @@ -1,6 +1,6 @@ ------------------------------------------------------------------ - InstantObjects for Delphi, Kylix, FPC + InstantObjects for Delphi - Full Unicode version Mozilla Public License 1.1 Edition Based on Seleqt InstantObjects. Modified: trunk/Source/Brokers/ADO/D2010/DclIOADO.dproj =================================================================== --- trunk/Source/Brokers/ADO/D2010/DclIOADO.dproj 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Source/Brokers/ADO/D2010/DclIOADO.dproj 2014-05-12 09:08:33 UTC (rev 963) @@ -22,7 +22,6 @@ <PropertyGroup Condition="'$(Base)'!=''"> <DesignOnlyPackage>true</DesignOnlyPackage> <DCC_ImageBase>00400000</DCC_ImageBase> - <DCC_SymbolReferenceInfo>1</DCC_SymbolReferenceInfo> <DllSuffix>_D14</DllSuffix> <DCC_DependencyCheckOutputName>C:\Users\Public\Documents\RAD Studio\7.0\Bpl\DclIOADO_D14.bpl</DCC_DependencyCheckOutputName> <DCC_RangeChecking>true</DCC_RangeChecking> Modified: trunk/Source/Brokers/ADO/D2010/IOADO.dproj =================================================================== --- trunk/Source/Brokers/ADO/D2010/IOADO.dproj 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Source/Brokers/ADO/D2010/IOADO.dproj 2014-05-12 09:08:33 UTC (rev 963) @@ -2,7 +2,7 @@ <PropertyGroup> <ProjectGuid>{BF5FCE65-8CE6-49DA-80A0-E55081BF9F72}</ProjectGuid> <MainSource>IOADO.dpk</MainSource> - <Config Condition="'$(Config)'==''">Debug</Config> + <Config Condition="'$(Config)'==''">Release</Config> <DCC_DCCCompiler>DCC32</DCC_DCCCompiler> <ProjectVersion>12.0</ProjectVersion> </PropertyGroup> @@ -21,14 +21,13 @@ </PropertyGroup> <PropertyGroup Condition="'$(Base)'!=''"> <DCC_ImageBase>00400000</DCC_ImageBase> - <DCC_DependencyCheckOutputName>C:\Documents and Settings\All Users\Documents\RAD Studio\7.0\Bpl\IOADO_D14.bpl</DCC_DependencyCheckOutputName> + <DCC_DependencyCheckOutputName>C:\Users\Public\Documents\RAD Studio\7.0\Bpl\IOADO_D14.bpl</DCC_DependencyCheckOutputName> <DllSuffix>_D14</DllSuffix> <DCC_WriteableConstants>true</DCC_WriteableConstants> <DCC_Platform>x86</DCC_Platform> <DCC_UnitAlias>WinTypes=Windows;WinProcs=Windows;$(DCC_UnitAlias)</DCC_UnitAlias> <RuntimeOnlyPackage>true</RuntimeOnlyPackage> <DCC_Description>InstantObjects ADO Run-Time Support (Delphi 2010)</DCC_Description> - <DCC_SymbolReferenceInfo>1</DCC_SymbolReferenceInfo> <DCC_S>false</DCC_S> <DCC_N>false</DCC_N> <GenDll>true</GenDll> Modified: trunk/Source/Brokers/ADO/DXE3/IOADO.dproj =================================================================== --- trunk/Source/Brokers/ADO/DXE3/IOADO.dproj 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Source/Brokers/ADO/DXE3/IOADO.dproj 2014-05-12 09:08:33 UTC (rev 963) @@ -7,7 +7,7 @@ <TargetedPlatforms>1</TargetedPlatforms> <AppType>Package</AppType> <FrameworkType>VCL</FrameworkType> - <ProjectVersion>14.3</ProjectVersion> + <ProjectVersion>14.4</ProjectVersion> <Platform Condition="'$(Platform)'==''">Win32</Platform> </PropertyGroup> <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''"> Modified: trunk/Source/Brokers/DBX/D2010/DclIODBX.dproj =================================================================== --- trunk/Source/Brokers/DBX/D2010/DclIODBX.dproj 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Source/Brokers/DBX/D2010/DclIODBX.dproj 2014-05-12 09:08:33 UTC (rev 963) @@ -2,7 +2,7 @@ <PropertyGroup> <ProjectGuid>{37A94EA0-7FE9-4F18-B639-D0056DB88697}</ProjectGuid> <MainSource>DclIODBX.dpk</MainSource> - <Config Condition="'$(Config)'==''">Debug</Config> + <Config Condition="'$(Config)'==''">Release</Config> <DCC_DCCCompiler>DCC32</DCC_DCCCompiler> <ProjectVersion>12.0</ProjectVersion> </PropertyGroup> @@ -29,7 +29,6 @@ <DCC_OutputNeverBuildDcps>true</DCC_OutputNeverBuildDcps> <GenDll>true</GenDll> <DllSuffix>_D14</DllSuffix> - <DCC_SymbolReferenceInfo>1</DCC_SymbolReferenceInfo> <DCC_ImageBase>00400000</DCC_ImageBase> <DCC_Platform>x86</DCC_Platform> </PropertyGroup> Modified: trunk/Source/Brokers/DBX/D2010/IODBX.dproj =================================================================== --- trunk/Source/Brokers/DBX/D2010/IODBX.dproj 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Source/Brokers/DBX/D2010/IODBX.dproj 2014-05-12 09:08:33 UTC (rev 963) @@ -2,7 +2,7 @@ <PropertyGroup> <ProjectGuid>{99DAEA57-EA95-4709-A5EE-36855F676EB5}</ProjectGuid> <MainSource>IODBX.dpk</MainSource> - <Config Condition="'$(Config)'==''">Debug</Config> + <Config Condition="'$(Config)'==''">Release</Config> <DCC_DCCCompiler>DCC32</DCC_DCCCompiler> <ProjectVersion>12.0</ProjectVersion> </PropertyGroup> @@ -20,14 +20,13 @@ <Base>true</Base> </PropertyGroup> <PropertyGroup Condition="'$(Base)'!=''"> - <DCC_DependencyCheckOutputName>C:\Documents and Settings\All Users\Documents\RAD Studio\7.0\Bpl\IODBX_D14.bpl</DCC_DependencyCheckOutputName> + <DCC_DependencyCheckOutputName>C:\Users\Public\Documents\RAD Studio\7.0\Bpl\IODBX_D14.bpl</DCC_DependencyCheckOutputName> <DCC_UnitAlias>WinTypes=Windows;WinProcs=Windows;$(DCC_UnitAlias)</DCC_UnitAlias> <DCC_Description>InstantObjects dbExpress Run-Time Support (Delphi 2010)</DCC_Description> <RuntimeOnlyPackage>true</RuntimeOnlyPackage> <DllSuffix>_D14</DllSuffix> <DCC_OutputNeverBuildDcps>true</DCC_OutputNeverBuildDcps> <GenDll>true</GenDll> - <DCC_SymbolReferenceInfo>1</DCC_SymbolReferenceInfo> <GenPackage>true</GenPackage> <DCC_ImageBase>00400000</DCC_ImageBase> <DCC_Platform>x86</DCC_Platform> Modified: trunk/Source/Brokers/DBX/DXE3/IODBX.dproj =================================================================== --- trunk/Source/Brokers/DBX/DXE3/IODBX.dproj 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Source/Brokers/DBX/DXE3/IODBX.dproj 2014-05-12 09:08:33 UTC (rev 963) @@ -7,7 +7,7 @@ <TargetedPlatforms>1</TargetedPlatforms> <AppType>Package</AppType> <FrameworkType>VCL</FrameworkType> - <ProjectVersion>14.3</ProjectVersion> + <ProjectVersion>14.4</ProjectVersion> <Platform Condition="'$(Platform)'==''">Win32</Platform> </PropertyGroup> <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''"> Modified: trunk/Source/Brokers/DBX/InstantDBX.pas =================================================================== --- trunk/Source/Brokers/DBX/InstantDBX.pas 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Source/Brokers/DBX/InstantDBX.pas 2014-05-12 09:08:33 UTC (rev 963) @@ -296,7 +296,7 @@ implementation uses - SysUtils, InstantDBXConnectionDefEdit, InstantUtils, InstantConsts, Math, + SysUtils, InstantDBXConnectionDefEdit, InstantUtils, InstantConsts, Math, InstantClasses, InstantDBBuild, InstantIBFbCatalog, InstantMSSqlCatalog, InstantMySQLCatalog; { TInstantDBXConnector } @@ -579,9 +579,15 @@ function TInstantDBXBroker.Execute(const AStatement: string; AParams: TParams): Integer; begin + Result := 0; with CreateDataSet(AStatement, AParams) as TSQLQuery do - try + try try Result := ExecSQL; + except + on E: Exception do + raise EInstantError.CreateFmt(SSQLExecuteError, + [AStatement, E.Message], E); + end; finally Free; end; @@ -623,6 +629,10 @@ begin Writer.WriteChar('0'); Result := True; + end else if (Copy(Constant.Value,1,1) = '[') and (Copy(Constant.Value,length(Constant.Value),1) = ']') then + begin + Writer.WriteString(Copy(Constant.Value,2,length(Constant.Value)-2)); + Result := True; end else Result := inherited TranslateConstant(Constant, Writer); end; @@ -783,7 +793,7 @@ ftInteger: TargetParam.AsFloat := SourceParam.AsInteger; ftCurrency: - TargetParam.AsCurrency := SourceParam.AsCurrency; + TargetParam.AsBCD := SourceParam.AsCurrency; ftFloat: TargetParam.AsFloat := SourceParam.AsFloat; else Modified: trunk/Source/Brokers/DBX/InstantDBXConnectionDefEdit.dfm =================================================================== --- trunk/Source/Brokers/DBX/InstantDBXConnectionDefEdit.dfm 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Source/Brokers/DBX/InstantDBXConnectionDefEdit.dfm 2014-05-12 09:08:33 UTC (rev 963) @@ -103,12 +103,20 @@ end object LoginPromptCheckBox: TCheckBox Left = 16 - Top = 198 + Top = 187 Width = 137 Height = 17 Caption = '&Login Prompt' TabOrder = 2 end + object UseUnicodeCheckBox: TCheckBox + Left = 16 + Top = 205 + Width = 137 + Height = 17 + Caption = '&Use Unicode' + TabOrder = 3 + end end object BottomPanel: TPanel Left = 0 Modified: trunk/Source/Brokers/DBX/InstantDBXConnectionDefEdit.pas =================================================================== --- trunk/Source/Brokers/DBX/InstantDBXConnectionDefEdit.pas 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Source/Brokers/DBX/InstantDBXConnectionDefEdit.pas 2014-05-12 09:08:33 UTC (rev 963) @@ -66,6 +66,7 @@ StreamFormatLabel: TLabel; StreamFormatComboBox: TComboBox; LoginPromptCheckBox: TCheckBox; + UseUnicodeCheckBox: TCheckBox; procedure FormCreate(Sender: TObject); procedure DriverNameEditChange(Sender: TObject); procedure ConnectionNameListBoxClick(Sender: TObject); @@ -171,6 +172,7 @@ //CB StreamFormatComboBox.ItemIndex := Ord(ConnectionDef.BlobStreamFormat); LoginPromptCheckBox.Checked := ConnectionDef.LoginPrompt; + UseUnicodeCheckBox.Checked := ConnectionDef.UseUnicode; end; procedure TInstantDBXConnectionDefEditForm.SaveData( Modified: trunk/Source/Brokers/IBX/D2010/DclIOIBX.dproj =================================================================== --- trunk/Source/Brokers/IBX/D2010/DclIOIBX.dproj 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Source/Brokers/IBX/D2010/DclIOIBX.dproj 2014-05-12 09:08:33 UTC (rev 963) @@ -2,7 +2,7 @@ <PropertyGroup> <ProjectGuid>{982DD2E1-206B-48F0-B7DF-76417E6E6551}</ProjectGuid> <MainSource>DclIOIBX.dpk</MainSource> - <Config Condition="'$(Config)'==''">Debug</Config> + <Config Condition="'$(Config)'==''">Release</Config> <DCC_DCCCompiler>DCC32</DCC_DCCCompiler> <ProjectVersion>12.0</ProjectVersion> </PropertyGroup> @@ -28,7 +28,6 @@ <DCC_OutputNeverBuildDcps>true</DCC_OutputNeverBuildDcps> <GenDll>true</GenDll> <GenPackage>true</GenPackage> - <DCC_SymbolReferenceInfo>1</DCC_SymbolReferenceInfo> <DCC_ImageBase>00400000</DCC_ImageBase> <DCC_Platform>x86</DCC_Platform> </PropertyGroup> Modified: trunk/Source/Brokers/IBX/D2010/IOIBX.dproj =================================================================== --- trunk/Source/Brokers/IBX/D2010/IOIBX.dproj 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Source/Brokers/IBX/D2010/IOIBX.dproj 2014-05-12 09:08:33 UTC (rev 963) @@ -2,7 +2,7 @@ <PropertyGroup> <ProjectGuid>{8520BCA1-97BF-4333-A250-4291F3CFCF0E}</ProjectGuid> <MainSource>IOIBX.dpk</MainSource> - <Config Condition="'$(Config)'==''">Debug</Config> + <Config Condition="'$(Config)'==''">Release</Config> <DCC_DCCCompiler>DCC32</DCC_DCCCompiler> <ProjectVersion>12.0</ProjectVersion> </PropertyGroup> @@ -20,14 +20,13 @@ <Base>true</Base> </PropertyGroup> <PropertyGroup Condition="'$(Base)'!=''"> - <DCC_DependencyCheckOutputName>C:\Documents and Settings\All Users\Documents\RAD Studio\7.0\Bpl\IOIBX_D14.bpl</DCC_DependencyCheckOutputName> + <DCC_DependencyCheckOutputName>C:\Users\Public\Documents\RAD Studio\7.0\Bpl\IOIBX_D14.bpl</DCC_DependencyCheckOutputName> <DCC_UnitAlias>WinTypes=Windows;WinProcs=Windows;$(DCC_UnitAlias)</DCC_UnitAlias> <DCC_Description>InstantObjects IBX Run-Time Support (Delphi 2010)</DCC_Description> <RuntimeOnlyPackage>true</RuntimeOnlyPackage> <DllSuffix>_D14</DllSuffix> <DCC_OutputNeverBuildDcps>true</DCC_OutputNeverBuildDcps> <GenDll>true</GenDll> - <DCC_SymbolReferenceInfo>1</DCC_SymbolReferenceInfo> <GenPackage>true</GenPackage> <DCC_ImageBase>00400000</DCC_ImageBase> <DCC_Platform>x86</DCC_Platform> Modified: trunk/Source/Brokers/IBX/DXE3/IOIBX.dproj =================================================================== --- trunk/Source/Brokers/IBX/DXE3/IOIBX.dproj 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Source/Brokers/IBX/DXE3/IOIBX.dproj 2014-05-12 09:08:33 UTC (rev 963) @@ -7,7 +7,7 @@ <TargetedPlatforms>1</TargetedPlatforms> <AppType>Package</AppType> <FrameworkType>VCL</FrameworkType> - <ProjectVersion>14.3</ProjectVersion> + <ProjectVersion>14.4</ProjectVersion> <Platform Condition="'$(Platform)'==''">Win32</Platform> </PropertyGroup> <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''"> Modified: trunk/Source/Brokers/IBX/InstantIBX.pas =================================================================== --- trunk/Source/Brokers/IBX/InstantIBX.pas 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Source/Brokers/IBX/InstantIBX.pas 2014-05-12 09:08:33 UTC (rev 963) @@ -506,6 +506,10 @@ begin Writer.WriteChar('0'); Result := True; + end else if (Copy(Constant.Value,1,1) = '[') and (Copy(Constant.Value,length(Constant.Value),1) = ']') then + begin + Writer.WriteString(Copy(Constant.Value,2,length(Constant.Value)-2)); + Result := True; end else Result := inherited TranslateConstant(Constant, Writer); end; Modified: trunk/Source/Brokers/XML/D2010/DclIOXML.dproj =================================================================== --- trunk/Source/Brokers/XML/D2010/DclIOXML.dproj 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Source/Brokers/XML/D2010/DclIOXML.dproj 2014-05-12 09:08:33 UTC (rev 963) @@ -2,7 +2,7 @@ <PropertyGroup> <ProjectGuid>{941A45C1-7205-4184-AE44-782C0AA9BC3C}</ProjectGuid> <MainSource>DclIOXML.dpk</MainSource> - <Config Condition="'$(Config)'==''">Debug</Config> + <Config Condition="'$(Config)'==''">Release</Config> <DCC_DCCCompiler>DCC32</DCC_DCCCompiler> <ProjectVersion>12.0</ProjectVersion> </PropertyGroup> @@ -29,7 +29,6 @@ <DCC_OutputNeverBuildDcps>true</DCC_OutputNeverBuildDcps> <GenDll>true</GenDll> <DllSuffix>_D14</DllSuffix> - <DCC_SymbolReferenceInfo>1</DCC_SymbolReferenceInfo> <DCC_ImageBase>00400000</DCC_ImageBase> <DCC_Platform>x86</DCC_Platform> </PropertyGroup> @@ -81,12 +80,12 @@ <VersionInfo> <VersionInfo Name="IncludeVerInfo">True</VersionInfo> <VersionInfo Name="AutoIncBuild">False</VersionInfo> - <VersionInfo Name="MajorVer">1</VersionInfo> - <VersionInfo Name="MinorVer">0</VersionInfo> + <VersionInfo Name="MajorVer">2</VersionInfo> + <VersionInfo Name="MinorVer">2</VersionInfo> <VersionInfo Name="Release">0</VersionInfo> <VersionInfo Name="Build">0</VersionInfo> <VersionInfo Name="Debug">False</VersionInfo> - <VersionInfo Name="PreRelease">False</VersionInfo> + <VersionInfo Name="PreRelease">True</VersionInfo> <VersionInfo Name="Special">False</VersionInfo> <VersionInfo Name="Private">False</VersionInfo> <VersionInfo Name="DLL">False</VersionInfo> @@ -94,15 +93,15 @@ <VersionInfo Name="CodePage">1252</VersionInfo> </VersionInfo> <VersionInfoKeys> - <VersionInfoKeys Name="CompanyName"/> - <VersionInfoKeys Name="FileDescription"/> - <VersionInfoKeys Name="FileVersion">1.0.0.0</VersionInfoKeys> + <VersionInfoKeys Name="CompanyName">www.instantobjects.org</VersionInfoKeys> + <VersionInfoKeys Name="FileDescription">InstantObjects</VersionInfoKeys> + <VersionInfoKeys Name="FileVersion">2.2.0.0</VersionInfoKeys> <VersionInfoKeys Name="InternalName"/> <VersionInfoKeys Name="LegalCopyright"/> <VersionInfoKeys Name="LegalTrademarks"/> <VersionInfoKeys Name="OriginalFilename"/> - <VersionInfoKeys Name="ProductName"/> - <VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys> + <VersionInfoKeys Name="ProductName">InstantObjects</VersionInfoKeys> + <VersionInfoKeys Name="ProductVersion">2.2</VersionInfoKeys> <VersionInfoKeys Name="Comments"/> </VersionInfoKeys> <Excluded_Packages> Modified: trunk/Source/Brokers/XML/D2010/IOXML.dproj =================================================================== --- trunk/Source/Brokers/XML/D2010/IOXML.dproj 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Source/Brokers/XML/D2010/IOXML.dproj 2014-05-12 09:08:33 UTC (rev 963) @@ -2,7 +2,7 @@ <PropertyGroup> <ProjectGuid>{37C4CB77-A037-444C-B2CA-DF45FE103DD3}</ProjectGuid> <MainSource>IOXML.dpk</MainSource> - <Config Condition="'$(Config)'==''">Debug</Config> + <Config Condition="'$(Config)'==''">Release</Config> <DCC_DCCCompiler>DCC32</DCC_DCCCompiler> <ProjectVersion>12.0</ProjectVersion> </PropertyGroup> @@ -20,7 +20,7 @@ <Base>true</Base> </PropertyGroup> <PropertyGroup Condition="'$(Base)'!=''"> - <DCC_DependencyCheckOutputName>C:\Documents and Settings\All Users\Documents\RAD Studio\7.0\Bpl\IOXML_D14.bpl</DCC_DependencyCheckOutputName> + <DCC_DependencyCheckOutputName>C:\Users\Public\Documents\RAD Studio\7.0\Bpl\IOXML_D14.bpl</DCC_DependencyCheckOutputName> <DCC_TypedAtParameter>true</DCC_TypedAtParameter> <RuntimeOnlyPackage>true</RuntimeOnlyPackage> <DCC_UnitAlias>WinTypes=Windows;WinProcs=Windows;$(DCC_UnitAlias)</DCC_UnitAlias> @@ -29,7 +29,6 @@ <GenDll>true</GenDll> <GenPackage>true</GenPackage> <DllSuffix>_D14</DllSuffix> - <DCC_SymbolReferenceInfo>1</DCC_SymbolReferenceInfo> <DCC_ImageBase>00400000</DCC_ImageBase> <DCC_Platform>x86</DCC_Platform> </PropertyGroup> Modified: trunk/Source/Brokers/XML/DXE3/IOXML.dproj =================================================================== --- trunk/Source/Brokers/XML/DXE3/IOXML.dproj 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Source/Brokers/XML/DXE3/IOXML.dproj 2014-05-12 09:08:33 UTC (rev 963) @@ -7,7 +7,7 @@ <TargetedPlatforms>1</TargetedPlatforms> <AppType>Package</AppType> <FrameworkType>VCL</FrameworkType> - <ProjectVersion>14.3</ProjectVersion> + <ProjectVersion>14.4</ProjectVersion> <Platform Condition="'$(Platform)'==''">Win32</Platform> </PropertyGroup> <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''"> Modified: trunk/Source/Brokers/XML/InstantXML.pas =================================================================== --- trunk/Source/Brokers/XML/InstantXML.pas 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Source/Brokers/XML/InstantXML.pas 2014-05-12 09:08:33 UTC (rev 963) @@ -58,11 +58,15 @@ type TXMLFileFormat = (xffUtf8, xffIso); + TXMLFileOpenEvent = function (const AObject: TInstantObject; + const AObjectId, AFileName: string): Boolean of Object; + TXMLFilesAccessor = class(TCustomConnection) private FConnected: Boolean; FRootFolder: string; FXMLFileFormat: TXMLFileFormat; + FOnCustomLoadXMLFile: TXMLFileOpenEvent; function GetRootFolder: string; procedure SetRootFolder(const AValue: string); function ObjectUpdateCountFromFileName(const AFileName: string): Integer; @@ -73,8 +77,6 @@ function GetConnected: Boolean; override; // Override this method to redirect storage to different folders with a // class-level or object-level granularity. - function GetObjectFileName(const AStorageName, AObjectClassName, - AObjectId: string): string; virtual; function LoadInstantObjectFromXmlFile(const AObject: TInstantObject; const AObjectId, AFileName: string): Boolean; function SaveInstantObjectToXmlFile(const AObject: TInstantObject; @@ -97,6 +99,8 @@ function InternalDeleteInstantObject(const AObject: TInstantObject; const AStorageName: string): Boolean; virtual; public + function GetObjectFileName(const AStorageName, AObjectClassName, + AObjectId: string): string; virtual; constructor Create(AOwner: TComponent); override; function LocateInstantObject(const AStorageName, AObjectClassName, AObjectId: string): Boolean; @@ -112,8 +116,8 @@ const AStorageNames: TStrings); virtual; published property RootFolder: string read GetRootFolder write SetRootFolder; - property XMLFileFormat: TXMLFileFormat - read FXMLFileFormat write FXMLFileFormat default xffUtf8; + property XMLFileFormat: TXMLFileFormat read FXMLFileFormat write FXMLFileFormat default xffUtf8; + property OnCustomLoadXMLFile: TXMLFileOpenEvent read FOnCustomLoadXMLFile write FOnCustomLoadXMLFile; end; TInstantXMLConnectionDef = class(TInstantConnectionBasedConnectionDef) @@ -326,19 +330,11 @@ uses SysUtils, InstantConsts, - TypInfo, InstantXMLCatalog, InstantXMLConnectionDefEdit, InstantUtils, -{$IFDEF D17+} - System.Types, + TypInfo, InstantXMLCatalog, InstantUtils, +{$IFNDEF FMX} +InstantXMLConnectionDefEdit, FileCtrl, Controls, {$ENDIF} -{$IFDEF MSWINDOWS} -{$IFNDEF D6+} - FileCtrl, -{$ENDIF} - Windows, Controls; -{$ENDIF} -{$IFDEF LINUX} -QControls; -{$ENDIF} + Windows; resourcestring SCannotCreateDirectory = 'Cannot create directory %s'; @@ -455,6 +451,7 @@ function TInstantXMLConnectionDef.Edit: Boolean; begin +{$IFNDEF FMX} with TInstantXMLConnectionDefEditForm.Create(nil) do try LoadData(Self); @@ -464,6 +461,9 @@ finally Free; end; +{$ELSE} + Result := False; +{$ENDIF} end; { TInstantXMLResolver } @@ -1143,46 +1143,35 @@ end; end; -{$IFDEF UNICODE} function TXMLFilesAccessor.SaveInstantObjectToXmlFile( const AObject: TInstantObject; const AFileName: string): Boolean; var strstream: TStringStream; fileStream: TFileStream; +{$IFDEF UNICODE} DataStr: UTF8String; +{$ELSE} + DataStr: string; +{$ENDIF} begin +{$IFDEF UNICODE} strstream := TStringStream.Create('', TEncoding.UTF8); +{$ELSE} + strstream := TStringStream.Create(''); +{$ENDIF} try InstantWriteObject(strStream, sfXML, AObject); +{$IFDEF UNICODE} DataStr := XML_UTF8_HEADER + UTF8String(GetXMLLineBreak) + UTF8String(strStream.DataString); - finally - strStream.Free; - end; - fileStream := TFileStream.Create(AFileName, fmCreate); - try - Result := fileStream.Write(DataStr[1], Length(DataStr)) <> 0; - finally - fileStream.Free; - end; -end; {$ELSE} -function TXMLFilesAccessor.SaveInstantObjectToXmlFile( - const AObject: TInstantObject; const AFileName: string): Boolean; -var - strstream: TStringStream; - fileStream: TFileStream; - DataStr: string; -begin - strstream := TStringStream.Create(''); - try - InstantWriteObject(strStream, sfXML, AObject); -{$IFDEF D6+} + {$IFDEF D6+} if FXMLFileFormat = xffUtf8 then DataStr := AnsiToUtf8(XML_UTF8_HEADER + GetXMLLineBreak + strStream.DataString) else DataStr := XML_ISO_HEADER + GetXMLLineBreak + strStream.DataString; -{$ELSE} + {$ELSE} DataStr := strStream.DataString; + {$ENDIF} {$ENDIF} finally strStream.Free; @@ -1194,7 +1183,6 @@ fileStream.Free; end; end; -{$ENDIF} {$IFDEF UNICODE} function TXMLFilesAccessor.LoadInstantObjectFromXmlFile( @@ -1202,18 +1190,27 @@ var fileStream: TFileStream; begin + Result := False; if FileExists(AFileName) then begin - fileStream := TFileStream.Create(AFileName, fmShareDenyWrite); - try - InstantReadObject(fileStream, sfXML, AObject); - Result := True; - finally - fileStream.Free; + Try + if Assigned(FOnCustomLoadXMLFile) then + Result := FOnCustomLoadXMLFile(AObject, AObjectId, AFileName); + + if not Result then + begin + fileStream := TFileStream.Create(AFileName, fmShareDenyWrite); + try + InstantReadObject(fileStream, sfXML, AObject); + Result := True; + finally + fileStream.Free; + end; + end; + except + on E: Exception do raise EInOutError.CreateFmt(SErrorLoadingFile, [AFileName, E.Message]); end; - end - else - Result := False; + end; end; {$ELSE} function TXMLFilesAccessor.LoadInstantObjectFromXmlFile( @@ -1223,24 +1220,32 @@ strUtf8: string; strstream: TStringStream; begin - fileStream := TFileStream.Create(AFileName, fmShareDenyWrite); - try - SetLength(strUtf8, fileStream.Size); - Result := fileStream.Read(strUtf8[1], fileStream.Size) <> 0; - finally - fileStream.Free; - end; + if Assigned(FOnCustomLoadXMLFile) then + Result := FOnCustomLoadXMLFile(AObject, AObjectId, AFileName); -{$IFDEF D6+} - if FXMLFileFormat = xffUtf8 then - strUtf8 := Utf8ToAnsi(strUtf8); -{$ENDIF} + if not Result then + + begin + fileStream := TFileStream.Create(AFileName, fmShareDenyWrite); + try + SetLength(strUtf8, fileStream.Size); + Result := fileStream.Read(strUtf8[1], fileStream.Size) <> 0; + finally + fileStream.Free; + end; + {$IFDEF D6+} + if FXMLFileFormat = xffUtf8 then + strUtf8 := Utf8ToAnsi(strUtf8); + {$ENDIF} - strstream := TStringStream.Create(strUtf8); - try - InstantReadObject(strstream, sfXML, AObject); - finally - strstream.Free; + strstream := TStringStream.Create(strUtf8); + try try + InstantReadObject(strstream, sfXML, AObject); + except + on E: Exception do raise EInOutError.CreateFmt(SErrorLoadingFile, [AFileName, E.Message]); end; + finally + strstream.Free; + end; end; end; {$ENDIF} Modified: trunk/Source/Brokers/XML/InstantXMLCatalog.pas =================================================================== --- trunk/Source/Brokers/XML/InstantXMLCatalog.pas 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Source/Brokers/XML/InstantXMLCatalog.pas 2014-05-12 09:08:33 UTC (rev 963) @@ -42,7 +42,7 @@ interface uses -{$IFDEF MSWINDOWS} +{$IFNDEF FMX} FileCtrl, {$ENDIF} InstantPersistence, InstantBrokers, InstantMetadata, InstantTypes; Modified: trunk/Source/Catalogs/IBFb/D2010/IOIBFbCatalog.dproj =================================================================== --- trunk/Source/Catalogs/IBFb/D2010/IOIBFbCatalog.dproj 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Source/Catalogs/IBFb/D2010/IOIBFbCatalog.dproj 2014-05-12 09:08:33 UTC (rev 963) @@ -20,14 +20,13 @@ <Base>true</Base> </PropertyGroup> <PropertyGroup Condition="'$(Base)'!=''"> - <DCC_DependencyCheckOutputName>C:\Documents and Settings\All Users\Documents\RAD Studio\7.0\Bpl\IOIBFbCatalog_D14.bpl</DCC_DependencyCheckOutputName> + <DCC_DependencyCheckOutputName>C:\Users\Public\Documents\RAD Studio\7.0\Bpl\IOIBFbCatalog_D14.bpl</DCC_DependencyCheckOutputName> <DCC_TypedAtParameter>true</DCC_TypedAtParameter> <DCC_Description>InstantObjects Catalog for InterBase and Firebird (Delphi 2010)</DCC_Description> <RuntimeOnlyPackage>true</RuntimeOnlyPackage> <DllSuffix>_D14</DllSuffix> <DCC_OutputNeverBuildDcps>true</DCC_OutputNeverBuildDcps> <GenDll>true</GenDll> - <DCC_SymbolReferenceInfo>1</DCC_SymbolReferenceInfo> <GenPackage>true</GenPackage> <DCC_ImageBase>00400000</DCC_ImageBase> <DCC_Platform>x86</DCC_Platform> Modified: trunk/Source/Catalogs/IBFb/DXE3/IOIBFbCatalog.dproj =================================================================== --- trunk/Source/Catalogs/IBFb/DXE3/IOIBFbCatalog.dproj 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Source/Catalogs/IBFb/DXE3/IOIBFbCatalog.dproj 2014-05-12 09:08:33 UTC (rev 963) @@ -7,7 +7,7 @@ <TargetedPlatforms>1</TargetedPlatforms> <AppType>Package</AppType> <FrameworkType>None</FrameworkType> - <ProjectVersion>14.3</ProjectVersion> + <ProjectVersion>14.4</ProjectVersion> <Platform Condition="'$(Platform)'==''">Win32</Platform> </PropertyGroup> <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''"> Modified: trunk/Source/Core/D2010/IOCore.dproj =================================================================== --- trunk/Source/Core/D2010/IOCore.dproj 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Source/Core/D2010/IOCore.dproj 2014-05-12 09:08:33 UTC (rev 963) @@ -33,7 +33,6 @@ <GenDll>true</GenDll> <GenPackage>true</GenPackage> <DllSuffix>_D14</DllSuffix> - <DCC_SymbolReferenceInfo>1</DCC_SymbolReferenceInfo> </PropertyGroup> <PropertyGroup Condition="'$(Cfg_1)'!=''"> <Version>7.0</Version> Modified: trunk/Source/Core/DXE3/IOCore.dproj =================================================================== --- trunk/Source/Core/DXE3/IOCore.dproj 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Source/Core/DXE3/IOCore.dproj 2014-05-12 09:08:33 UTC (rev 963) @@ -7,7 +7,7 @@ <TargetedPlatforms>1</TargetedPlatforms> <AppType>Package</AppType> <FrameworkType>VCL</FrameworkType> - <ProjectVersion>14.3</ProjectVersion> + <ProjectVersion>14.4</ProjectVersion> <Platform Condition="'$(Platform)'==''">Win32</Platform> </PropertyGroup> <PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''"> Modified: trunk/Source/Core/InstantBrokers.pas =================================================================== --- trunk/Source/Core/InstantBrokers.pas 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Source/Core/InstantBrokers.pas 2014-05-12 09:08:33 UTC (rev 963) @@ -423,6 +423,7 @@ FSelectExternalPartSQL: string; FDeleteExternalSQL: string; FInsertExternalSQL: string; + FSelectVirtualSQL: string; function AddIntegerParam(Params: TParams; const ParamName: string; Value: Integer): TParam; function AddStringParam(Params: TParams; const ParamName, Value: string): TParam; @@ -441,6 +442,7 @@ function GetUpdateConcurrentSQL: string; function GetUpdateSQL: string; function GetBroker: TInstantSQLBroker; + function GetSelectVirtualSQL: string; function GetSelectExternalSQL: string; function GetSelectExternalPartSQL: string; function GetDeleteExternalSQL: string; @@ -512,6 +514,8 @@ write FInsertExternalSQL; property Map: TInstantAttributeMap read FMap; property SelectSQL: string read GetSelectSQL write FSelectSQL; + property SelectVirtualSQL: string read GetSelectVirtualSQL + write FSelectVirtualSQL; property SelectExternalSQL: string read GetSelectExternalSQL write FSelectExternalSQL; property SelectExternalPartSQL: string read GetSelectExternalPartSQL @@ -594,16 +598,20 @@ end; // TInstantSQLLinkResolver class defines interface for handling - // access to container attributes with external storage for + // access to container attributes with external or virtual storage for // SQL brokers. Due to the generic nature of SQL this class is used // directly and no descendant classes are needed for SQL brokers. TInstantSQLLinkResolver = class(TInstantLinkResolver) private FAttributeOwner: TInstantObject; FTableName: string; + FParentObjectClassFieldName: string; + FParentObjectIdFieldName: string; function GetBroker: TInstantSQLBroker; function GetResolver: TInstantSQLResolver; property TableName: string read FTableName; + property ParentObjectClassFieldName: string read FParentObjectClassFieldName; + property ParentObjectIdFieldName: string read FParentObjectIdFieldName; protected procedure InternalStoreAttributeObjects(Attribute: TInstantContainer); override; @@ -733,6 +741,8 @@ string; virtual; function InternalGenerateSelectSQL(Map: TInstantAttributeMap): string; virtual; + function InternalGenerateSelectVirtualSQL(Map: TInstantAttributeMap): + string; virtual; function InternalGenerateSelectExternalSQL(Map: TInstantAttributeMap): string; virtual; function InternalGenerateSelectExternalPartSQL(Map: TInstantAttributeMap): @@ -762,6 +772,7 @@ function GenerateInsertSQL(Map: TInstantAttributeMap): string; function GenerateInsertExternalSQL(Map: TInstantAttributeMap): string; function GenerateSelectSQL(Map: TInstantAttributeMap): string; + function GenerateSelectVirtualSQL(Map: TInstantAttributeMap): string; function GenerateSelectExternalSQL(Map: TInstantAttributeMap): string; function GenerateSelectExternalPartSQL(Map: TInstantAttributeMap): string; function GenerateSelectTablesSQL: string; @@ -1119,6 +1130,11 @@ var InstantLogProc: procedure (const AString: string) of object; +{$IFDEF IO_STATEMENT_LOGGING} +procedure InstantLogStatement(const Caption, AStatement: string; + AParams: TParams = nil); +{$ENDIF} + implementation uses @@ -1835,7 +1851,7 @@ {$IFDEF D12+} if AConnector.BlobStreamFormat = sfBinary then - Result := TBytesStream.Create(AField.AsBytes) + Result := TStringStream.Create(AField.AsString) else {$ENDIF} Result := TInstantStringStream.Create(AField.AsString); @@ -1848,7 +1864,7 @@ {$IFDEF D12+} if AConnector.BlobStreamFormat = sfBinary then - Result := TBytesStream.Create + Result := TStringStream.Create else Result := TStringStream.Create('', TEncoding.UTF8); {$ELSE} @@ -2093,7 +2109,7 @@ var LinkDatasetResolver: TInstantNavigationalLinkResolver; begin - if Attribute.Metadata.StorageKind = skExternal then + if Attribute.Metadata.StorageKind in [skExternal, skVirtual] then begin LinkDatasetResolver := GetLinkDatasetResolver(Attribute.Metadata.ExternalStorageName); @@ -2552,7 +2568,7 @@ begin with Attribute do begin - if Metadata.StorageKind = skExternal then + if Metadata.StorageKind in [skExternal, skVirtual] then begin Clear; LinkDatasetResolver := @@ -3006,7 +3022,7 @@ Part.Value.CheckId; AddIdParam(Params, FieldName + InstantIdFieldName, Part.Value.Id); end - else + else if Attribute.Metadata.StorageKind = skEmbedded then begin Stream := CreateEmbeddedObjectOutputStream(Broker.Connector); try @@ -3152,9 +3168,9 @@ LParam := AddParam(AParams, AParamName, ftBlob); if AStream.Size > 0 then {$IFDEF D12+} - LParam.AsBytes := (AStream as TBytesStream).Bytes; + LParam.AsBlob := BytesOf((AStream as TStringStream).DataString); {$ELSE} - LParam.AsMemo := (AStream as TStringStream).DataString; + LParam.AsBlob := (AStream as TStringStream).DataString; {$ENDIF} end else @@ -3170,7 +3186,7 @@ var Param: TParam; begin - Param := AddParam(Params, ParamName, InstantDataTypeToFieldType(Broker.Connector.IdDataType)); + Param := AddParam(Params, ParamName, InstantDataTypeToFieldType(Broker.Connector.IdDataType, Broker.Connector.UseUnicode)); if Value <> '' then Param.Value := Value; end; @@ -3199,7 +3215,10 @@ function TInstantSQLResolver.AddStringParam(Params: TParams; const ParamName, Value: string): TParam; begin - Result := AddParam(Params, ParamName, ftString); + if Broker.Connector.UseUnicode then + Result := AddParam(Params, ParamName, ftWideString) + else + Result := AddParam(Params, ParamName, ftString); if Value <> '' then Result.AsString := Value; end; @@ -3286,6 +3305,13 @@ Result := FSelectExternalPartSQL; end; +function TInstantSQLResolver.GetSelectVirtualSQL: string; +begin + if FSelectVirtualSQL = '' then + FSelectVirtualSQL := Broker.Generator.GenerateSelectVirtualSQL(Map); + Result := FSelectVirtualSQL; +end; + function TInstantSQLResolver.GetSelectExternalSQL: string; begin if FSelectExternalSQL = '' then @@ -3806,7 +3832,7 @@ Stream: TStream; LinkResolver: TInstantSQLLinkResolver; begin - if AttributeMetadata.StorageKind = skExternal then + if AttributeMetadata.StorageKind in [skExternal, skVirtual] then begin with (Attribute as TInstantReferences) do begin @@ -4285,9 +4311,34 @@ constructor TInstantSQLLinkResolver.Create(AResolver: TInstantSQLResolver; const ATableName: string; AObject: TInstantObject); +var + p: integer; begin inherited Create(AResolver); - FTableName := ATableName; + //A virtual external container can have a composite TableName like: + //'DETAILTABLENAME;MASTEROBJECTCLASS;MASTEROBJECTID' + //If not specified the default fields for master/details relations are: + //InstantParentClassFieldName and InstantParentIdFieldName + p := pos(';',ATableName); + if p > 0 then + begin + FTableName := Copy(ATableName,1,p-1); + FParentObjectClassFieldName := Copy(ATableName,p+1,MaxInt); + p := pos(';',FParentObjectClassFieldName); + if p > 0 then + begin + FParentObjectIdFieldName := Copy(FParentObjectClassFieldName,p+1,MaxInt); + FParentObjectClassFieldName := Copy(FParentObjectClassFieldName,1,p-1); + end + else + FParentObjectIdFieldName := InstantParentIdFieldName; + end + else + begin + FTableName := ATableName; + FParentObjectClassFieldName := InstantParentClassFieldName; + FParentObjectIdFieldName := InstantParentIdFieldName; + end; FAttributeOwner := AObject; end; @@ -4373,10 +4424,29 @@ Params: TParams; Dataset: TDataSet; LChildClassField, LChildIdField: TField; + SequenceNoFieldName, FromClause, OrderByClause: string; begin Params := TParams.Create; try - Statement := Format(Resolver.SelectExternalSQL, [TableName]); + if Attribute.Metadata.StorageKind = skVirtual then + begin + Statement := Resolver.SelectVirtualSQL; + //Default values + FromClause := TableName; + Attribute.Owner.GetDetailsStatementValues(FromClause,SequenceNoFieldName,OrderByClause); + //Statement custom + Statement := Format(Statement, + [TableName,TableName, + TableName+'.'+SequenceNoFieldName, + FromClause, + TableName+'.'+ParentObjectClassFieldName, + TableName+'.'+ParentObjectIdFieldName, + OrderByClause]); + end + else + begin + Statement := Format(Resolver.SelectExternalSQL, [TableName]); + end; Resolver.AddIdParam(Params, InstantParentIdFieldName, AObjectId); Resolver.AddStringParam(Params, InstantParentClassFieldName, AttributeOwner.ClassName); @@ -4697,7 +4767,7 @@ end else if AttributeMetadata.AttributeType = atPart then begin - if AttributeMetadata.StorageKind = skExternal then + if AttributeMetadata.StorageKind in [skExternal, skVirtual] then begin RefClassFieldName := FieldName + InstantClassFieldName; RefIdFieldName := FieldName + InstantIdFieldName; @@ -4846,6 +4916,12 @@ Result := InternalGenerateSelectExternalSQL(Map); end; +function TInstantSQLGenerator.GenerateSelectVirtualSQL( + Map: TInstantAttributeMap): string; +begin + Result := InternalGenerateSelectVirtualSQL(Map); +end; + function TInstantSQLGenerator.GenerateSelectSQL (Map: TInstantAttributeMap): string; begin @@ -5048,6 +5124,19 @@ [FieldStr, EmbraceTable('%s'), WhereStr]); end; +function TInstantSQLGenerator.InternalGenerateSelectVirtualSQL( + Map: TInstantAttributeMap): string; +var + FieldStr, WhereStr: string; +begin + FieldStr := Format('%s.CLASS '+InstantChildClassFieldName+', %s.ID '+InstantChildIdFieldName+', %s SequenceNo', + [EmbraceField('%s'),EmbraceField('%s'),EmbraceField('%s'), + EmbraceField(InstantIdFieldName), EmbraceField(InstantUpdateCountFieldName)]); + WhereStr := '%s = :'+InstantParentClassFieldName+' AND %s = :'+InstantParentIdFieldName; + Result := Format('SELECT %s FROM %s WHERE %s ORDER BY %s', + [FieldStr, EmbraceTable('%s'), WhereStr, EmbraceField('%s')]); +end; + function TInstantSQLGenerator.InternalGenerateSelectExternalSQL( Map: TInstantAttributeMap): string; var @@ -5589,8 +5678,8 @@ AContext.Qualify(LTablePath, LFieldName + InstantIdFieldName)])); end else if (LAttrMeta.AttributeType in [atParts, atReferences]) - and (LAttrMeta.StorageKind = skExternal) then - // No fields needed for external containers. + and (LAttrMeta.StorageKind in [skExternal, skVirtual]) then + // No fields needed for external and virtual containers. else // Select all other fields. Writer.WriteString(Format(', %s', [AContext.QualifyPath(LAttrMeta.Name)])); @@ -6512,24 +6601,30 @@ LPath: TInstantIQLPath; LClassMeta: TInstantClassMetadata; begin + // Standard non-burst mode adds the main table only when needed, not always. + // A possible optimization would be to add it only if it does actually + // have attributes we select. For now let's add it by default as it + // covers almost all cases. We add it first to ease the join clause + // generation later. + if IsBurstLoadMode(ActualLoadMode) then + AddTablePath(TableName); + + // Add main table path as required. if ClassRef.Any then - LTablePath := ObjectClassMetadata.TableName + LTablePath := TableName else begin LPath := FindAttributePath; if Assigned(LPath) then LTablePath := PathToTablePath(LPath.Attributes[0]) else - LTablePath := ObjectClassMetadata.TableName; + LTablePath := TableName; end; AddTablePath(LTablePath); + + // Add paths for all parent tables in burst mode. if IsBurstLoadMode(ActualLoadMode) then begin - // Standard mode only adds the main table when needed, and not always. - // A possible optimization would be to add it only if it does actually - // have attributes we select. For now let's add it by default as it - // covers almost all cases. - AddTablePath(TableName); LClassMeta := ObjectClassMetadata.Parent; while Assigned(LClassMeta) do begin Modified: trunk/Source/Core/InstantCode.pas =================================================================== --- trunk/Source/Core/InstantCode.pas 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Source/Core/InstantCode.pas 2014-05-12 09:08:33 UTC (rev 963) @@ -1593,6 +1593,7 @@ MetaKeyDefault = 'default'; MetaKeyUseNull = 'usenull'; MetaKeyExternal = 'external'; + MetaKeyVirtual = 'virtual'; MetaKeyFormat = 'format'; MetaKeyIndex = 'index'; MetaKeyRequired = 'required'; @@ -1865,6 +1866,11 @@ FMetadata.StorageKind := skExternal; FMetadata.ExternalStorageName := ReadStringValue; end; + if SameText(Token, MetaKeyVirtual) then + begin + FMetadata.StorageKind := skVirtual; + FMetadata.ExternalStorageName := ReadStringValue; + end; end; end; end; @@ -4192,6 +4198,10 @@ WriteStr(MetaKeyStored, Metadata.StorageName); WriteStr(MetaKeyExternal, Metadata.ExternalStorageName, True); end + else if Metadata.StorageKind = skVirtual then + begin + WriteStr(MetaKeyVirtual, Metadata.ExternalStorageName, True); + end else WriteStr(MetaKeyStored, Metadata.StorageName); WriteStr(MetaKeyDefault, Metadata.DefaultValue); @@ -4392,7 +4402,7 @@ function TInstantCodeAttribute.GetCanHaveStorageName: boolean; begin - Result := (StorageKind <> skExternal) or (AttributeType = atPart); + Result := (not (StorageKind in [skExternal, skVirtual])) or (AttributeType = atPart); end; function TInstantCodeAttribute.GetCanBeExternal: boolean; @@ -9086,6 +9096,11 @@ FMetadata.StorageKind := skExternal; FMetadata.ExternalStorageName := ''; end + else if SameText(Token, MetaKeyVirtual) then + begin + FMetadata.StorageKind := skVirtual; + FMetadata.ExternalStorageName := ''; + end else if SameText(Token, MetaKeyStored) then FMetadata.StorageName := ReadStringValue; end; Modified: trunk/Source/Core/InstantCommand.pas =================================================================== --- trunk/Source/Core/InstantCommand.pas 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Source/Core/InstantCommand.pas 2014-05-12 09:08:33 UTC (rev 963) @@ -115,7 +115,7 @@ end; TInstantIQLOperatorType = (otEQ, otGT, otLT, otNE, otEN, otEG, otGE, otLE, - otEL, otLike, otIs, otIn, otAdd, otSub, otOr, otXor, otMul, otDiv, otFDiv, + otEL, otLike, otIs, otIn, otNotIn, otAdd, otSub, otOr, otXor, otMul, otDiv, otFDiv, //Differs from standard otMod, otAnd); TInstantIQLOperatorTypes = set of TInstantIQLOperatorType; @@ -545,9 +545,12 @@ InstantPersistence, InstantUtils, InstantConsts, InstantBrokers; const - OperatorTokens: array[TInstantIQLOperatorType] of string = ('=', '>', '<', - '<>', '><', '=>', '>=', '<=', '=<', 'LIKE', 'IS', 'IN', '+', '-', 'OR', + OperatorInTokens: array[TInstantIQLOperatorType] of string = ('=', '>', '<', + '<>', '><', '=>', '>=', '<=', '=<', 'LIKE', 'IS', 'IN', 'NOT_IN', '+', '-', 'OR', 'XOR', '*', 'DIV', '/', 'MOD', 'AND'); + OperatorOutTokens: array[TInstantIQLOperatorType] of string = ('=', '>', '<', + '<>', '><', '=>', '>=', '<=', '=<', 'LIKE', 'IS', 'IN', 'NOT IN', '+', '-', 'OR', + 'XOR', '*', 'DIV', '/', 'MOD', 'AND'); OrderTokens: array[TInstantIQLOrderDirection] of string = ('ASC', 'DESC'); { TInstantIQLReader } @@ -843,9 +846,9 @@ var OpType: TInstantIQLOperatorType; begin - for OpType := Low(OperatorTokens) to High(OperatorTokens) do + for OpType := Low(OperatorInTokens) to High(OperatorInTokens) do if (OpType in OperatorTypes) and - SameText(Token, OperatorTokens[OpType]) then + SameText(Token, OperatorInTokens[OpType]) then begin Result := True; OperatorType := OpType; @@ -890,7 +893,7 @@ procedure TInstantIQLOperator.WriteObject(Writer: TInstantIQLWriter); begin inherited; - Writer.WriteString(OperatorTokens[FOperatorType]); + Writer.WriteString(OperatorOutTokens[FOperatorType]); end; { TInstantIQLRelOp } @@ -898,7 +901,7 @@ class function TInstantIQLRelOp.OperatorTypes: TInstantIQLOperatorTypes; begin Result := [otEQ, otGT, otLT, otNE, otEN, otEG, otGE, otLE, otEL, otLike, - otIs, otIn]; + otIs, otIn, otNotIn]; end; { TInstantIQLAddOp } @@ -1165,7 +1168,7 @@ procedure TInstantIQLConstant.ReadObject(Reader: TInstantIQLReader); var - Token: string; + Token, LastToken: string; begin inherited; Token := Reader.ReadToken; @@ -1173,8 +1176,12 @@ begin FValue := Token; repeat + LastToken := Token; Token := Reader.ReadToken; - FValue := FValue + Token; + if Pos(LastToken+Token, '><>>=<=!==') > 0 then + FValue := FValue + Token + else + FValue := FValue + ' ' + Token; until Token = ']' end else FValue := Token; Modified: trunk/Source/Core/InstantConnectionManagerFormUnit.pas =================================================================== --- trunk/Source/Core/InstantConnectionManagerFormUnit.pas 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Source/Core/InstantConnectionManagerFormUnit.pas 2014-05-12 09:08:33 UTC (rev 963) @@ -670,7 +670,7 @@ procedure TInstantConnectionManagerForm.SetOnSupportConnector( Value: TInstantConnectorClassEvent); begin - if @Value <> @FOnSupportConnector then + if Addr(Value) <> Addr(FOnSupportConnector) then begin FOnSupportConnector := Value; UpdateMenu; Modified: trunk/Source/Core/InstantConsts.pas =================================================================== --- trunk/Source/Core/InstantConsts.pas 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Source/Core/InstantConsts.pas 2014-05-12 09:08:33 UTC (rev 963) @@ -117,6 +117,7 @@ SDisposeConflict = 'Object %s(''%s'') was disposed by another session'; SErrorDisposingObject = 'Error disposing object %s(''%s''): "%s"'; SErrorLoadingConnectionDefs = 'Error loading connection definitions from %s: %s'; + SErrorLoadingFile = 'Error loading file "%s": %s'; SErrorRefreshingObject = 'Error refreshing object %s(''%s''): "%s"'; SErrorRetrievingObject = 'Error retrieving object %s(''%s''): "%s"'; SErrorStoringObject = 'Error storing object %s(''%s''): "%s"'; Modified: trunk/Source/Core/InstantExplorer.pas =================================================================== --- trunk/Source/Core/InstantExplorer.pas 2012-10-29 21:30:50 UTC (rev 962) +++ trunk/Source/Core/InstantExplorer.pas 2014-05-12 09:08:33 UTC (rev 963) @@ -152,8 +152,6 @@ FOnIncludeNode: TInstantExplorerIncludeNodeEvent; FOnGetAllowedValues: TInstantExplorerGetAllowedValuesEvent; FOnGetFieldNames: TInstantExplorerGetFieldNamesEvent; - function AddNode(NodeType: TInstantExplorerNodeType; Parent: TTreeNode; - Name: string; AObject: TObject; Value: string = ''): TTreeNode; procedure ArrangeControls; procedure AssignRootObject(Value: TObject); procedure CreateContentView; @@ -171,10 +169,12 @@ const APropName: string; const AAllowedValues: TStrings); function GetImages: TCustomImageList; procedure LoadContainerNode(Node: TTreeNode; Container: TInstantContainer); + procedure LoadInstantQueryNode(Node: TTreeNode; InstantQuery: TInstantQuery); procedure LoadNode(Node: TTreeNode; LoadChildren: Boolean); procedure LoadObjectNode(Node: TTreeNode; Instance: TObject; var ChildCount: Integer; LoadChildren: Boolean); function NodeIsLoaded(Node: TTreeNode): Boolean; + function NodeDataIsAssigned(Node: TTreeNode): Boolean; procedure ObjectExposerAfterDelete(Sender: TDataSet); procedure ObjectExposerAfterPost(Sender: TDataSet); procedure ResizeControls; @@ -190,6 +190,8 @@ function GetContentEditor: TWinControl; function CreateFieldList: TStrings; protected + function AddNode(NodeType: TInstantExplorerNodeType; Parent: TTreeNode; + Name: string; AObject: TObject; Value: string = ''): TTreeNode; virtual; procedure ChangeNode(Node: TTreeNode); virtual; function CreateContentEditor(AOwner: TComponent; DataSource: TDataSource): TInstantExplorerContentEditor; virtual; @@ -212,6 +214,8 @@ procedure SetNodeTypes(const Value: TInstantExplorerNodeTypes); virtual; procedure SetRootObject(const Value: TObject); virtual; procedure UpdateDetails; + functio... [truncated message content] |