internal package
Foswiki::Contrib::DBCacheContrib::Array This is an interface that is implemented by all back-end stores (archivists). Objects of this class can be tied to perl arrays.
Objects of this class are created using thenewArray
interface defined
by Foswiki::Contrib::DBCacheContrib::Archivist
. You can use references
in the content of an Array, but you can only refer to other objects that
were created using the same Archivist. If you point anywhere else, expect
fireworks. Note that all references stored in an Array are strong references
(see the doc on Foswiki::Contrib::DBCacheContrib::Map for more information
on what that means).
If you have an object ($obj) created this way, you can tie it to a perl array
like this:
my @array; tie(@array, ref($obj), $obj);
find($object)
-> integer equals
to find the given element in the array and return its index
getValues() -> @values
add($object)
$object
any perl data type
remove($index)
$index
- integer index
get($key, $root)
-> datum $k
- key
get("9", $r)
where $n is a number will get the 9th entry in the array
get("[9]", $r)
will also get the 9th entry
get(".9", $r)
will also get the 9th entry
get(".X", $r)
will return the sum of the subfield X
of each entry
get("[?search]", $r)
will perform the given search over the entries in the array. Always returns an array result, even when there is only one result. For example: [?name='Sam']
will return an array of all the entries that have their subfield name
set to Sam
.
#
means "reset to root". So get("#[3]", $r)
will return the 4th entry of $r (assuming $r is an array!).
get("[*X]", $r)
will get a new array made from subfield X of each entry in this array.
get("parent.UserTable[?SubTopic='ThisTopic'].UserName", $web);See also
Foswiki::Contrib::DBCacheContrib::Map
for syntax that applies to maps.
size()
-> integer sum($field)
-> number $field
- name of a field in the class of objects stored by this array
search($search)
-> search result $search
- Foswiki::Contrib::DBCacheContrib::Search object to use in the search
Foswiki::Contrib::DBCacheContrib::Array
of matching entries.
toString($limit, $level, $strung)
-> string $limit
- recursion limit for expansion of elements
$level
- currentl recursion level