diff --git a/bsonTools.pas b/bsonTools.pas index 3785b71..6deaf73 100644 --- a/bsonTools.pas +++ b/bsonTools.pas @@ -51,7 +51,9 @@ TBSONDocArray=class(TJSONImplBaseObj, IJSONArray, IJSONDocArray, function Get_Item(Index: integer): Variant; stdcall; procedure Set_Item(Index: integer; const Value: Variant); stdcall; function Count: integer; stdcall; - function ToString: WideString; stdcall; + function JSONToString: WideString; stdcall; + function IJSONArray.ToString=JSONToString; + function IJSONDocArray.ToString=JSONToString; function v0(Index: integer): pointer; stdcall; property Item[Idx: integer]: Variant read Get_Item write Set_Item; default; //IJSONDocArray @@ -316,6 +318,8 @@ procedure LoadBSON(Data: TStream; const Doc: IJSONDocument); d0:=0; IsArray:=false; d:=Doc; + sl:=0; + ss:=''; while (ltotal-1) do begin i:=0; @@ -815,6 +819,8 @@ procedure SaveBSON(const Doc: IJSONDocument; Data: TStream); pp:pointer absolute o; bb:byte; begin + stackIndex:=0; + stackLength:=0; lstart:=Data.Position;//may not be 0! ltotal:=0; i:=0;//write now, fill in later @@ -1109,7 +1115,7 @@ procedure TBSONDocArray.Set_Item(Index: integer; const Value: Variant); FRef[Index]:=p; end; -function TBSONDocArray.ToString: WideString; +function TBSONDocArray.JSONToString: WideString; var i:integer; d:IJSONDocument; diff --git a/demo/example1/mwx1Main.pas b/demo/example1/mwx1Main.pas index ff3668a..b784382 100644 --- a/demo/example1/mwx1Main.pas +++ b/demo/example1/mwx1Main.pas @@ -64,7 +64,8 @@ procedure TMainForm.FormShow(Sender: TObject); begin try if ConnectionForm.ShowModal=mrOk then - FMongoWire.Open(ConnectionForm.txtHost.Text,StrToInt(ConnectionForm.txtPort.Text)) + FMongoWire.Open(AnsiString(ConnectionForm.txtHost.Text), + StrToInt(ConnectionForm.txtPort.Text)) else raise Exception.Create('User abort'); diff --git a/jsonDoc.pas b/jsonDoc.pas index 56bb7e1..27678fb 100644 --- a/jsonDoc.pas +++ b/jsonDoc.pas @@ -355,13 +355,15 @@ TJSONDocArray = class(TJSONImplBaseObj, IJSONArray, IJSONDocArray) function Get_Item(Index: integer): Variant; stdcall; procedure Set_Item(Index: integer; const Value: Variant); stdcall; function Count: integer; stdcall; - function ToString: WideString; stdcall; + function JSONToString: WideString; stdcall; + function IJSONArray.ToString=JSONToString; function v0(Index: integer): pointer; stdcall; //function IJSONArray.ToString=JSONToString; //IJSONDocArray function Add(const Doc: IJSONDocument): integer; stdcall; function AddJson(const Data: WideString): integer; stdcall; procedure LoadItem(Index: integer; const Doc: IJSONDocument); stdcall; + function IJSONDocArray.ToString=JSONToString; procedure Clear; stdcall; public constructor Create; @@ -2262,7 +2264,7 @@ procedure TJSONDocArray.LoadItem(Index: integer; const Doc: IJSONDocument); {$ENDIF} end; -function TJSONDocArray.ToString: WideString; +function TJSONDocArray.JSONToString: WideString; var i,x,l:integer; begin