Packageindex Classtrees Modulegroups Elementlist Report XML Files

File: /sitemap/include/class.mysql_sitemap.php
sitemap - Richy's Site Map

mysql_sitemap

mysql_sitemap

Class to work with the "sitemap" database in MySQL.

 

public class mysql_sitemap

Class to work with the "sitemap" database in MySQL.

AuthorsRichard Vrijhof <R.J.Vrijhof@bigfoot.com>
Version$Revision: 1.2 $
Copyright(c)2002 R.J. Vrijhof

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Magic$Id: class.mysql_sitemap.php,v 1.2 2002/02/26 21:03:46 richy Exp $

 

Public Method Summary

mixed

connect(string $dbh, string $dbu, string $dbp)

Connect to MySQL database and return link.
boolean

sel_db(string $dbn, integer $dbl)

Select MySQL database.
mixed

query_fetch(string $query, integer $dbl)

Perform MySQL query and fetch result as array if SELECT query.
mixed

query_fetch_all(string $query, integer $dbl)

Perform MySQL query and fetch all results as array.
boolean

ins_item(integer $id, integer $level, string $name, string $link, string $auth)

Insert a row in the "items" table safely.
boolean

del_item(integer $id)

Delete a row from the "items" table safely.
boolean

empty_items()

Make a connection to the MySQL server and simply empty the "items" table.

Private Method Summary

void

mysql_sitemap([ boolean $debug, boolean $debug_verbose ])

Constructor of the class mysql_sitemap.

Public Field Summary

string

$mysql_err

Last error string of one of the methods.

Private Field Summary

boolean

$debug

Debug mode or not.
boolean

$debug_verbose

Verbose debug mode or not (even more info).

Public Method Details

connect

public mixed connect( string $dbh, string $dbu, string $dbp )

  Connect to MySQL database and return link.

Parameter
string $dbh
hostname of MySQL server
string $dbu
user name to logon to MySQL server
string $dbp
password to logon to MySQL server
Returns mixed

on successful connect, the DB link
on error, returns false


sel_db

public boolean sel_db( string $dbn, integer $dbl )

  Select MySQL database.

Parameter
string $dbn
database name
integer $dbl
link to MySQL connection
Returns boolean

true if successful, otherwise false


query_fetch

public mixed query_fetch( string $query, integer $dbl )

  Perform MySQL query and fetch result as array if SELECT query.

Parameter
string $query
database name
integer $dbl
link to MySQL connection
Returns mixed

if $query is a SELECT query, the resulting array,
otherwise true if successful, false if not


query_fetch_all

public mixed query_fetch_all( string $query, integer $dbl )

  Perform MySQL query and fetch all results as array.
Note: use this method only for SELECT queries on the "items" table!

Parameter
string $query
database name
integer $dbl
link to MySQL connection
Returns mixed

if successful, the resulting array, as follows:
row["id"] = array(level, name, link, auth)
if unsuccessful, false

Required global variables
string $main_frame_name - name of the "main" frame

ins_item

public boolean ins_item( integer $id, integer $level, string $name, string $link, string $auth )

  Insert a row in the "items" table safely.
Because the "items" table is reliant on the "id" field as a positional_parameter, you can't just do a "INSERT INTO" query, you have to make sure_the "id" field of the row already there and of the rows above are added by_one to make room for this row. This method does that.

Parameter
integer $id
ID of the item
integer $level
level of the item in the site map
string $name
name of the item
string $link
link to the page, or empty if only container
without its own link
string $auth
"true" or "false", whether this item is a link in
authorized mode or not
Returns boolean

true if successful, false if not

Required global variables
$db_host - hostname of the MySQL server
$db_user - username to logon to MySQL server
$db_pass - password to logon to MySQL server
$db_name - name of the MySQL site map database

del_item

public boolean del_item( integer $id )

  Delete a row from the "items" table safely.
Because the items table is reliant on the "id" field as a positional_parameter, you can't just do a "DELETE FROM" query, you have to make sure_the "id" field of the rows above the deleted row are subtracted by_one to remove the gap that deleting a row produces. This method does that.

Parameter
integer $id
ID of the item
Returns boolean

true if successful, false if not

Required global variables
$db_host - hostname of the MySQL server
$db_user - username to logon to MySQL server
$db_pass - password to logon to MySQL server
$db_name - name of the MySQL site map database

empty_items

public boolean empty_items( )

  Make a connection to the MySQL server and simply empty the "items" table.

Returns boolean

true if successful, false if not

Required global variables
$db_host - hostname of the MySQL server
$db_user - username to logon to the MySQL server
$db_pass - password to logon to the MySQL server
$db_name - name of the MySQL site map database

Private Method Details

mysql_sitemap

private void mysql_sitemap( [ boolean $debug, boolean $debug_verbose ] )

  Constructor of the class mysql_sitemap.

Parameter
boolean $debug = >>false<<
debug mode
boolean $debug_verbose = >>false<<
verbose debug mode
Returns void


Public Field Details

$mysql_err

public string $mysql_err

>><<

Last error string of one of the methods.
All methods are set to automatically fill this variable with the error_message of the failing action and then return. Just view at this variable_if something is failing and you don't know why._Automatically set by all methods, do not change!

See Also connect(), sel_db(), query_fetch(), query_fetch_all(), ins_item(), empty_items()

Private Field Details

$debug

private boolean $debug

>><<

Debug mode or not.
Automatically set by constructor, do not change!

See Also $debug_verbose, mysql_sitemap()

$debug_verbose

private boolean $debug_verbose

>><<

Verbose debug mode or not (even more info).
Automatically set by constructor, do not change!

See Also $debug, mysql_sitemap()


Packageindex Classtrees Modulegroups Elementlist Report XML Files
PHPDoc 1.0beta