phpDocumentor MySQL
[ class tree: MySQL ] [ index: MySQL ] [ all elements ]

Class: Mysql_Statement

Source Location: /statement.php

Class Mysql_Statement

Class Overview

Mysql_Statement is used for preparing and executing a SQL statement.

Although the true advantages of prepared statements are not yet available, this class can be used to prevent the duplication of similar SQL statements. Access provided through Mysql::prepare().

Located in /statement.php [line 33]



		
				Author(s):
		
		
		
Information Tags:
Link:  http://albertfama.com/pkgs/distro/mysql/mysql.zip
Since:  File available since release .01 Alpha
Version:  1.0 (Stable)
License:  GNU GPL
Copyright:  2009 Albert Fama

Properties

Methods

[ Top ]
Property Summary
array   $_binds   Store of values to be inserted into statement
resource   $_handle   MySQL connection
string   $_query   Query to be executed

[ Top ]
Method Summary
Mysql_Statement   __construct()   Constructor
void   addBind()   Add param to bind
Mysql_Result   execute()   Execute query
void   removeBind()   Remove param from bind
string   _bindParamToQuery()   Place values into query
void   _mergeBind()   Combine all bind parameters

[ Top ]
Properties
array   $_binds [line 46]

Store of values to be inserted into statement

Names and values of parameters used during the execution of the SQL statement; stored as an associative array. Adding and removing parameters controlled by *Bind() functions.

API Tags:
Access:  protected
See:  Mysql_Statement::removeBind()
See:  Mysql_Statement::addBind()


[ Top ]
resource   $_handle [line 60]

MySQL connection

API Tags:
Access:  protected


[ Top ]
string   $_query [line 53]

Query to be executed

API Tags:
Access:  protected


[ Top ]
Methods
Constructor __construct  [line 70]

  Mysql_Statement __construct( string $handle, mixed $query  )

Constructor

Save query to member attribute and initialize _binds var.

Parameters:
string   $handle:  query (query to execute)

API Tags:
Access:  public


[ Top ]
addBind  [line 86]

  void addBind( string $name, string $value  )

Add param to bind

Method used to provide a value to a parameter within the query.

Parameters:
string   $name:  name (name of bind param)
string   $value:  value (value of bind param)

API Tags:
Access:  public


[ Top ]
execute  [line 119]

  Mysql_Result execute( )

Execute query

Method accepts any number of arguments. Arguments used as parameter values to bind in query. First argument sent will be bound to param :1 second to param :2 and so on. Method first binds parameters sent to function, then binds parameters within the member variable _bind. Once the query is complete it is executed.


API Tags:
Access:  public
Uses:  Mysql_Statement::_bindParamToQuery()

Information Tags:
Throws:  Mysql_Exception

[ Top ]
removeBind  [line 99]

  void removeBind( string $name  )

Remove param from bind

Method used to remove a value from query parameters.

Parameters:
string   $name:  name (name of bind param)

API Tags:
Access:  public


[ Top ]
_bindParamToQuery  [line 161]

  string _bindParamToQuery( )

Place values into query

Method used by execute() to replace query variables with their values.


API Tags:
Return:  (complete query)
Access:  protected

Information Tags:
Usedby:  Mysql_Statement::execute()

[ Top ]
_mergeBind  [line 144]

  void _mergeBind( mixed $exe_args, array $args  )

Combine all bind parameters

Method combines the parameters sent to Mysql_Statement::execute with the $_binds array.

Parameters:
array   $args: 

API Tags:
Access:  protected


[ Top ]

Documentation generated on Mon, 15 Jun 2009 16:50:07 -0600 by phpDocumentor 1.3.0RC3