Luxor storage implementation for PHP's PEAR database abstraction layer.
The table structure can be created by the scripts/drivers/luxor.sql
script.
$Horde: luxor/lib/Driver/sql.php,v 1.29 2007/09/23 13:32:35 jan Exp $
Methods summary
public
|
#
Luxor_Driver_sql( string $source, array $params = array() )
Constructs a new SQL storage object.
Constructs a new SQL storage object.
Parameters
- $source
- The name of the source.
- $params
- A hash containing connection parameters.
|
public
mixed
|
#
index( string $symname, integer $fileId, integer $line, integer $langid, integer $type )
Adds a symbol definition to the sybmol index.
Adds a symbol definition to the sybmol index.
Parameters
- $symname
- The symbol's name.
- $fileId
- <p>The unique ID of the file where this symbol was
defined.</p>
- $line
- The linenumber where this symbol was defined.
- $langid
- <p>The unique ID of the language the file was
written in.</p>
- $type
- The symbol type.
Returns
mixed PEAR_Error on error, true on success.
|
public
mixed
|
#
reference( string $symname, integer $fileId, integer $line )
Add a symbol reference to the reference index.
Add a symbol reference to the reference index.
Parameters
- $symname
- The name of the used symbol.
- $fileId
- <p>The unique ID of the file in which the symbol
was used.</p>
- $line
- The number of line in which the symbol was used.
Returns
mixed PEAR_Error on error, true on success.
|
public
integer
|
#
fileId( string $filename, string $tag = '' )
Returns a unique ID for a given filename.
Returns a unique ID for a given filename.
Parameters
- $filename
- The name of the file.
- $tag
- The tag of the file.
Returns
integer A unique ID for this file or PEAR_Error on error.
|
public
integer
|
#
createFileId( string $filename, string $tag, integer $lastmodified )
Created a unique ID for a given filename.
Created a unique ID for a given filename.
Parameters
- $filename
- The name of the file.
- $tag
- The tag of the file.
- $lastmodified
- The timestamp the file was last modified.
Returns
integer A unique ID for this file or PEAR_Error on error.
|
public
integer
|
#
symid( string $symname )
Returns a unique ID for a given symbol.
Returns a unique ID for a given symbol.
Parameters
- $symname
- The name of the symbol.
Returns
integer A unique ID for this symbol or PEAR_Error on error.
|
public
string
|
#
symname( integer $symid )
Returns the name of a symbol from its unique ID.
Returns the name of a symbol from its unique ID.
Parameters
- $symid
- The ID of the symbol
Returns
string The name of the symbol or PEAR_Error on error
|
public
integer
|
#
isSymbol( string $symname, mixed $altsources = array() )
Checks if the given name is a known symbol.
Checks if the given name is a known symbol.
Parameters
- $symname
- The potential symbol name.
- $altsources
-
Returns
integer The symbol's id or null if it wasn't a symbol.
|
public
boolean
|
#
toIndex( integer $fileId )
If this file has not been indexed earlier, mark it as being
indexed now.
If this file has not been indexed earlier, mark it as being
indexed now.
Parameters
- $fileId
- The file's unique ID.
Returns
boolean True if the file has been marked as being indexed,
false if it was already indexed.
|
public
boolean
|
#
toReference( integer $fileId )
If this file has not been referenced earlier, mark it as being
referenced now.
If this file has not been referenced earlier, mark it as being
referenced now.
Parameters
- $fileId
- The file's unique ID.
Returns
boolean True if the file has been marked as being referenced,
false if it was already referenced.
|
public
integer
|
#
getLastModified( string $filename )
Return the last time the entry for a file was modified.
Return the last time the entry for a file was modified.
Parameters
- $filename
- The filename to check.
Returns
integer The last modified time, or 0 if there is an error.
|
public
|
#
clearCache( )
Empties the current symbol cache.
Empties the current symbol cache.
This function should be called before parsing each new file.
If this is not done too much memory will be used and things
will become very slow.
|
public
|
#
clearIndex( )
Cleans the database for a fresh import of data.
Cleans the database for a fresh import of data.
This function should be called before parsing the source tree
again, to avoid duplicate entries in the database.
|
public
|
#
getDecId( integer $lang, string $string )
Returns an unique ID for a description of a symbol type.
Returns an unique ID for a description of a symbol type.
Parameters
- $lang
- The language's unique ID.
- $string
- The symbol type description.
return mixed A unique ID for this description or PEAR_Error on error.
|
public
array
|
#
getIndex( integer $symid, string $tag = '' )
Locate the definitions of a symbol.
Locate the definitions of a symbol.
Parameters
- $symid
- The symbol id.
- $tag
- The tag of the file.
Returns
array Nested hash with elements 'filename', 'line', and
'declaration'.
|
public
array
|
#
getReference( integer $symid, string $tag = '' )
Locate the usage of a symbol.
Locate the usage of a symbol.
Parameters
- $symid
- The symbol id.
- $tag
- The tag of the file.
Returns
array Nested hash with elements 'filename', and 'line'.
|
public
array
|
#
searchSymbols( string $symbol )
Search for symbols matching $symbol.
Search for symbols matching $symbol.
Parameters
- $symbol
- The symbol name to search for.
Returns
array Any symids matching $symbol.
|
public
string
|
#
getSourceBySymbol( mixed $symid )
Get source that a symbol is from.
Get source that a symbol is from.
Parameters
Returns
string The source id.
|
public
boolean
|
#
_connect( )
Attempts to open a persistent connection to the SQL server.
Attempts to open a persistent connection to the SQL server.
Returns
boolean True on success.
|