@@ -538,7 +538,7 @@ class _ByteVectorCondition<EntityT>
538
538
func) =>
539
539
withNativeBytes (
540
540
_value,
541
- (Pointer <Uint8 > ptr, int size) =>
541
+ (Pointer <Uint8 > ptr, int size) =>
542
542
func (builder._cBuilder, _property._model.id.id, ptr, size));
543
543
544
544
@override
@@ -652,7 +652,11 @@ class Query<T> {
652
652
/// the whole result, e.g. for "result paging".
653
653
///
654
654
/// Set offset=0 to reset to the default - starting from the first element.
655
- set offset (int offset) => checkObx (C .query_offset (_ptr, offset));
655
+ set offset (int offset) {
656
+ final result = checkObx (C .query_offset (_ptr, offset));
657
+ reachabilityFence (this );
658
+ return result;
659
+ }
656
660
657
661
/// Configure a [limit] for this query.
658
662
///
@@ -661,13 +665,18 @@ class Query<T> {
661
665
/// the whole result, e.g. for "result paging".
662
666
///
663
667
/// Set limit=0 to reset to the default behavior - no limit applied.
664
- set limit (int limit) => checkObx (C .query_limit (_ptr, limit));
668
+ set limit (int limit) {
669
+ final result = checkObx (C .query_limit (_ptr, limit));
670
+ reachabilityFence (this );
671
+ return result;
672
+ }
665
673
666
674
/// Returns the number of matching Objects.
667
675
int count () {
668
676
final ptr = malloc <Uint64 >();
669
677
try {
670
678
checkObx (C .query_count (_ptr, ptr));
679
+ reachabilityFence (this );
671
680
return ptr.value;
672
681
} finally {
673
682
malloc.free (ptr);
@@ -710,12 +719,14 @@ class Query<T> {
710
719
_store.runInTransaction (TxMode .read, () {
711
720
checkObx (C .query_visit (_ptr, visitor, nullptr));
712
721
});
722
+ reachabilityFence (this );
713
723
return result;
714
724
}
715
725
716
726
/// Finds Objects matching the query and returns their IDs.
717
727
List <int > findIds () {
718
728
final idArrayPtr = checkObxPtr (C .query_find_ids (_ptr), 'find ids' );
729
+ reachabilityFence (this );
719
730
try {
720
731
final idArray = idArrayPtr.ref;
721
732
return idArray.count == 0
@@ -732,6 +743,7 @@ class Query<T> {
732
743
final collector = objectCollector (result, _store, _entity);
733
744
_store.runInTransaction (
734
745
TxMode .read, () => checkObx (C .query_visit (_ptr, collector, nullptr)));
746
+ reachabilityFence (this );
735
747
return result;
736
748
}
737
749
@@ -754,6 +766,7 @@ class Query<T> {
754
766
closed = true ;
755
767
C .dartc_stream_close (cStream);
756
768
port.close ();
769
+ reachabilityFence (this );
757
770
};
758
771
759
772
try {
@@ -838,10 +851,18 @@ class Query<T> {
838
851
// }
839
852
840
853
/// For internal testing purposes.
841
- String describe () => dartStringFromC (C .query_describe (_ptr));
854
+ String describe () {
855
+ final result = dartStringFromC (C .query_describe (_ptr));
856
+ reachabilityFence (this );
857
+ return result;
858
+ }
842
859
843
860
/// For internal testing purposes.
844
- String describeParameters () => dartStringFromC (C .query_describe_params (_ptr));
861
+ String describeParameters () {
862
+ final result = dartStringFromC (C .query_describe_params (_ptr));
863
+ reachabilityFence (this );
864
+ return result;
865
+ }
845
866
846
867
/// Use the same query conditions but only return a single property (field).
847
868
///
@@ -852,7 +873,9 @@ class Query<T> {
852
873
/// var results = query.property(tInteger).find();
853
874
/// ```
854
875
PropertyQuery <DartType > property <DartType >(QueryProperty <T , DartType > prop) {
855
- final result = PropertyQuery <DartType >._(_ptr, prop._model);
876
+ final result = PropertyQuery <DartType >._(
877
+ C .query_prop (_ptr, prop._model.id.id), prop._model.type);
878
+ reachabilityFence (this );
856
879
if (prop._model.type == OBXPropertyType .String ) {
857
880
result._caseSensitive = InternalStoreAccess .queryCS (_store);
858
881
}
0 commit comments