Dear all,

I cannot find a way to tell the xquey engine that a function parameter of my 
high-order function is updating :

declare %updating function etebac:build-updating($file as xs:string, $builder 
as %updating function(*) ) {
  for tumbling window $line in (file:read-text-lines($file))
  start $start-item when etebac:record-header($start-item) = '01'
  end $end-item when etebac:record-header($end-item) = '07'
  let $doc := etebac:build-json($line)
  let $start := format-date(xs:date($doc/date-ancien-solde), 
'[Y0001][M01][D01]')
  let $stop := format-date(xs:date($doc/date), '[Y0001][M01][D01]')
  let $doc-id := string-join(($doc/rib, $start, $stop), '-')
  let $doc-path := string-join(
    ($doc/(banque, guichet, compte), $start || '-' || $stop), '/')
  let $out-file := concat($doc-path, '.json')
  where count($doc/operations/_) > 0
  return
    $builder(
      $doc-path,
      element json {
        attribute type { 'object' },
        element meta {
          attribute type { 'object' },
          element type { 'releve-operations' },
          element id { $doc-id }
        },
        element data {
          $doc/(*|@*)
        }
      }
   )
};

I have a [XPTY0004] Function must not be updating: %updating 
function($path,$doc) a... error.

The outer call is  :

import module namespace etebac = 'http://pch.cerfrance.fr/basex/modules/etebac' 
at 'etebac.xqm';

etebac:build-updating('D:\edi\banque\input\10278\10278_CMLACO_20160701.183',
    db:replace('test', ?, ?)
)

What have I to do to tag my $builder function reference as updating in the main 
body ?

Best regards from the snowy french atlantic coast,
Fabrice

Reply via email to