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
file_delete
file_dirlist
file_mkdir
file_mkpath
file_stat
file_to_string
file_to_string_outpu...
file_unlink
os_chmod
os_chown
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
XML
XPATH & XQUERY

Functions Index

os_chmod

changes the file access mode of a file
os_chmod (in path varchar, in new_mod integer);
Parameters
path – varchar relative path.
new_mod – integer new mode for the file.
Description

os_chmod set the file mode bits by calling the system function chmod() with the arguments supplied.

Not all the host OSes support all the file modes. That's why the function will not throw an SQL error if the function fails.

It will return DB NULL value when the function was called succsessfully and the error message as a string if it failed.

In most OSes the mode is a bitmask, so one would usually use the file_stat to get the current mode and bit_or/bit_xor to make the new mode.

Typical bit layout (from Linux 'man 2 chmod') is :

The DirsAllowed and DirsDenied lists in Parameters section of the virtuoso configuration file (virtuoso.ini by default) are used to control disk access.

Examples
Simple example

Make the virtuoso INI file readable by the others

SQL>select os_chmod (virtuoso_ini_path(), bit_or (cast (file_stat (virtuoso_ini_path(), 2) as integer), 4));
callret
VARCHAR
_______________________________________________________________________________

NULL
	    
See Also

file_delete

file_stat

os_chown

virtuoso_ini_path

bit_or

bit_xor