NAME
	Mysql.mysql - Interface to the Mysql database (ALPHA)

DESCRIPTION
	Mysql.mysql is a pre-compiled Pike program. It enables
	access to the Mysql database from within Pike. Mysql.mysql
	is a part of the Mysql module.

	Mysql is available from	http://www.tcx.se/ .

KEYWORDS
	sql, database


============================================================================
NAME
	create - connect to the Mysql database

SYNTAX
	#include <mysql.h>

	object(mysql) mysql();
	or
	object(mysql) mysql(string hostname);
	or
	object(mysql) mysql(string hostname, string database);
	or
	object(mysql) mysql(string hostname, string database, string user);
	or
	object(mysql) mysql(string hostname, string database, string user,
	                    string password);

DESCRIPTION
	To access the Mysql database, you must first connect to it. This is
	done with the function mysql().

	If you give no argument, or give "" as hostname it will connect with
	a UNIX-domain socket, which is a big performance gain.


============================================================================
NAME
	affected_rows - return the number of affected rows in the table

SYNTAX
	#include <mysql.h>

	int mysql->affected_rows();

DESCRIPTION
	Returns the number of affected rows.


============================================================================
NAME
	insert_id - return the insert id

SYNTAX
	#include <mysql.h>

	int mysql->insert_id();

DESCRIPTION
	Returns the insert id.


============================================================================
NAME
	error - return the last error in Mysql

SYNTAX
	#include <mysql.h>

	string mysql->error();

DESCRIPTION
	When a Mysql-method fails you can get a description of why with this
	function.


============================================================================
NAME
	select_db - select database

SYNTAX
	#include <mysql.h>

	void select_db(string database);

DESCRIPTION
	The Mysql-server can hold several databases. You select which one
	you want to access with this function.

SEE ALSO
	mysql->create, mysql->create_db, mysql->drop_db


============================================================================
NAME
	big_query - make an SQL query

SYNTAX
	#include <mysql.h>

	int|object(Mysql.mysql_result) mysql->big_query(string q);

DESCRIPTION
	This function sends an SQL query to the Mysql-server. The result
	of the query is returned as a Mysql.mysql_result object.
	Returns 0 if the query didn't return any result (e.g. INSERT or
	similar).

SEE ALSO
	Mysql.mysql_result


============================================================================
NAME
	create_db - create a new database

SYNTAX
	#include <mysql.h>

	void mysql->create_db(string database);

DESCRIPTION
	This function creates a new database in the Mysql-server.

SEE ALSO
	mysql->select_db, mysql->drop_db


============================================================================
NAME
	drop_db - drop a database

SYNTAX
	#include <mysql.h>

	void mysql->drop_db(string database);

DESCRIPTION
	This function drops a database from a Mysql-server.

SEE ALSO
	mysql->create_db, mysql->select_db


============================================================================
NAME
	shutdown - shutdown the Mysql-server

SYNTAX
	#include <mysql.h>

	void mysql->shutdown();

DESCRIPTION
	This function shuts down a running Mysql-server.

SEE ALSO
	mysql->reload


============================================================================
NAME
	reload - reload the tables

SYNTAX
	#include <mysql.h>

	void mysql->reload();

DESCRIPTION
	This function causes the Mysql-server to reload its tables.

SEE ALSO
	mysql->shutdown


============================================================================
NAME
	statistics - some Mysql-server statistics

SYNTAX
	#include <mysql.h>

	string mysql->statistics();

DESCRIPTION
	This function returns some server statistics.

EXAMPLE

	#include <mysql.h>

	int main()
	{
	  write(mysql()->statistics());
	  return(0);
	}

SEE ALSO
	mysql->server_info, mysql->host_info, mysql->protocol_info


============================================================================
NAME
	server_info - give the version number of the Mysql-server

SYNTAX
	#include <mysql.h>

	string mysql->server_info();

DESCRIPTION
	This function returns the version number of the Mysql-server.

