libraries

Top  Previous  Next

libraries

libs=new("libraries")

 

The libraries object provides access to the list of libraries that are known on a system.  Lists are returned in linefeed-delimited ($0A$) format, and each list row can be in one of two formats: just library path names, or all library details.  A template can be obtained that describes the library information that is returned, so it is possible to develop routines that parse a list and obtain specific library information.  A name-only template contains one field: pathname$.  A detail template contains the following fields, delimited by a tab ($09$) or other character, if specified:

 

basename$ - the base filename of the library path.
dirname$ - the directory portion of the library path.
path$ - the full library path.
category$ - the category, if any, of the library.
description$ - the library description
created$ - the library creation date, in yyyymmdd format
defperms$ - default permissions (r, w, and/or d) in semicolon-delimited format
forceseq - true (1) to force sequencers on sub IDs
inactive - true (1) if the library is inactive an no longer can be updated
count - the number of document records in the library

 

Methods

createlib(library$[,errmsg$]) - creates a new library, fills errmsg$ if an error occurs.  Admin permission required.

dellib(library$) - remove library from library list (not from disk).  Admin permissions required.

doccount(library$) returns the number of documents in a library.

exists(library$) returns true (1) if the library exists, false (0) otherwise.

getall$([detail[,delim$]) returns the names of all libraries, including inactive ones.  If detail is true (1), then lines of detail are returned; if not, only path names are returned.  If delim$ is not null, that is used as a template delimiter character; if it is null, a tab ($09$) delimiter is used.

getdelete$(userid$,[detail[,delim$]) returns the names of all libraries the specified user can delete from.  If detail is true (1), then lines of detail are returned; if not, only path names are returned.  If delim$ is not null, that is used as a template delimiter character; if it is null, a tab ($09$) delimiter is used.

getlib(library$,prop$) fills the template prop$ with library properties. The properties are as follows:

prop.basename$ - the base name (no path information)
prop.dirname$ - the path information to the library
prop.path$ - the full path, including dirname and basename
prop.category$ - a category of the library, used to organize libraries in the browser interface
prop.description$
prop.created$ - yyyymmdd creation date
prop.defperms$ combination of r, w, and d, semicolon delimited
prop.forceseq - true (1) to force all sub ID's to have sequencing
prop.inactive - true (1) to make the library inactive, so no updates are allowed to the library
prop.count - the number of documents in the library
prop.aliases$ - semicolon delimited list of library alias names

 

getnames$([detail[,delim$]) returns the names of all active libraries.  If detail is true (1), then lines of detail are returned; if not, only path names are returned.  If delim$ is not null, that is used as a template delimiter character; if it is null, a tab ($09$) delimeter is used.

getread$(userid$,[detail[,delim$]) returns the names of all libraries the specified user can read from.  If detail is true (1), then lines of detail are returned; if not, only path names are returned.  If delim$ is not null, that is used as a template delimiter character; if it is null, a tab ($09$) delimeter is used.

gettemplate$(detail[,delim$]) returns a string template definition for detail or non-detail return lines, optionally with the specified delimiter.  If no delimiter is specified, a tab delimiter ($09$) is assumed.

getwrite$(userid$,[detail[,delim$]) returns the names of all libraries the specified user can write to.  If detail is true (1), then lines of detail are returned; if not, only path names are returned.  If delim$ is not null, that is used as a template delimiter character; if it is null, a tab ($09$) delimeter is used.

putlib(library$,prop$) update library with template prop$ (see getlib() for format).  Admin permissions required.  Note a library can't be renamed this way, only information properties such as category and description are updated.

 

 

The following code fragment illustrates how one could parse a library list.

 

o=new("libraries")

dim row$:o'gettemplate$(1)

rows$=o'getnames$(1)

x=pos($0a$=rows$)

while x>0

 row$=rows$(1,x-1)

 rows$=rows$(x+1)

 libname$=row.basename$

 libpath$=row.dirname$

 libcount=row.count

 x=pos($0a$=rows$)

wend

drop object o