Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I came across the same trouble and hacked the source code a bit. Here's what i cooked then:</p> <pre><code>procedure TBSONDocument.ReadStream(F: TStream); var len : Integer; elmtype : Byte; elmname : string; begin Clear; F.Read(len, SizeOf(len)); F.Read(elmtype, SizeOf(Byte) ); while elmtype &lt;&gt; BSON_EOF do begin elmname := _ReadString(F); SetLength(FItems, Length(FItems)+1); case elmtype of BSON_FLOAT: FItems[High(FItems)] := TBSONDoubleItem.Create; BSON_STRING: FItems[High(FItems )] := TBSONStringItem.Create; BSON_DOC: FItems[High(FItems )] := TBSONDocumentItem.Create; // Mrsky BSON_ARRAY: FItems[High(FItems)] := TBSONArrayItem.Create; BSON_BINARY: FItems[High(FItems)] := TBSONBinaryItem.Create; BSON_OBJECTID: FItems[High(FItems )] := TBSONObjectIDItem.Create; BSON_BOOLEAN: FItems[High(FItems )] := TBSONBooleanItem.Create; BSON_DATETIME: FItems[High(FItems)] := TBSONDatetimeItem.Create(0); // Mrsky BSON_REGEX: FItems[High(FItems)] := TBSONRegExItem.Create; BSON_DBPTR: FItems[High(FItems)] := TBSONDBRefItem.Create; BSON_JS: FItems[High(FItems )] := TBSONJSItem.Create; BSON_SYMBOL: FItems[High(FItems)] := TBSONSymbolItem.Create; BSON_JSSCOPE: FItems[High(FItems )] := TBSONScopedJSItem.Create; BSON_INT32: FItems[High(FItems )] := TBSONIntItem.Create; BSON_INT64: FItems[High(FItems )] := TBSONInt64Item.Create; BSON_MINKEY: FItems[High(FItems)] := TBSONItem.Create(BSON_MINKEY); BSON_MAXKEY: FItems[High(FItems)] := TBSONItem.Create(BSON_MAXKEY); else raise EBSONException.Create('Unimplemented element handler '+IntToStr(elmtype)); end; with FItems[High(FItems)] do begin elname := elmname; ReadStream(f); end; f.Read(elmtype, SizeOf(Byte)); end; end; </code></pre> <p>I didn't appreciate the way "Free" method was implemented and remove all of them and introduced new "Destroy" destructor method accordingly where it fit.</p> <p>I hope it will be of some help for you.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload