Changes

Jump to navigation Jump to search
No change in size ,  16:05, 19 July 2022
|}
==db:put-valuebinary==
{{Announce|Introduced Updated with Version 10.}}: renamed (before: {{Code|db:put}}); function signature aligned with {{Function||db:add}} (second and third argument swapped).
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|db:put-valuebinary|$db as xs:string, $input as item()*, $path as xs:string|empty-sequence()}}
|-
| '''Summary'''
|Stores a value binary resource specified by {{Code|$input}} in the database {{Code|$db}} and the location specified by {{Code|$path}}. Existing resources are overwritten. The value can be an arbitrary sequence of atomic items, nodes, maps, and arrays.
|-
| '''Errors'''
| '''Examples'''
|
* {{Code|db:put-valuebinary('DB', 1 to 10000file:read-binary('video.mov'), 'sequencevideo/sample.mov')}} stores a numeric range in the databaseaddressed video file at the specified location.* With the following query, a map with countries and associated cities is stored in a you can copy the binary resources of one database. The value resource can e.g. be used as index in future queriesinto another:
<syntaxhighlight lang="xquery">
let $db:put= 'db'let $src-value( path := 'factbooksrc/', maplet $trg-path :merge(= 'trg/' for $country src in db:openlist($db, $src-path)where db:type($db, $src) = 'factbookbinary'let $trg := $trg-path || substring-after($src, $src-path)//country return mapdb:entryput-binary($country/@namedb, db:get-binary($db, $country//city/name ! string(src), $trg) ), 'cities')</syntaxhighlight>
|}
==db:put-binaryvalue==
{{Announce|Updated Introduced with Version 10.}}: renamed (before: {{Code|db:put}}); function signature aligned with {{Function||db:add}} (second and third argument swapped).
{| width='100%'
|-
| width='120' | '''Signatures'''
|{{Func|db:put-binaryvalue|$db as xs:string, $input as item()*, $path as xs:string|empty-sequence()}}
|-
| '''Summary'''
|Stores a binary value resource specified by {{Code|$input}} in the database {{Code|$db}} and the location specified by {{Code|$path}}. Existing resources are overwritten. The value can be an arbitrary sequence of atomic items, nodes, maps, and arrays.
|-
| '''Errors'''
| '''Examples'''
|
* {{Code|db:put-binaryvalue('DB', file:read-binary('video.mov')1 to 10000, 'video/sample.movsequence')}} stores a numeric range in the addressed video file at the specified locationdatabase.* With the following query, you a map with countries and associated cities is stored in a database. The value resource can copy the binary resources of one database into anothere.g. be used as index in future queries:
<syntaxhighlight lang="xquery">
let $db := 'db'put-value(let $src-path := 'src/factbook',let $trg-path map:= 'trg/'merge( for $src country in db:listopen($db, $src-path'factbook')//countrywhere db return map:typeentry($dbcountry/@name, $srccountry//city/name ! string() = 'binary'let $trg := $trg-path || substring-after($src, $src-path)return db:put-binary($db, db:get-binary($db, $src ), $trg 'cities')</syntaxhighlight>
|}
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu