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

Class: mysqlix

Source Location: /mysqlix.class.php

Class mysqlix

Class Overview

This class extends the very useful predefined class mysqli in a way that adding some useful function.

To get more useful function of class mysqli, read details on the class mysqli documentation.

Located in /mysqlix.class.php [line 13]

mysqli
   |
   --mysqlix
Author(s): API Tags:
Access:  public

Information Tags:
Copyright:  never
Todo:  In the future release, I will add function to create stored mySQL function/procedure, index, create table, create view, and selection from multiple table(s). Send bug reports, patches, feature requests, complaints & hate mail (no spam thanks) to my email
Version:  1.0
Link:  http://www.php.net/manual/en/ref.mysqli.php

Properties

Methods

[ Top ]
Property Summary
mixed   $latestdb  
string   $statement   Contains current query statement

[ Top ]
Method Summary
mysqlix   mysqlix()   Constructor of class mysqlix.
void   __destruct()   destructor of class mysqli.
mixed   add_column()   Function to manipulate array used in create_table as $arrcolumn
boolean   create_db()   Creating a database with specified parameter(s)
mixed   create_tables()   Create table in a defined database
boolean   create_trigger()   Create a trigger in your mySQL database server.
boolean   drop_db()   Drop one or more database(s)
boolean   drop_table()   Drop one or more table(s)
boolean   drop_trigger()   Drop one or more trigger(s)
boolean   insert()   Simple insert to a table in defined database.
mixed   query()   mysqli Overloading function query.
boolean   secure_multi_query()   This function can secure your multi query in a way that it will make a checkpoint before processing first query
mixed   select()   Select some / all column (s) of a table.
boolean   select_db()   mysqli overloading function select_db()
string   table_comment()   Return comment on a table (if you specify it in creation)
mixed   table_comments()  
boolean   update()   Simple update to a table in defined database.

[ Top ]
Properties
mixed   $latestdb [line 22]
API Tags:
Access:  public


[ Top ]
string   $statement [line 21]

Contains current query statement

API Tags:
Access:  public

Information Tags:
Since:  version 1.0

[ Top ]
Methods
Constructor mysqlix  [line 36]

  mysqlix mysqlix( [string $hostname = 'localhost'], [string $username = 'root'], [string $password = ''], [string $dbname = null], [string $port = null], [string $socket = null]  )

Constructor of class mysqlix.

Connect database using mysqli function

Parameters:
string   $hostname:  (OPTIONAL)$hostname mySQL server hostname that want to be connected. Use localhost if not defined
string   $username:  (OPTIONAL)$username Username of mySQL server. Use root if not defined
string   $password:  (OPTIONAL)$password Password of defined username of mySQL server. Use '' if not defined
string   $dbname:  (OPTIONAL)$dbname The name of database that want to be connected.
string   $port:  (OPTIONAL)$port Define Port to connect. Will use default if not given
string   $socket:  (OPTIONAL)$socket Define socket to connect. Will use default if not given

API Tags:
Access:  public
See:  example.php To get information how to use this function

Information Tags:
Since:  version 1.0

[ Top ]
Destructor __destruct  [line 86]

  void __destruct( )

destructor of class mysqli.

Close current connection


API Tags:
Access:  public


[ Top ]
add_column  [line 392]

  mixed add_column( mixed $arrcolumn, mixed $name, mixed $type, [mixed $length = null], [mixed $null = false], [mixed $autoinc = false], [mixed $primary = false], [mixed $default = null], [mixed $comment = null], [mixed $charset = null], [mixed $collate = null]  )

Function to manipulate array used in create_table as $arrcolumn


API Tags:
Access:  public
See:  function create_table

Information Tags:
Since:  version 1.0

[ Top ]
create_db  [line 339]

  boolean create_db( string $dbname, [mixed $ifnotexist = true], [string $charset = null], [string $collate = null], boolean $ifnoexist  )

Creating a database with specified parameter(s)

Parameters:
string   $dbname:  Specify the name of database
boolean   $ifnoexist:  Should query behave 'IF NO EXIST'
string   $charset:  (OPTIONAL)Specify character set of database. If not given, will use default
string   $collate:  (OPTIONAL)Specify collate of database. If not given, will use default

API Tags:
Return:  Wheter the creation succeed or not
Access:  public
See:  example.php To get information how to use this function

Information Tags:
Since:  version 1.0

