Andrew's Web Libraries (AWL)
PgQuery Class Reference

Public Member Functions

 __construct ()
 
 SetConnection ( $new_connection)
 
 _log_error ( $locn, $tag, $string, $line=0, $file="")
 
 rows ()
 
 quote ($str=null)
 
 Plain ( $field)
 
 Exec ( $location='', $line=0, $file='')
 
 Fetch ($as_array=false)
 
 UnFetch ()
 
 FetchBackwards ($as_array=false)
 
 BuildOptionList ( $current='', $location='options', $parameters=false)
 

Public Attributes

 $connection
 
 $querystring
 
 $result
 
 $rownum = -1
 
 $location
 
 $object
 
 $rows
 
 $errorstring
 
 $execution_time
 
 $query_time_warning = 0.3
 

Detailed Description

Definition at line 277 of file PgQuery.php.

Constructor & Destructor Documentation

◆ __construct()

PgQuery::__construct ( )

#- Constructor

Parameters
stringThe query string with replacable '?' characters.
mixedThe values to replace into the SQL string.
Returns
The PgQuery object

Definition at line 367 of file PgQuery.php.

Member Function Documentation

◆ _log_error()

PgQuery::_log_error (   $locn,
  $tag,
  $string,
  $line = 0,
  $file = "" 
)

Log error, optionally with file and line location of the caller.

This function should not really be used outside of PgQuery. For a more useful generic logging interface consider calling dbg_error_log(...);

Parameters
string$locnA string identifying the calling location.
string$tagA tag string, e.g. identifying the type of event.
string$stringThe information to be logged.
int$lineThe line number where the logged event occurred.
string$fileThe file name where the logged event occurred.

Definition at line 412 of file PgQuery.php.

◆ BuildOptionList()

PgQuery::BuildOptionList (   $current = '',
  $location = 'options',
  $parameters = false 
)

Build an option list from the query.

Parameters
string$currentDefault selection of drop down box (optional)
string$locationfor debugging purposes
array$parametersan array further parameters, including 'maxwidth' => 20 to set a maximum width
Returns
string Select box HTML

Definition at line 615 of file PgQuery.php.

◆ Exec()

PgQuery::Exec (   $location = '',
  $line = 0,
  $file = '' 
)

Execute the query, logging any debugging.

Example So that you can nicely enable/disable the queries for a particular class, you could use some of PHPs magic constants in your call. $qry->Exec(CLASS, LINE, FILE);

Parameters
string$locationThe name of the location for enabling debugging or just to help our children find the source of a problem.
int$lineThe line number where Exec was called
string$fileThe file where Exec was called
Returns
resource The actual result of the query (FWIW)

Definition at line 478 of file PgQuery.php.

◆ Fetch()

PgQuery::Fetch (   $as_array = false)

Fetch the next row from the query results

Parameters
boolean$as_arrayTrue if thing to be returned is array
Returns
mixed query row

Definition at line 525 of file PgQuery.php.

◆ FetchBackwards()

PgQuery::FetchBackwards (   $as_array = false)

Fetch backwards from the result resource

Parameters
boolean$as_arrayTrue if thing to be returned is array (default: False
Returns
mixed query row

Definition at line 581 of file PgQuery.php.

◆ Plain()

PgQuery::Plain (   $field)

Convert a string which has already been quoted and escaped for PostgreSQL into a magic array so that it will be inserted unmodified into the SQL string. Use with care!

Parameters
string$fieldThe value which has alread been quoted and escaped.
Returns
array An array with the value associated with a key of 'plain'

Definition at line 455 of file PgQuery.php.

◆ quote()

PgQuery::quote (   $str = null)

Quote the given string so it can be safely used within string delimiters in a query.

See also
qpg() which is where this is really done.
Parameters
mixed$strData to be converted to a string suitable for including as a value in SQL.
Returns
string NULL, TRUE, FALSE, a plain number, or the original string quoted and with ' and \ characters escaped

Definition at line 443 of file PgQuery.php.

◆ rows()

PgQuery::rows ( )

Provide a rows() method for forward compatibility with AwlQuery.

Definition at line 429 of file PgQuery.php.

◆ SetConnection()

PgQuery::SetConnection (   $new_connection)

Use a different database connection for this query

Parameters
resource$new_connectionThe database connection to use.

Definition at line 394 of file PgQuery.php.

◆ UnFetch()

PgQuery::UnFetch ( )

Set row counter back one

In the case that you may like to fetch the same row twice, for example if your SQL returns some columns that are the same for each row, and you want to display them cleanly before displaying the other data repeatedly for each row.

Example $master_row = $qry->Fetch(); $qry->UnFetch(); do_something_first($master_row); while( $row = $qry->Fetch() ) { do_something_repeatedly($row); }

Definition at line 570 of file PgQuery.php.

Member Data Documentation

◆ $connection

PgQuery::$connection

Definition at line 287 of file PgQuery.php.

◆ $errorstring

PgQuery::$errorstring

Definition at line 341 of file PgQuery.php.

◆ $execution_time

PgQuery::$execution_time

Definition at line 348 of file PgQuery.php.

◆ $location

PgQuery::$location

Definition at line 315 of file PgQuery.php.

◆ $object

PgQuery::$object

Definition at line 322 of file PgQuery.php.

◆ $query_time_warning

PgQuery::$query_time_warning = 0.3

Definition at line 357 of file PgQuery.php.

◆ $querystring

PgQuery::$querystring

Definition at line 294 of file PgQuery.php.

◆ $result

PgQuery::$result

Definition at line 301 of file PgQuery.php.

◆ $rownum

PgQuery::$rownum = -1

Definition at line 308 of file PgQuery.php.

◆ $rows

PgQuery::$rows

Definition at line 334 of file PgQuery.php.


The documentation for this class was generated from the following file: