# 22. Virtuoso Functions Guide - DAV manipulation functions

Chapter Contents | Prev | Next
Keyword Search:
www.openlinksw.com
docs.openlinksw.com
Book Home
Contents
Preface
Virtuoso Functions Guide
Administration
Aggregate Functions
Array Manipulation
BPEL APIs
Backup
Compression
Cursor
Date & Time Manipulation
Debug
Dictionary Manipulation
Encoding & Decoding
File Manipulation
Free Text
Hashing / Cryptographic
LDAP
Locale
Mail
Miscellaneous
Number
Remote SQL Data Source
Replication
SOAP
SQL
String
Transaction
Type Mapping
UDDI
User Defined Types & The CLR
Virtuoso Java PL API
Virtuoso Server Extension Interface (VSEI)
Web Server & Internet
dav add & update fun...
dav manipulation fun...
dav search functions
dav_exp
lfs_exp
serv_queue_top
vhost_define
vhost_remove
webdav users & group...
client_attr
connection_get
connection_id
connection_is_dirty
connection_set
connection_vars
connection_vars_set
dbname
ftp_get
ftp_ls
ftp_put
get_certificate_info
get_keyword
get_keyword_ucase
http
http_acl_get
http_body_read
http_client
http_client_ip
http_debug_log
http_enable_gz
http_file
http_flush
http_get
http_header
http_header_get
http_kill
http_listen_host
http_map_get
http_map_table
http_param
http_path
http_pending_req
http_physical_path
http_proxy
http_request_get
http_request_header
http_request_status
http_rewrite
http_root
http_url
http_value
http_xslt
ses_connect
ses_disconnect
ses_read_line
ses_write
tcpip_gethostbyaddr
tcpip_gethostbyname
vsp_calculate_digest
wsdl_import_udt
XML
XPATH & XQUERY
Functions Index

## DAV manipulation functions

Functions for manipulating an existing DAV collection or resource
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);
varchar DAV_PROP_REMOVE (in path varchar, in propname varchar, in silent 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);
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 propeties' 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.

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 responce 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

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
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');

See Also

DAV content add/update/delete functions

DAV lock manipulation functions

DAV search functions

DAV user management functions