oaidp-util.php File Reference

Utilities for the OAI Data Provider. More...

Functions

 debug_var_dump ($var_name, $var)
 debug_print_r ($var_name, $var)
 debug_message ($msg)
 checkArgs ($args, $checkList)
 is_valid_uri ($url)
 is_valid_attrb ($attrb)
 formatDatestamp ($datestamp)
 checkDateFormat ($date)
 prepare_set_names ()
 oai_exit ()
 get_token ()
 createResumToken ($cursor, $extquery, $metadataPrefix)
 readResumToken ($resumptionToken)
 selectallQuery ($metadPrefix="rif", $id= '')
 idFormatQuery ($id)
 idQuery ($metadPrefix="rif", $id= '')
 untilQuery ($until)
 fromQuery ($from)
 setQuery ($set)
 rowCount ($metadataPrefix, $extQuery, $db)
 process_pdo_error ($query, $e)
 exec_pdo_query ($db, $query)

Detailed Description

A collection of functions used.


Function Documentation

debug_var_dump ( var_name,
var 
)

Dump information of a varible for debugging, only works when SHOW_QUERY_ERROR is true.

Parameters:
$var_name Type: string Name of variable is being debugded
$var Type: mix Any type of varibles used in PHP
See also:
SHOW_QUERY_ERROR in oaidp-config.php
debug_print_r ( var_name,
var 
)

Prints human-readable information about a variable for debugging, only works when SHOW_QUERY_ERROR is true.

Parameters:
$var_name Type: string Name of variable is being debugded
$var Type: mix Any type of varibles used in PHP
See also:
SHOW_QUERY_ERROR in oaidp-config.php
debug_message ( msg  ) 

Prints a message for debugging, only works when SHOW_QUERY_ERROR is true. PHP function print_r can be used to construct message with return parameter sets to true.

Parameters:
$msg Type: string Message needs to be shown
See also:
SHOW_QUERY_ERROR in oaidp-config.php
checkArgs ( args,
checkList 
)

Check if provided correct arguments for a request.

Only number of parameters is checked. metadataPrefix has to be checked before it is used. set has to be checked before it is used. resumptionToken has to be checked before it is used. from and until can easily checked here because no extra information is needed.

is_valid_uri ( url  ) 

Validates an identifier. The pattern is: '/^[-a-z\.0-9]+$/i' which means it accepts -, letters and numbers. Used only by function oai_error code idDoesNotExist.

Parameters:
$url Type: string
is_valid_attrb ( attrb  ) 

Validates attributes come with the query. It accepts letters, numbers, ':', '_', '.' and -. Here there are few more match patterns than is_valid_uri(): ':_'.

Parameters:
$attrb Type: string
formatDatestamp ( datestamp  ) 

All datestamps used in this system are GMT even return value from database has no TZ information

checkDateFormat ( date  ) 

The database uses datastamp without time-zone information. It needs to clean all time-zone informaion from time string and reformat it

prepare_set_names (  ) 

Retrieve all defined 'setSpec' from configuraiton of $SETS. It is used by ANDS_TPA::create_obj_node();

oai_exit (  ) 

Finish a request when there is an error: send back errors.

get_token (  ) 

Generate a string based on the current Unix timestamp in microseconds for creating resumToken file name.

createResumToken ( cursor,
extquery,
metadataPrefix 
)

Create a token file. It has three parts which is separated by '#': cursor, extension of query, metadataPrefix. Called by listrecords.php.

readResumToken ( resumptionToken  ) 

Read a saved ResumToken

selectallQuery ( metadPrefix = "rif",
id = '' 
)

this function should generate a query which will return all records the useless condition id_column = id_column is just there to ease further extensions to the query, please leave it as it is.

idFormatQuery ( id  ) 

this function will return metadataFormat of a record

idQuery ( metadPrefix = "rif",
id = '' 
)

this function will return identifier and datestamp for all records not very useful

untilQuery ( until  ) 

filter for until, appends to the end of SQL query

fromQuery ( from  ) 

filter for from , appends to the end of SQL query

setQuery ( set  ) 

filter for sets, appends to the end of SQL query

rowCount ( metadataPrefix,
extQuery,
db 
)

for accurately to assess how many records satisfy conditions for all DBs

process_pdo_error ( query,
e 
)

A worker function for processing an error when a query was executed

Parameters:
$query string, original query
$e PDOException, the PDOException object
exec_pdo_query ( db,
query 
)

When query return no result, throw an Exception of Not found.

Parameters:
$db PDO
$query string
Returns:
$res PDOStatement
 All Classes Files Functions Variables Enumerations
Generated on Thu Jun 16 12:49:22 2011 for OAI PHP by  doxygen 1.6.3