Skip to content
This repository has been archived by the owner on Nov 9, 2022. It is now read-only.

Commit

Permalink
#193 fixed implementation so that it reports the use of an unsupporte…
Browse files Browse the repository at this point in the history
…d feature on MarkLogic < 7.0-1
  • Loading branch information
dmcassel committed Apr 17, 2014
1 parent e008f55 commit eb59ad0
Showing 1 changed file with 26 additions and 8 deletions.
34 changes: 26 additions & 8 deletions deploy/lib/xquery/setup.xqy
Original file line number Diff line number Diff line change
Expand Up @@ -1334,15 +1334,33 @@ declare function setup:add-fields-R(
return
setup:add-fields-R(
if ($field/db:field-path) then
admin:database-add-field(
$admin-config,
$database,
admin:database-path-field(
$field/db:field-name,
for $path in $field/db:field-path
return
admin:database-field-path($path/db:path, ($path/weight, 1.0)[1]))
if (setup:at-least-version("7.0-1")) then
xdmp:eval(
'import module namespace admin = "http://marklogic.com/xdmp/admin" at "/MarkLogic/admin.xqy";
declare namespace db = "http://marklogic.com/xdmp/database";
declare variable $admin-config external;
declare variable $database external;
declare variable $field external;
admin:database-add-field(
$admin-config,
$database,
admin:database-path-field(
$field/db:field-name,
for $path in $field/db:field-path
return
admin:database-field-path($path/db:path, ($path/weight, 1.0)[1]))
)',
(xs:QName("admin-config"), $admin-config,
xs:QName("database"), $database,
xs:QName("field"), $field),
<options xmlns="xdmp:eval">
<isolation>same-statement</isolation>
</options>
)
else
fn:error(
xs:QName("VERSION_NOT_SUPPORTED"),
fn:concat("MarkLogic ", xdmp:version(), " does not support path-based fields. Use 7.0-1 or higher."))
else
admin:database-add-field(
$admin-config,
Expand Down

0 comments on commit eb59ad0

Please sign in to comment.