Base
[ class tree: Base ] [ index: Base ] [ all elements ]

Class: Database

Source Location: /objects/database.php

Class Overview


A MySQL DB interaction object.


Variables

Methods



Class Details

[line 28]
A MySQL DB interaction object.



[ Top ]


Class Variables

$getqueries = 0

[line 43]



Tags:

var:  The number of times sql_tabl() has been called
access:  public

Type:   int


[ Top ]

$link =

[line 33]

The MySQL resource object used to identify the database connection



Tags:

access:  private

Type:   mixed


[ Top ]

$putqueries = 0

[line 38]



Tags:

var:  The number of times sql_put() has been called
access:  public

Type:   int


[ Top ]



Class Methods


static method deCoastCompare [line 76]

static string deCoastCompare( string $nonCoastalColumn, string $coastalColumn)

Generate the SQL needed to compare a coastal territory column to non-coastal territory column



Tags:

access:  public


Parameters:

string   $nonCoastalColumn   The name of the non-coastal column
string   $coastalColumn   The name of the coastal column

[ Top ]

static method packArray [line 56]

static string packArray( string $before, $array, string $after, string $joiner)

This is like implode with a wrapper around it, because using implode for this function again and again got messy



Tags:

return:  Packed array
access:  public


Parameters:

string   $before   Text before packed array
array   $array   The array to pack
string   $after   Text after packed array
string   $joiner   Text to join the array pieces

[ Top ]

constructor __construct [line 96]

Database __construct( )

Initialize the database connection



Tags:

access:  public


[ Top ]

destructor __destruct [line 116]

void __destruct( )

Close the database connection



Tags:

access:  public


[ Top ]

method escape [line 176]

string escape( string $text, [ $htmlAllowed = false])

Sanitize incoming strings, filtering out all HTML. Suitable for all data.



Tags:

return:  The sanitized string
access:  public


Parameters:

string   $text   The string to be escaped
   $htmlAllowed  

[ Top ]

method get_lock [line 336]

void get_lock( string $name, [int[optional] $wait = 8])

Get a MySQL named lock, will stop the script if the lock cannot be obtained



Tags:

access:  public


Parameters:

string   $name   The name of the lock
int[optional]   $wait   The time to wait before giving up, default is 8 seconds

[ Top ]

method msg_escape [line 133]

string msg_escape( string $text)

Sanitize incoming strings, leaving newlines. Suitable for messages.

Replace newlines with
, and allow
through the filter.




Tags:

return:  The sanitized string
access:  public


Parameters:

string   $text   The string to be escaped

[ Top ]

method sql_hash [line 299]

array|bool sql_hash( string $sql)

Run a SQL query and return a single named row $row['foo']



Tags:

return:  A named row, or false if no rows were returned
access:  public


Parameters:

string   $sql   The SQL query

[ Top ]

method sql_put [line 317]

int sql_put( string $sql)

Run a data insertion SQL query, halting phpDip if there is an error



Tags:

return:  The ID of the last inserted row, which may be irrelevant if an INSERT/UPDATE query weren't performed
access:  public


Parameters:

string   $sql   The data insertion SQL query

[ Top ]

method sql_row [line 281]

array|bool sql_row( string $sql)

Run a SQL query and return a single numbered row $row[0]



Tags:

return:  A numbered row, or false if no rows were returned
access:  public


Parameters:

string   $sql   The SQL query

[ Top ]

method sql_tabl [line 192]

resource sql_tabl( string $sql)

Query the database and return a MySQL table resource.



Tags:

return:  A MySQL table resource
access:  public


Parameters:

string   $sql   A safe, pre-sanitized SQL query

[ Top ]

method tabl_hash [line 253]

array|bool tabl_hash( resource $tabl)

Take the next named MySQL row from a table resource, or return false if no rows remain $row['foo']



Tags:

return:  A named row containing one row from the table, or false if there are no rows remaining.
access:  public


Parameters:

resource   $tabl   A MySQL table resource

[ Top ]

method tabl_row [line 223]

array|bool tabl_row( resource $tabl)

Take the next numbered MySQL row from a table resource, or return false if no rows remain $row[0]



Tags:

return:  A numbered row containing one row from the table, or false if there are no rows remaining.
access:  public


Parameters:

resource   $tabl   A MySQL table resource

[ Top ]

method un_msg_escape [line 154]

string un_msg_escape( string $text)

Un-escape something escaped



Tags:

return:  Dangerous text
access:  public


Parameters:

string   $text   The text to un-escape

[ Top ]


Documentation generated on Thu, 13 Nov 2008 18:15:03 +0900 by phpDocumentor 1.4.1