Top

Name

DAV_COPY , DAV_MOVE , DAV_PROP_SET , DAV_PROP_REMOVE — Functions for manipulating an existing DAV collection or resource

Synopsis

integer DAV_COPY ( in path varchar ,
  in destination varchar ,
  in overwrite integer ,
  in permissions varchar ,
  in uname varchar ,
  in gname varchar ,
  in auth_uname varchar ,
  in auth_pwd varchar );
 
varchar DAV_MOVE ( in path varchar ,
  in destination varchar ,
  in overwrite integer ,
  in auth_uname varchar ,
  in auth_pwd varchar );
 
integer DAV_PROP_SET ( in path varchar ,
  in propname varchar ,
  in propvalue any ,
  in auth_uname varchar ,
  in auth_pwd varchar );
 
varchar DAV_PROP_REMOVE ( in path varchar ,
  in propname varchar ,
  in silent integer ,
  in auth_uname varchar ,
  in auth_pwd varchar );
 

Description

DAV_COPY copies the resource or collection taken from path to the destination. returns COL_ID or RES_ID on success.

DAV_MOVE moves the collection or resource to the destination path returns 1 on success.

DAV_PROP_SET defines or updates the property with name propname with propvalue . Returns PROP_ID on success.

DAV_PROP_GET returns the value of previously defined property with name propname .

DAV_PROP_REMOVE removal of the existing property on target path. If silent supplied then no error will be returned.

Some attributes of resources and collections are accessible as predefined properties. E.g., owner user ID of the resource can be retrieved or changed by DAV_PROP_GET or DAV_PROP_SET with propname equal to ':virtowneruid'. Some of these properties are read-only for all resources, some are writable for some but not for all resources. Names of all predefined properties starts with ':' so application-specific properties should not start with colon. Moreover, it is strongly suggested to use "unqualified XML names" as property names, otherwise PROPGET and PROPPATH DAV requests may return invalid XML responses. propname .

Parameters

path

Directory and name of source to be operated on.

destination

Directory and name of destination.

overwrite

If non zero then overwrite is enabled. Default is 0.

permissions

Access permission of Dav collection or resource. Defaults to '110100000R' if not supplied.

propname

Property name.

propvalue

Property value.

silent

If specified as non zero, then no error will be returned. Default is 0, so errors are returned.

uname

User identifier. Default is 'dav'.

gname

Group identifier. Default is 'dav'.

auth_uname

Administration user capable of performing the operation. Default is null.

auth_pwd

Password of Administrator. Default is null.

System Properties

Names of 'standard live properties' matches tag names used in PROPFIND response for same purposes.

Names of virtuoso-specific system properties starts with ':virt' substring.

In the table below, 'Read/Write' access type means that the application can try to set the property. This does not mean that the property can be successfully changed for any particular resource or collection.

Table 24.19. System properties supported by DAV_PROP_GET and DAV_PROP_SET functions

propname Access Type Data Type Description
:getlastmodified Read/Write datetime Time of the last modification.
:creationdate Read/Write datetime Time of creation.
:lastaccessed Read Only datetime Time of the last access to the resource, may be inaccurate by a large amount.
:getetag Read Only varchar The value of 'Etag' field of response header as reported by HEAD HTTP request.
:getcontenttype Read/Write varchar MIME type of the resource ('dav/unix-directory' for collections).
:getcontentlength Read Only integer Resource length in bytes. 0 for collections.
:resourcetype Read Only XML entity '<D:collection/>' for collections, NULL for resources.
:virtowneruid Read/Write integer User ID of resource owner user.
:virtownergid Read/Write integer Group ID of resource owner group.
:virtpermissions Read/Write char(10) Access permissions string.
:virtacl Read/Write long varbinary Access Control List.
:virtdet Read/Write varchar DAV Extension Type of special collection, NULL for plain collections and resources.

Note that the value of 'Etag' field depends on ':getlastmodified' value. Some HTTP clients, such as download managers, web indexing robots and proxy servers, use 'Etag' field to support caching and/or partial document transfer. It is unsafe to decrement ':getlastmodified' because it can confuse such clients.

Only resource/collection owner or DAV administrator can change ':virtowneruid', ':virtownergid', ':virtpermissions' and ':virtacl'.

Only DAV administrator can change ':virtdet' property.

Errors

Table 24.20. Errors signalled by DAV_* functions

Error Code Description
>=0 success
-1 The path (target of operation) is not valid
-2 The destination (path) is not valid
-3 Overwrite flag is not set and destination exists
-4 The target is resource, but source is collection (in copy move operations)
-5 Permissions are not valid
-6 uid is not valid
-7 gid is not valid
-8 Target is locked
-9 Destination is locked
-10 Property name is reserved (protected or private)
-11 Property does not exists
-12 Authentication failed
-13 Operation is forbidden (the authenticated user do not have a permissions for the action)
-14 the target type is not valid
-15 The umask is not valid
-16 The property already exists
-17 Invalid property value
-18 no such user
-19 no home directory

Examples

Example 24.77. Copy and move operations

Renaming of the resource and copy the folder. After executing the commands in the http://[host:port]/DAV/user/B/ we will show the resource B.txt

-- initial upload
SQL> select DB.DBA.DAV_COL_CREATE ('/DAV/user/','110100000R', 'dav','dav','dav','dav');
SQL> select DB.DBA.DAV_COL_CREATE ('/DAV/user/A/','110100000R','dav','dav','dav','dav');
SQL> select DB.DBA.DAV_RES_UPLOAD ('/DAV/user/A/A.txt','this is a test','text/plain','110100000R','dav','dav','dav','dav');
SQL> DB.DBA.DAV_MOVE('/DAV/user/A/A.txt', '/DAV/user/A/B.txt', 1,'dav','dav');
SQL> DB.DBA.DAV_COPY('/DAV/user/A/', '/DAV/user/B/', 1, '110110000R','dav','dav','dav','dav');