[ Top ]
create_tables  [line 416]

  mixed create_tables( mixed $tablename, mixed $arrcolumn, [mixed $comment = ""], [mixed $arrindex = null], [mixed $charset = null], [mixed $collate = null], [mixed $type = "MYISAM"]  )

Create table in a defined database


API Tags:
Access:  public
See:  function add_column to help in manipulating array $arrcolumn

Information Tags:
Since:  version 1.0

[ Top ]
create_trigger  [line 269]

  boolean create_trigger( string $triggername, string $tablename, mixed $arraction, [string $moment = 'BEFORE'], [string $event = 'INSERT']  )

Create a trigger in your mySQL database server.

Parameters:
string   $triggername:  Specify the name of trigger
string   $moment:  The Moment that you want your trigger activated, should be 'BEFORE', or 'AFTER'
string   $event:  The event of database activities that trigger will be activated. Relates to @tablename
string   $tablename:  The name of table that the trigger relates to
mixed   $arraction:  The action(s) that will be triggered

API Tags:
Return:  Whether the creation of trigger succeed or not e.g : create_trigger('minusIt', 'loan', array("UPDATE debt SET money = 'money - 10' WHERE user = 'anton'"), 'AFTER', 'UPDATE');
Access:  public
See:  example.php To get information how to use this function

Information Tags:
Since:  version 1.0

[ Top ]
drop_db  [line 360]

  boolean drop_db( string|mixed $dbnames  )

Drop one or more database(s)

It accept string as $dbnames if you want to drop just one, or array of string to drop more than one databases

Parameters:
string|mixed   $dbnames:  String related to the name of db to be dropped, or a set of array of String that its elements contain string related to the name of db to be dropped

API Tags:
Return:  Wheter the drop process succeed or not
Access:  public
See:  example.php To get information how to use this function

Information Tags:
Since:  version 1.0

[ Top ]
drop_table  [line 484]

  boolean drop_table( string|mixed $tablenames  )

Drop one or more table(s)

It accept string as $tablenames if you want to drop just one, or array of string to drop more than one tables

Parameters:
string|mixed   $tablenames:  String related to the name of table to be dropped, or a set of array of String that its elements contain string related to the name of table to be dropped

API Tags:
Return:  Wheter the drop process succeed or not
Access:  public
See:  example.php To get information how to use this function

Information Tags:
Todo:  Actually, I have function to create table, but hesitate it will be useful. Perhaps, next release will contain that
Since:  version 1.0

[ Top ]
drop_trigger  [line 302]

  boolean drop_trigger( string|mixed $triggernames  )

Drop one or more trigger(s)

It accepts a string that contain the name of trigger or array of trigger's name

Parameters:
string|mixed   $triggernames:  String or array of string that contains trigger(s) name

API Tags:
Return:  Wheter the drop process succeed or not
Access:  public
See:  example.php To get information how to use this function

Information Tags:
Since:  version 1.0

[ Top ]
insert  [line 101]

  boolean insert( string $tablename, mixed $arrcolumn, mixed $arrcolum  )

Simple insert to a table in defined database.

Define name of table in $tablename, and Specify each name and column that want to be inserted, in a array(key => value) $arrcolumn

Parameters:
string   $tablename:  Contains the name of table that you want to be inserted
mixed   $arrcolum:  Contains array of column with its value that want to be inserted, the name of each column shoud be exist in the table $tablename

API Tags:
Return:  Whether the insert process succeed or not
Access:  public
See:  example.php To get information how to use this function

Information Tags:
Since:  version 1.0

[ Top ]
query  [line 67]

  mixed query( string $query, [boolean $checkdb = true]  )

mysqli Overloading function query.

Catch query 'use', and then update variabel $latestdb to latest db connected

Parameters:
string   $query:  The query specified by user
boolean   $checkdb:  (OPTIONAL)Should variable $latestdb updated

API Tags:
Access:  public

Information Tags:
Since:  version 1.0

[ Top ]
secure_multi_query  [line 237]

  boolean secure_multi_query( mixed $arrquery  )

This function can secure your multi query in a way that it will make a checkpoint before processing first query

And, if there's at least one query error, they are rolled back

Parameters:
mixed   $arrquery:  Contains array of queries

API Tags:
Return:  Whether multi query succeed or not
Access:  public
See:  example.php To get information how to use this function

Information Tags:
Since:  version 1.0

[ Top ]
select  [line 188]

  mixed select( string $tablename, [mixed $arrcolumn = null], [string $compare = '='], [string $orderby = null], [string $singly = 'ASC'], [int $limit = null], [int $n = 0]  )

