#native_company# #native_desc#
#native_cta#

README

By markitos
on January 17, 2001

Version: 1.0

Type: README

Category: Databases

License: GNU General Public License

Description: README file class CMySQL_MSet

Clase CMySQL_MSet |[ mArKitos ]| '00
------------------------------------ 

|[Properties description ]|

- DB_Name   = Database name
- DB_User   = User name for MySQL conection
- DB_Pass   = Password for MySQL access
- DB_Host   = MySQL host server name
- DB_Link   = Description of MySQL link
- CM_TRUE   = Boleanean value [1]
- CM_FALSE  = Boleanean value [0]


#:............................................:#
#: All properties are private from the class  :#
#:............................................:#

|[ Methods description ]|

- CMySQL_MSet

Method constructor. Sets the properties for the conection data

- OpenConnection

Opening method for conection with MySQL server. Stores the descriptor of link in
the DB_Link in case it achieves to connect and returns 1.
On the contrary it returns 0 [CM_FALSE]

- CloseConnection

Method for closing the conection with MySQL server. Closes the conection which is
established with the DB_Link descriptor.

- ExecSQL

Execution method for a SQL sentence which is passed on to us as parameter.
Returns the results of the query in case it succeeds or 0 [CM_FALSE].

- SearchIn

Search method. We are sent the parameters of the name of the table we are searching for, as well
as its field, the pattern and a flag that indicates if the search has to be a complete pattern or
any other occurency with the pattern. The table has to be a valid table of the database and be part of
the DB_Name property.
The table has to include an auto_increment index field with tne name id, because in case of success we
will return a matrix whith the ids of the registers where the search succeeded. The syntax of the call is:

    $Array = SearchIn ("Table_Name", "Field", "Pattern", "Full");

The 'Full' parameter has to be 1 in order to make the search a pattern complete or 0 for it to
be of any other occurency with the pattern.
Also, we can make the search not to be limited to just one field. For that, we only need to specify by
making a call to the method.

    $Array = SearchIn ("Table", "Field-1, Field-2, Field-N", "Pattern", "Full");

Remember that we can make the search for any valid field name in the database.
If the search shouldnt have success it will return 0 [CM_FALSE]. In this way we can see how many registers
matches with our pattern.

	if (($Register_Number = count($Array)) < 1){
	    #: No register was found
	} else {
	    #: In the variable $Register_Number we have a
	    #: entire with the number of registers where the
	    #: search was successful.
	}

### All searches for this method are not case sensitive. For that we use SearchAdv.###

- SearchAdv

Advanced search method. This method is similar to the above mentioned, except in case it has some
advantages such as being able to make a case sensitive search and additional clauses.
The syntax for the call of this method is:

    $Array = SearchAdv ("Table", "Field", "Pattern", "Full", "CaseSensitive", "Clause", "SQL");

, donde los 4 primero parametros corresponden a los del metodo 'SearchIn', y los siguientes son:

    - CaseSensitive = Podra ser 1 o 0. 1 para decirle que la busqueda sea case sensitive, distinguiendo
                        las mayusculas de las minusculas, o 0 para que no lo haga.
    - Clausulas     = Podra ser 1 o 0. 1 para decirle que si vamos a darle clausulas adicionales.
    - SQL           = Sera un string (o una variables cuyo valor lo sea), con la sentencia SQL de la
                        clausulas que queramos poner a la busqueda. Un ejemplo podria ser:

    $Sql_Clause = "WHERE id>='2' ORDER BY Field-2";
    $Array = SearchAdv ("Table", "Field-1", "Field-2", "Pattern", "1", "1", "1", "$Sql_Clause");


This will make a complete search with the 'Pattern' pattern in the table 'Table', in the fields 'Field-1, Field-2'.
The search will be case sensitive and we will also give the clause 'WHERE id>='2' ORDER BY Field-2'.
This method inserts the SQL code at the end of the SELECT sentence.

Together with the class, I attach a file with a few tests so that you can see how the class works.
They are simple examples but by viewing them you can see how to call the methods, as well as making some
tests.

############################### AUTHORS NOTE ####################################
For any comment or clarification please mailme: [email protected]
This class has no restriction and is for free use. Should you make any change,
tell me in order to improve.
###################################################################################


----------------------
|[ #: HappY CodiNG :#]|
      mArkitos '00
----------------------