SEE ALSO
	mysql->statistics, mysql->host_info, mysql->protocol_info


============================================================================
NAME
	host_info - give information about the Mysql-server connection

SYNTAX
	#include <mysql.h>

	string mysql->host_info();

DESCRIPTION
	This function returns a string describing the connection to
	the Mysql-server.

SEE ALSO
	mysql->statistics, mysql->server_info, mysql->protocol_info


============================================================================
NAME
	protocol_info - give the Mysql protocol version

SYNTAX
	#include <mysql.h>

	int mysql->protocol_info();

DESCRIPTION
	This function returns the version number of the protocol the
	Mysql-server uses.

SEE ALSO
	mysql->statistics, mysql->server_info, mysql->host_info


============================================================================
NAME
	list_dbs - list databases

SYNTAX
	#include <mysql.h>

	object(mysql_result) mysql->list_dbs();
	or
	object(mysql_result) mysql->list_dbs(string wild);

DESCRIPTION
	Returns a table containing the names of all databases in the
	Mysql-server. If an argument is specified, only those matching
	wild are returned.

SEE ALSO
	mysql->list_tables, mysql->list_fields, mysql->list_processes,
	Mysql.mysql_result


============================================================================
NAME
	list_tables - list tables in the current database

SYNTAX
	#include <mysql.h>

	object(mysql_result) mysql->list_tables();
	or
	object(mysql_result) mysql->list_tables(string wild);

DESCRIPTION
	Returns a table containing the names of all tables in the current
	database. If an argument is given, only those matching wild are
	returned.

SEE ALSO
	mysql->list_dbs, mysql->list_fields, mysql->list_processes,
	Mysql.mysql_result


============================================================================
NAME
	list_fields - list all fields

SYNTAX
	#include <mysql.h>

	array(int|mapping(string:mixed)) mysql->list_fields(string table);
	or
	array(int|mapping(string:mixed)) mysql->list_fields(string table,
	                                                    string wild);

DESCRIPTION
	Returns an array of mappings with information about the fields in the
	specified table.

	The mappings contain the following entries:

	 "name":	string	The name of the field.
	 "table":	string	The name of the table.
	 "default":	string	The default value for the field.
	 "type":	string	The type of the field.
	 "length":	int	The length of the field.
	 "max_length":	int	The length of the longest element in this field.
	 "flags":	multiset(string)	Some flags.
	 "decimals":	int	The number of decimalplaces.

	The type of the field can be any of:
	"decimal", "char", "short", "long", "float", "double", "null",
	"time", "longlong", "int24", "tiny blob", "medium blob",
	"long blob", "var string", "string" or "unknown".

	The flags multiset can contain any of
	 "primary_key":	This field is part of the primary key for this table.
	 "not_null":	This field may not be NULL.
	 "blob":	This field is a blob field.

NOTA BENE
	Michael Widenius recomends usage of the following query instead:
	 show fields in 'table' like "wild"

SEE ALSO
	mysql->list_dbs, mysql->list_tables, mysql->list_processes,
	mysql_result->fetch_fields


============================================================================
NAME
	list_processes - list all processes in the Mysql-server

SYNTAX
	#include <mysql.h>

	object(mysql_result) mysql->list_processes();

DESCRIPTION
	Returns a table containing the names of all processes in the
	Mysql-server.

SEE ALSO
	mysql->list_dbs, mysql->list_tables, mysql->list_fields,
	Mysql.mysql_result


============================================================================
NAME
	binary_data - inform if this version of mysql supports binary data

SYNTAX
	int mysql->binary_data();

DESCRIPTION
	This function returns non-zero if binary data can be reliably stored
	and retreived with this version of the mysql-module.

	Usually, there is no problem storing binary data in mysql-tables,
	but data containing '\0' (NUL) couldn't be fetched with old
	versions (prior to 3.20.5) of the mysql-library.