Select some / all column (s) of a table.

Define table name in $tablename,
Define column(s) in $tablename that you want to retrieve in each array $arrcolumn 's name If you want to add constraint(s) in your select query, define it in one or more element(s) array $arrcolumn 's value. If you dont want to put constraint (no where clause), leave blank each element of array $arrcolumn 's value $compare variable specify how the variable in database want to be compared, by '=', 'LIKE', or 'REGEXP' To add order attribute on your select query, you can specify which column it should be ordered using variable $orderby (a column of your table), and its singly on variable $singly (could be 'ASC' or 'DESC') To limit its selection, you can combine variable $limit and $n, where $limit will limit the selected query to a specified value of integer, and variable $n command the sql to return the ($n+1) st/nd/th $limit of returned query, for example $limit = 15, and $n = 0, the result will return the first 15 whatever the query returned note : if you want to make a customized search like username = '%anton%', you should specify it on the value of each $arrcolumn's elements e.g : select( 'user', array('username' => 'anton','score' => '4'), 'REGEXP', 'username', 'ASC', '30', 0 )

Parameters:
string   $tablename:  Specify the name of table you want to select
mixed   $arrcolumn:  (OPTIONAL)Handle which column you want to retrieve, and where clause. Leave all value blank if you dont need constraint (where clause)
string   $compare:  (OPTIONAL)How where clause want to be compared, '=', 'LIKE', or 'REGEXP'
string   $orderby:  (OPTIONAL)Specify which column the tupple retrieved should ordered by
string   $singly:  (OPTIONAL)Specify how the order behave. Ascending (ASC) or Descending (DESC)
int   $limit:  (OPTIONAL)Specify how many the data will be retrieved
int   $n:  (OPTIONAL)Relate to $limit. Which $n th $limit should be retrieved

API Tags:
Return:  Retrieved tupple(s) of query
Access:  public
See:  example.php To get information how to use this function

Information Tags:
Since:  version 1.0

[ Top ]
select_db  [line 48]

  boolean select_db( string $dbname  )

mysqli overloading function select_db()

Update variable $latestdb on calling this function

Parameters:
string   $dbname:  Name of database used

API Tags:
Access:  public

Information Tags:
Since:  version 1.0

[ Top ]
table_comment  [line 510]

  string table_comment( string $tablename, [string $dbname = null]  )

Return comment on a table (if you specify it in creation)

This function only work if your mySQL server contains database information_schema that contains all information about your database server, probably made by web server package, like XAMPP

Parameters:
string   $tablename:  Contains the name of table that you want the function to returned its comment
string   $dbname:  (OPTIONAL)you can specify the database name where you put your $tablename table. This variable will handle ambiguity when there's 2 table with the same name but in the different database

API Tags:
Return:  Comment of specified table
Access:  public
See:  example.php To get information how to use this function

Information Tags:
Since:  version 1.0

[ Top ]
table_comments  [line 535]

  mixed table_comments( string $dbname  )

Parameters:
string   $dbname:  Specify database name

API Tags:
Return:  Array of array<name, comment> where name is tablename, and comment is comment of the table
Access:  public
See:  example.php To get information how to use this function
See:  function table_comment( $tablename, $dbname = null ) Return comment of table(s) that exist on a specified database This function works as table_comment( $tablename, $dbname = null ) function, <br> except that it will search all comment(s) for table(s) that exist in a database

Information Tags:
Since:  version 1.0
Todo:  Actually, I want to add function to retrieve table/database 's statistic. But never realized :) .Perhaps it will exist in future release

[ Top ]
update  [line 141]

  boolean update( string $tablename, mixed $arrcolumn, [mixed $arrwhere = array()]  )

Simple update to a table in defined database.

This function support update with where clause. Use variable $tablename to define name of table, array of string $arrcolumn will contain column and its value that want to be updated, and finally array of string $arrwhere will contain column name and its value that you want them to be put in where clause

Parameters:
string   $tablename:  Specify the name of table that want to be updated
mixed   $arrcolumn:  Contains column(s) with its value that need to be updated
mixed   $arrwhere:  (OPTIONAL)Contains column(s) with its desired value that will be put in where clause (as constraints) in the query

API Tags:
Return:  Whether the update process suceed or not
Access:  public
See:  example.php To get information how to use this function

Information Tags:
Since:  version 1.0

[ Top ]

Documentation generated on Sun, 29 Jul 2007 11:01:36 +0700 by phpDocumentor 1.3.0RC3