From: <dav...@us...> - 2009-08-18 08:09:44
|
Revision: 845 http://instantobjects.svn.sourceforge.net/instantobjects/revision/?rev=845&view=rev Author: davidvtaylor Date: 2009-08-18 08:09:33 +0000 (Tue, 18 Aug 2009) Log Message: ----------- AnyDAC broker enhancements - Add support for UseNull feature - Finalize Firebird database creation logic (tested embedded DB only) - Add support for setting PageSize for Firebird database creation - Changed default Firebird CharacterSet from ISO8859_1 to UTF8 Modified Paths: -------------- trunk/Source/Brokers/AnyDAC/InstantAnyDAC.pas Modified: trunk/Source/Brokers/AnyDAC/InstantAnyDAC.pas =================================================================== --- trunk/Source/Brokers/AnyDAC/InstantAnyDAC.pas 2009-08-18 08:03:27 UTC (rev 844) +++ trunk/Source/Brokers/AnyDAC/InstantAnyDAC.pas 2009-08-18 08:09:33 UTC (rev 845) @@ -35,7 +35,7 @@ {$I '..\..\InstantDefines.inc'} {$ENDIF} -// Supported databases (only MSSQL has been tested as of 3/21/2009) +// Supported databases (only MSSQL and Firebird have been tested as of 8/18/2009) {$DEFINE SYBASE_SUPPORT} {$DEFINE MSSQL_SUPPORT} @@ -50,8 +50,8 @@ uses Classes, Db, InstantPersistence, InstantCommand, InstantDBBuild, InstantBrokers, InstantMetadata, InstantTypes, uADCompClient, - uADStanOption, uADStanParam, uADStanIntf, uADStanConst - {$IFDEF D10+}, DBCommonTypes{$ENDIF}; + uADStanOption, uADStanParam, uADStanIntf, uADStanConst, + {$IFDEF D10+}DBCommonTypes{$ENDIF}; type TInstantAnyDACConnectionDef = class(TInstantRelationalConnectionDef) @@ -307,6 +307,9 @@ InstantConsts, InstantClasses, InstantAnyDACConnectionDefEdit, InstantAnyDACCatalog, InstantUtils; +resourcestring + SInvalidDatabasePageSize = 'Invalid database PageSize value: "%s"'; + {$IFDEF SQLITE_SUPPORT} const STmpTableSuffix = '_IOTmp_'; @@ -698,6 +701,12 @@ else TargetParam.Assign(SourceParam); end; + + if (SourceParam.IsNull) then + begin + TargetParam.Clear; + TargetParam.Bound := true; + end; end; function TInstantAnyDACBroker.CreateCatalog(const AScheme: TInstantScheme): TInstantCatalog; @@ -936,8 +945,11 @@ var OldProperties : string; CharacterSet : string; + PageSizeStr : string; + PageSize : integer; +const + DEFAULT_DB_PAGESIZE = 8192; begin - // TODO Quick first pass at using built-in AnyDAC database creation logic (not tested) // do not call inherited with Connector do begin @@ -945,13 +957,29 @@ try CharacterSet := trim(Connection.Params.Values['CharacterSet']); + PageSizeStr := trim(Connection.Params.Values['PageSize']); if (CharacterSet = '') then - CharacterSet := 'ISO8859_1'; + CharacterSet := 'UTF8'; + if (PageSizeStr <> '') then + begin + PageSize := StrToIntDef(PageSizeStr,-1); + if (PageSize <> 1024) and // Deprecated for FB 2.1+ + (PageSize <> 2048) and // Deprecated for FB 2.1+ + (PageSize <> 4096) and + (PageSize <> 8192) and + (PageSize <> 16384) then // Available FB 2.0 and later + raise EInstantError.CreateFmt(SInvalidDatabasePageSize, [PageSizeStr]); + end else + begin + PageSize := DEFAULT_DB_PAGESIZE; + end; + Connection.Params.Values['CharacterSet'] := CharacterSet; Connection.Params.Values['CreateDatabase'] := 'Yes'; - Connection.Params.Values['PageSize'] := '4096'; + Connection.Params.Values['SQLDialect'] := '3'; + Connection.Params.Values['PageSize'] := IntToStr(PageSize); Connect; Disconnect; finally |
From: <dav...@us...> - 2009-08-19 06:04:38
|
Revision: 849 http://instantobjects.svn.sourceforge.net/instantobjects/revision/?rev=849&view=rev Author: davidvtaylor Date: 2009-08-19 06:04:32 +0000 (Wed, 19 Aug 2009) Log Message: ----------- Fix problem with AnyDAC broker uses list under Delphi 7 Modified Paths: -------------- trunk/Source/Brokers/AnyDAC/InstantAnyDAC.pas Modified: trunk/Source/Brokers/AnyDAC/InstantAnyDAC.pas =================================================================== --- trunk/Source/Brokers/AnyDAC/InstantAnyDAC.pas 2009-08-19 05:57:21 UTC (rev 848) +++ trunk/Source/Brokers/AnyDAC/InstantAnyDAC.pas 2009-08-19 06:04:32 UTC (rev 849) @@ -50,8 +50,8 @@ uses Classes, Db, InstantPersistence, InstantCommand, InstantDBBuild, InstantBrokers, InstantMetadata, InstantTypes, uADCompClient, - uADStanOption, uADStanParam, uADStanIntf, uADStanConst, - {$IFDEF D10+}DBCommonTypes{$ENDIF}; + uADStanOption, uADStanParam, uADStanIntf, uADStanConst + {$IFDEF D10+}, DBCommonTypes{$ENDIF}; type TInstantAnyDACConnectionDef = class(TInstantRelationalConnectionDef) |
From: <dav...@us...> - 2009-08-25 19:49:21
|
Revision: 861 http://instantobjects.svn.sourceforge.net/instantobjects/revision/?rev=861&view=rev Author: davidvtaylor Date: 2009-08-25 19:49:09 +0000 (Tue, 25 Aug 2009) Log Message: ----------- Update AnyDAC broker to fix breakage caused by new Enum type support Modified Paths: -------------- trunk/Source/Brokers/AnyDAC/InstantAnyDAC.pas Modified: trunk/Source/Brokers/AnyDAC/InstantAnyDAC.pas =================================================================== --- trunk/Source/Brokers/AnyDAC/InstantAnyDAC.pas 2009-08-25 19:25:51 UTC (rev 860) +++ trunk/Source/Brokers/AnyDAC/InstantAnyDAC.pas 2009-08-25 19:49:09 UTC (rev 861) @@ -900,7 +900,8 @@ 'DATETIME', 'IMAGE', 'DATETIME', - 'DATETIME'); + 'DATETIME', + 'INTEGER'); begin Result := Types[DataType]; end; @@ -927,7 +928,8 @@ 'DATETIME', 'IMAGE', 'DATETIME', - 'DATETIME'); + 'DATETIME', + 'INTEGER'); begin Result := Types[DataType]; end; @@ -1000,7 +1002,8 @@ 'TIMESTAMP', 'BLOB', 'TIMESTAMP', - 'TIMESTAMP'); + 'TIMESTAMP', + 'INTEGER'); begin Result := Types[DataType]; end; @@ -1032,7 +1035,8 @@ 'DATE', 'BLOB', 'DATE', - 'DATE'); + 'DATE', + 'INTEGER'); begin Result := Types[DataType]; end; @@ -1058,7 +1062,8 @@ 'TIMESTAMP', 'BYTEA', 'TIMESTAMP', - 'TIMESTAMP'); + 'TIMESTAMP', + 'INTEGER'); begin Result := Types[DataType]; end; @@ -1355,7 +1360,8 @@ 'TIMESTAMP', 'BLOB', 'TIMESTAMP', - 'TIMESTAMP'); + 'TIMESTAMP', + 'INTEGER'); begin Result := Types[DataType]; end; |
From: <dav...@us...> - 2009-10-12 20:20:02
|
Revision: 875 http://instantobjects.svn.sourceforge.net/instantobjects/revision/?rev=875&view=rev Author: davidvtaylor Date: 2009-10-12 20:19:53 +0000 (Mon, 12 Oct 2009) Log Message: ----------- * Modified AnyDAC broker to include additional units implicitly required by TADQuery. These units were previously not automatically added to a minimal InstantObjects application containing only a TADConnection and TInstantAnyDACConnector. The absence of these units resulted in runtime exceptions due to missing class factories in AnyDAC uADStanAsync and uADDAptManager units. Modified Paths: -------------- trunk/Source/Brokers/AnyDAC/InstantAnyDAC.pas Modified: trunk/Source/Brokers/AnyDAC/InstantAnyDAC.pas =================================================================== --- trunk/Source/Brokers/AnyDAC/InstantAnyDAC.pas 2009-10-11 05:56:00 UTC (rev 874) +++ trunk/Source/Brokers/AnyDAC/InstantAnyDAC.pas 2009-10-12 20:19:53 UTC (rev 875) @@ -50,7 +50,8 @@ uses Classes, Db, InstantPersistence, InstantCommand, InstantDBBuild, InstantBrokers, InstantMetadata, InstantTypes, uADCompClient, - uADStanOption, uADStanParam, uADStanIntf, uADStanConst + uADStanOption, uADStanParam, uADStanIntf, uADStanConst, + uADDAptIntf, uADStanAsync, uADDAptManager, uADCompDataSet {$IFDEF D10+}, DBCommonTypes{$ENDIF}; type |
From: <dav...@us...> - 2010-01-29 04:36:41
|
Revision: 894 http://instantobjects.svn.sourceforge.net/instantobjects/revision/?rev=894&view=rev Author: davidvtaylor Date: 2010-01-29 04:36:35 +0000 (Fri, 29 Jan 2010) Log Message: ----------- * Implement workaround for AnyDAC/MSSQL issue for blobs exceeding 8000 bytes Modified Paths: -------------- trunk/Source/Brokers/AnyDAC/InstantAnyDAC.pas Modified: trunk/Source/Brokers/AnyDAC/InstantAnyDAC.pas =================================================================== --- trunk/Source/Brokers/AnyDAC/InstantAnyDAC.pas 2010-01-29 04:24:56 UTC (rev 893) +++ trunk/Source/Brokers/AnyDAC/InstantAnyDAC.pas 2010-01-29 04:36:35 UTC (rev 894) @@ -681,24 +681,43 @@ SourceParam : TParam; TargetParam : TADParam; i : Integer; + Params : TADParams; begin // Don't call inherited + Params := (DataSet as TADQuery).Params; for i := 0 to Pred(AParams.Count) do begin SourceParam := AParams[i]; - TargetParam := (DataSet as TADQuery).Params.FindParam(SourceParam.Name); + TargetParam := Params.FindParam(SourceParam.Name); if assigned(TargetParam) then AssignParam(SourceParam, TargetParam); end; end; procedure TInstantAnyDACBroker.AssignParam(SourceParam: TParam; TargetParam: TADParam); + +{$IFDEF D12+} +function ConvertBlobData(const Bytes: TBytes): RawByteString; + begin + SetLength(Result, Length(Bytes)); + if length(Result) > 0 then + Move(Bytes[0], Result[1], Length(Bytes)) + end; +{$ENDIF} + begin case SourceParam.DataType of ftBoolean: if UseBooleanFields then TargetParam.Assign(SourceParam) else TargetParam.AsInteger := ord(SourceParam.AsBoolean); + ftBlob: + // Temporary workaround for AnyDAC blob issue with MSSQL + {$IFDEF D12+} + TargetParam.AsBlob := ConvertBlobData(SourceParam.AsBlob); + {$ELSE} + TargetParam.AsBlob := SourceParam.AsBlob; + {$ENDIF} else TargetParam.Assign(SourceParam); end; |
From: <dav...@us...> - 2010-02-02 23:06:37
|
Revision: 896 http://instantobjects.svn.sourceforge.net/instantobjects/revision/?rev=896&view=rev Author: davidvtaylor Date: 2010-02-02 23:06:30 +0000 (Tue, 02 Feb 2010) Log Message: ----------- * Fix for "Variant or safe array index out of bounds" error in AnyDAC broker. The root cause is the same as QC 46644 - DynArrayFromVariant() fails for empty arrays. Modified Paths: -------------- trunk/Source/Brokers/AnyDAC/InstantAnyDAC.pas Modified: trunk/Source/Brokers/AnyDAC/InstantAnyDAC.pas =================================================================== --- trunk/Source/Brokers/AnyDAC/InstantAnyDAC.pas 2010-01-29 18:28:03 UTC (rev 895) +++ trunk/Source/Brokers/AnyDAC/InstantAnyDAC.pas 2010-02-02 23:06:30 UTC (rev 896) @@ -52,7 +52,7 @@ InstantBrokers, InstantMetadata, InstantTypes, uADCompClient, uADStanOption, uADStanParam, uADStanIntf, uADStanConst, uADDAptIntf, uADStanAsync, uADDAptManager, uADCompDataSet - {$IFDEF D10+}, DBCommonTypes{$ENDIF}; + {$IFDEF D10+}, Variants, DBCommonTypes{$ENDIF}; type TInstantAnyDACConnectionDef = class(TInstantRelationalConnectionDef) @@ -714,7 +714,9 @@ ftBlob: // Temporary workaround for AnyDAC blob issue with MSSQL {$IFDEF D12+} - TargetParam.AsBlob := ConvertBlobData(SourceParam.AsBlob); + if (VarArrayHighBound(SourceParam.Value,1) <> -1) then + TargetParam.AsBlob := ConvertBlobData(SourceParam.AsBlob) else + TargetParam.AsBlob := ''; {$ELSE} TargetParam.AsBlob := SourceParam.AsBlob; {$ENDIF} |
From: <dav...@us...> - 2011-09-28 13:51:24
|
Revision: 949 http://instantobjects.svn.sourceforge.net/instantobjects/revision/?rev=949&view=rev Author: davidvtaylor Date: 2011-09-28 13:51:18 +0000 (Wed, 28 Sep 2011) Log Message: ----------- + Add a MSSQL 2005 protocol to the AnyDAC broker. The new protocol uses VARCHAR(MAX) and VARBINARY(MAX) for Memo and Blob fields respectively * Revise GetSQLDelimiters to accommodate changes in AnyDAC Modified Paths: -------------- trunk/Source/Brokers/AnyDAC/InstantAnyDAC.pas Modified: trunk/Source/Brokers/AnyDAC/InstantAnyDAC.pas =================================================================== --- trunk/Source/Brokers/AnyDAC/InstantAnyDAC.pas 2011-09-28 13:47:46 UTC (rev 948) +++ trunk/Source/Brokers/AnyDAC/InstantAnyDAC.pas 2011-09-28 13:51:18 UTC (rev 949) @@ -20,7 +20,7 @@ * * The Initial Developer of the Original Code is: David Taylor * - * Portions created by the Initial Developer are Copyright (C) 2009 + * Portions created by the Initial Developer are Copyright (C) 2009-2011 * the Initial Developer. All Rights Reserved. * * Contributor(s): @@ -50,7 +50,7 @@ uses Classes, Db, InstantPersistence, InstantCommand, InstantDBBuild, InstantBrokers, InstantMetadata, InstantTypes, uADCompClient, - uADStanOption, uADStanParam, uADStanIntf, uADStanConst, + uADStanOption, uADStanParam, uADStanIntf, uADStanConst, uADPhysIntf, uADDAptIntf, uADStanAsync, uADDAptManager, uADCompDataSet {$IFDEF D10+}, Variants, DBCommonTypes{$ENDIF}; @@ -199,6 +199,11 @@ function InternalDataTypeToColumnType(DataType: TInstantDataType): string; override; function UseBooleanFields: Boolean; override; end; + + TInstantAnyDACMSSQL2005Broker = class(TInstantAnyDACMSSQLBroker) + protected + function InternalDataTypeToColumnType(DataType: TInstantDataType): string; override; + end; {$ENDIF} { Interbase and Firebird brokers } @@ -316,6 +321,9 @@ STmpTableSuffix = '_IOTmp_'; {$ENDIF} +{$IFDEF MSSQL_SUPPORT} + S_AD_MSSQL2005Id = S_AD_MSSQLId + ' 2005'; +{$ENDIF} procedure AssignAnyDACProtocols(Strings: TStrings); begin @@ -329,6 +337,7 @@ {$IFDEF MSSQL_SUPPORT} Strings.Add(S_AD_MSSQLId); + Strings.Add(S_AD_MSSQL2005Id); {$ENDIF} {$IFDEF IBFB_SUPPORT} @@ -403,7 +412,12 @@ ADConnector.Connection := Connection; ADConnector.LoginPrompt := LoginPrompt; ADConnector.UseDelimitedIdents := UseDelimitedIdents; - Connection.DriverName := Protocol; + + // Use AnyDAC MSSQL driver name for MSSQL 2005 protocol + if (SameText(Protocol, S_AD_MSSQL2005Id)) then + Connection.DriverName := S_AD_MSSQLId else + Connection.DriverName := Protocol; + Connection.TxOptions.AutoCommit := false; Connection.TxOptions.Isolation := xiReadCommitted; Connection.Params.Values['User_Name'] := UserName; @@ -417,8 +431,6 @@ if (Port <= 0) then Connection.Params.Values['Server'] := HostName else Connection.Params.Values['Server'] := HostName + ', ' + IntToStr(Port) - - // Connection.Properties.Text := Properties; except Connection.Free; raise; @@ -479,6 +491,9 @@ {$IFDEF MSSQL_SUPPORT} if SameText(FConnection.DriverName, S_AD_MSSQLId) then Result := TInstantAnyDACMSSQLBroker.Create(Self); + + if SameText(FConnection.DriverName, S_AD_MSSQL2005Id) then + Result := TInstantAnyDACMSSQL2005Broker.Create(Self); {$ENDIF} {$IFDEF IBFB_SUPPORT} @@ -712,11 +727,8 @@ TargetParam.Assign(SourceParam) else TargetParam.AsInteger := ord(SourceParam.AsBoolean); ftBlob: - // Temporary workaround for AnyDAC blob issue with MSSQL {$IFDEF D12+} - if (VarArrayHighBound(SourceParam.Value,1) <> -1) then - TargetParam.AsBlob := ConvertBlobData(SourceParam.AsBlob) else - TargetParam.AsBlob := ''; + TargetParam.AsBlob := ConvertBlobData(SourceParam.AsBlob); {$ELSE} TargetParam.AsBlob := SourceParam.AsBlob; {$ENDIF} @@ -832,21 +844,23 @@ end; function TInstantAnyDACBroker.GetSQLDelimiters: string; +var + LeftCh : char; + RightCh : char; begin if not Connector.UseDelimitedIdents then Result := '' else begin with Connector.Connection do - begin - if (ConnectionMetaDataIntf.NameQuotaChar1 <> #0) and - (ConnectionMetaDataIntf.NameQuotaChar1 <> ' ') then - Result := ConnectionMetaDataIntf.NameQuotaChar1 else - Result := ''; - if (ConnectionMetaDataIntf.NameQuotaChar2 <> #0) and - (ConnectionMetaDataIntf.NameQuotaChar2 <> ' ') then - Result := Result + ConnectionMetaDataIntf.NameQuotaChar2; - end; + begin + LeftCh := ConnectionMetaDataIntf.NameQuoteChar[ncDefault, nsLeft]; + RightCh := ConnectionMetaDataIntf.NameQuoteChar[ncDefault, nsRight]; + end; + + if (LeftCh = #0) or (RightCh = #0) or (LeftCh = ' ') or (RightCh = ' ') then + Result := '' else + Result := LeftCh + RightCh; end; end; @@ -960,6 +974,25 @@ begin Result := True; end; + +function TInstantAnyDACMSSQL2005Broker.InternalDataTypeToColumnType( + DataType: TInstantDataType): string; +const + Types: array[TInstantDataType] of string = ( + 'INTEGER', + 'FLOAT', + 'MONEY', + 'BIT', + 'VARCHAR', + 'VARBINARY(MAX)', + 'DATETIME', + 'VARCHAR(MAX)', + 'DATETIME', + 'DATETIME', + 'INTEGER'); +begin + Result := Types[DataType]; +end; {$ENDIF} { TInstantAnyDACIbFbBroker } |