From bd5b7989428b87b0afbbe6ccc9044537411c75db Mon Sep 17 00:00:00 2001 From: Sascha Matzke Date: Fri, 4 Jun 2010 19:00:42 +0200 Subject: [PATCH] fix doc typo and example error --- extra/bson/reader/reader.factor | 11 +++++------ extra/mongodb/mongodb-docs.factor | 2 +- extra/mongodb/operations/operations.factor | 2 +- extra/mongodb/tuple/persistent/persistent.factor | 2 +- extra/mongodb/tuple/tuple.factor | 2 +- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/extra/bson/reader/reader.factor b/extra/bson/reader/reader.factor index 39cd5a9c93..e0cf0bc4f4 100644 --- a/extra/bson/reader/reader.factor +++ b/extra/bson/reader/reader.factor @@ -1,7 +1,7 @@ ! Copyright (C) 2010 Sascha Matzke. ! See http://factorcode.org/license.txt for BSD license. USING: accessors assocs bson.constants calendar combinators -combinators.short-circuit io io.binary kernel math +combinators.short-circuit io io.binary kernel math locals namespaces sequences serialize strings vectors byte-arrays ; FROM: io.encodings.binary => binary ; @@ -68,8 +68,7 @@ TYPED: peek-scope ( state: state -- ht ) : bson-object-data-read ( -- object ) read-int32 drop get-state - [ exemplar>> clone ] [ scope>> ] bi - [ push ] keep ; inline + [ exemplar>> clone dup ] [ scope>> ] bi push ; inline : bson-binary-read ( -- binary ) read-int32 read-byte @@ -136,9 +135,9 @@ TYPED: (prepare-result) ( scope: vector element: element -- result ) TYPED: (prepare-object) ( type: integer -- object ) [ element-data-read ] [ end-element ] bi ; inline -TYPED: (read-object) ( type: integer name: string state: state -- ) - [ (prepare-object) ] 2dip - peek-scope set-at ; inline +:: (read-object) ( type name state -- ) + state peek-scope :> scope + type (prepare-object) name scope set-at ; inline TYPED: bson-not-eoo-element-read ( type: integer -- cont?: boolean ) read-cstring get-state diff --git a/extra/mongodb/mongodb-docs.factor b/extra/mongodb/mongodb-docs.factor index afdb2777fd..6bddc2f496 100644 --- a/extra/mongodb/mongodb-docs.factor +++ b/extra/mongodb/mongodb-docs.factor @@ -9,7 +9,7 @@ ARTICLE: "mongodb" "MongoDB factor integration" "USING: mongodb.driver ;" "\"db\" \"127.0.0.1\" 27017 " "[ \"mycollection\" [ H{ { \"name\" \"Alfred\" } { \"age\" 57 } } save ] " - " [ ageIdx [ \"age\" asc ] key-spec ensure-index ]" + " [ \"ageIdx\" [ \"age\" asc ] key-spec ensure-index ]" " [ H{ { \"age\" H{ { \"$gt\" 50 } } } } find-one ] tri ] with-db " "" } { $heading "Highlevel tuple integration" } diff --git a/extra/mongodb/operations/operations.factor b/extra/mongodb/operations/operations.factor index a95223929a..7d16b4c40a 100644 --- a/extra/mongodb/operations/operations.factor +++ b/extra/mongodb/operations/operations.factor @@ -52,7 +52,7 @@ SYMBOL: msg-bytes-read read-longlong >>cursor read-int32 >>start# read-int32 [ >>returned# ] keep - [ H{ } stream>assoc ] collector [ times ] dip >>objects ; + [ H{ } clone stream>assoc ] collector [ times ] dip >>objects ; : (read-message) ( message opcode -- message ) OP_Reply = diff --git a/extra/mongodb/tuple/persistent/persistent.factor b/extra/mongodb/tuple/persistent/persistent.factor index 625341a211..bc6a6c0f80 100644 --- a/extra/mongodb/tuple/persistent/persistent.factor +++ b/extra/mongodb/tuple/persistent/persistent.factor @@ -42,7 +42,7 @@ DEFER: assoc>tuple swap set-at ; inline : write-field? ( tuple key value -- ? ) - pick mdb-persistent? [ + pick mdb-persistent? [ { [ [ 2drop ] dip not ] [ drop transient-slot? ] } 3|| not ] [ 3drop t ] if ; inline diff --git a/extra/mongodb/tuple/tuple.factor b/extra/mongodb/tuple/tuple.factor index ce76a37ff4..df5a541f66 100644 --- a/extra/mongodb/tuple/tuple.factor +++ b/extra/mongodb/tuple/tuple.factor @@ -63,7 +63,7 @@ PRIVATE> [ tuple-collection name>> ] [ id-selector ] [ tuple>assoc ] tri - update ; + >upsert update ; : save-tuple ( tuple -- ) update-tuple ;