\SQLSTATEMENTS

SQLSTATEMENTS

Some default SQL statements/clauses for LIST/SEARCH operations.

Summary

Methods
Properties
Constants
__construct()
frontSetDays()
frontSetNumber()
getExportSql()
listList()
listSubQuery()
yearOrder()
indices()
executeCondJoins()
excludeBib()
useBib()
quarantine()
$totalResourceSubquery
$listMethodAscDesc
$listType
$listQuarantined
$metadataPaging
$conditions
$conditionsOneField
$joins
$allIds
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Properties

$totalResourceSubquery

$totalResourceSubquery : 

string

Type

$listMethodAscDesc

$listMethodAscDesc : 

string

Type

$listType

$listType : 

string

Type

$listQuarantined

$listQuarantined : 

string

Type

$metadataPaging

$metadataPaging : 

boolean

Type

$conditions

$conditions : 

array

Type

$conditionsOneField

$conditionsOneField : 

array

Type

$joins

$joins : 

array

Type

$allIds

$allIds : 

boolean

Type

Methods

__construct()

__construct() : 

SQLSTATEMENTS

Returns

frontSetDays()

frontSetDays(  days,   limit) : 

Select front page resources according to $limit resources from last $days

Parameters

days
limit

Returns

SQL statement ready to be executed

frontSetNumber()

frontSetNumber(  limit) : 

Select front page resources according to latest $limit resources

Parameters

limit

Returns

SQL statement ready to be executed

getExportSql()

getExportSql() : 

Produce a SQL statement for exporting bibliographies that is not LIMITed or paged alphabetically -- i.e. all resources in the query are gathered.

The SQL statement is base64_encoded and returned to the calling script (usually plugins/importexportbib/EXPORTCOMMON::getSQL()) Large numbers of rows can exhaust PHP memory so we return an array of query statements to be executed. The number of statements is set by $totalPossible. The calling script should cycle through these statements and concatenate the results of each. By trial and error, c.1500 rows seems to be the limit with PHP memory of 64M

Returns

listList()

listList(  order = creator,   table = resource,   subQ = FALSE) : 

Create LIST statement for QUICK LIST ALL queries and basket operations

Parameters

order

Default is 'creator'

table

Default is 'resource'

subQ

Default is FALSE

Returns

SQL statement ready to be executed

listSubQuery()

listSubQuery(  order = FALSE,   queryString = FALSE,   totalSubQuery = FALSE,   table = resource,   subQ = FALSE) : 

Create subquery initial order SELECT statement with minimal fields.

Function specific to core/modules/list/LISTRESOURCES.php (Quick List ALL operations), QUICKSEARCH.php and core/modules/basket/BASKET.php

Parameters

order

Default is FALSE

queryString

Default is FALSE

totalSubQuery

Default is FALSE

table

default is 'resource'

subQ

SQL subquery for input to COUNT operations

Returns

TRUE if resources found, FALSE otherwise

yearOrder()

yearOrder() : 

Create special CASE WHEN statement when ordering by year

Returns

indices()

indices(  order) : 

Create SQL statements for various indices bases on stats -- called from LISTRESOURCES.php

Parameters

order

Returns

executeCondJoins()

executeCondJoins() : 

Execute any conditions and joins

Returns

excludeBib()

excludeBib( bibId,   matchField = resourceId) : 

Create SQL statement to exclude resources in a list being returned if they exist in a user bibliography. Used from Advanced Search.

result is a tidied SQL condition such as: (matchField NOT IN ( SELECT userbibliographyresourceResourceId FROM WKX_user_bibliography_resource WHERE (userbibliographyresourceBibliographyId = 1) )

Parameters

bibId
matchField

databasefield to be searched for Default 'resourceId'

Returns

useBib()

useBib(  joinField = FALSE) : 

Set SQL condition and join clauses if we are browsing a user bibliography to ensure that listed or searched resources come only from that user bibliography.

Parameters

joinField

The resource ID field on which to join the user_bibliography_resource table. Default is FALSE

Returns

quarantine()

quarantine(  front = FALSE,   joinId = resourceId,   joinMisc = TRUE) : 

Conditions for quarantined resources

Parameters

front

Default is FALSE

joinId

Default is 'resourceId'

joinMisc

Default is TRUE

Returns