|
From: <na...@us...> - 2010-09-11 16:51:06
|
Revision: 905
http://instantobjects.svn.sourceforge.net/instantobjects/revision/?rev=905&view=rev
Author: nandod
Date: 2010-09-11 16:51:00 +0000 (Sat, 11 Sep 2010)
Log Message:
-----------
* UseUnicode connector property. Enables unicode features not enabled by default in unicode versions of Delphi (D2009+), such as wide (unicode) memo fields. Tested only on D2009+.
* TInstantObject.DoAttributeChanged made virtual.
Modified Paths:
--------------
trunk/Source/Core/InstantBrokers.pas
trunk/Source/Core/InstantPersistence.pas
Modified: trunk/Source/Core/InstantBrokers.pas
===================================================================
--- trunk/Source/Core/InstantBrokers.pas 2010-09-11 16:47:56 UTC (rev 904)
+++ trunk/Source/Core/InstantBrokers.pas 2010-09-11 16:51:00 UTC (rev 905)
@@ -2899,6 +2899,19 @@
LParam.AsMemo := MemoAttrib.Value;
end;
+ procedure AddWideMemoAttributeParam;
+ var
+ LParam: TParam;
+ MemoAttrib: TInstantMemo;
+ begin
+ LParam := AddParam(Params, FieldName, ftWideMemo);
+ MemoAttrib := (Attribute as TInstantMemo);
+ if (MemoAttrib.Size = 0) or Attribute.IsNull then
+ LParam.Clear
+ else
+ LParam.Value := MemoAttrib.AsString;
+ end;
+
procedure AddPartAttributeParam;
var
Stream: TStream;
@@ -2988,6 +3001,9 @@
atInteger:
AddIntegerAttributeParam;
atMemo:
+ if Broker.Connector.UseUnicode then
+ AddWideMemoAttributeParam
+ else
AddMemoAttributeParam;
atPart:
AddPartAttributeParam;
Modified: trunk/Source/Core/InstantPersistence.pas
===================================================================
--- trunk/Source/Core/InstantPersistence.pas 2010-09-11 16:47:56 UTC (rev 904)
+++ trunk/Source/Core/InstantPersistence.pas 2010-09-11 16:51:00 UTC (rev 905)
@@ -792,7 +792,6 @@
procedure DoAfterRefresh;
procedure DoAfterRetrieve;
procedure DoAfterStore;
- procedure DoAttributeChanged(Attribute: TInstantAttribute);
procedure DoBeforeContentChange(Container: TInstantContainer;
ChangeType: TInstantContentChangeType; Index: Integer; AObject: TInstantObject);
procedure DoBeforeDispose;
@@ -848,6 +847,7 @@
property SavedState: TInstantObjectState read GetSavedState;
property State: TInstantObjectState read GetState;
protected
+ procedure DoAttributeChanged(Attribute: TInstantAttribute); virtual;
procedure Abandon;
procedure AfterAddRef; virtual;
procedure AfterAssign; virtual;
@@ -1412,6 +1412,7 @@
FOnGenerateId: TInstantGenerateIdEvent;
FIdSize: Integer;
FIdDataType: TInstantDataType;
+ FUseUnicode: Boolean;
procedure AbandonObjects;
procedure ApplyTransactedObjectStates;
procedure ClearTransactedObjects;
@@ -1497,6 +1498,8 @@
default False;
property UseTransactions: Boolean read FUseTransactions
write FUseTransactions default True;
+ property UseUnicode: Boolean read FUseUnicode write FUseUnicode
+ default False;
property BeforeBuildDatabase: TInstantSchemeEvent read FBeforeBuildDatabase
write FBeforeBuildDatabase;
property BlobStreamFormat: TInstantStreamFormat read FBlobStreamFormat
@@ -1515,6 +1518,7 @@
FBlobStreamFormat: TInstantStreamFormat;
FIdSize: Integer;
FIdDataType: TInstantDataType;
+ FUseUnicode: Boolean;
protected
function GetCaption: string; virtual;
procedure InitConnector(Connector: TInstantConnector); virtual;
@@ -1533,6 +1537,8 @@
default dtString;
property IdSize: Integer read FIdSize write FIdSize
default InstantDefaultFieldSize;
+ property UseUnicode: Boolean read FUseUnicode write FUseUnicode
+ default False;
end;
TInstantConnectionDefs = class(TInstantCollection)
@@ -8580,6 +8586,7 @@
begin
inherited;
FUseTransactions := True;
+ FUseUnicode := False;
FIdDataType := dtString;
FIdSize := InstantDefaultFieldSize;
end;
@@ -8986,6 +8993,7 @@
FBlobStreamFormat := sfBinary;
FIdDataType := dtString;
FIdSize := InstantDefaultFieldSize;
+ FUseUnicode := False;
end;
function TInstantConnectionDef.CreateConnector(AOwner: TComponent): TInstantConnector;
@@ -9019,6 +9027,7 @@
Connector.BlobStreamFormat := BlobStreamFormat;
Connector.IdDataType := IdDataType;
Connector.IdSize := IdSize;
+ Connector.UseUnicode := UseUnicode;
end;
{ TInstantConnectionDefs }
|