RDO CONNECT()
Template:YLM to do Numeric = rdo_connect(servertype as character, hostname as character, username as character, password as character, database as character)
Closes a connection
rdo_close(connection as Numeric)
mysql_close(connection as Numeric)
The mysql_select_db() function sets the active database Numeric = rdo_select_db(database as Character [, connection as Numeric] ) Numeric = mysql_select_db(database as Character [, connection as Numeric] )
The mysql_list_dbs() function finds the available databases for a given connection. Object = rdo_list_dbs(connection as Numeric) Object = mysql_list_dbs(connection as Numeric)
This function returns the number of affected rows on success, or -1 if the last operation failed Numeric = rdo_affected_rows() Numeric = mysql_affected_rows()
Returns the error number of the last operation Numeric = rdo_errno() Numeric = mysql_errno()
Returns the error description of the last Recital operation Character = rdo_error() Character = mysql_error()
Returns a row from a recordset as an associative array Object = rdo_fetch_array(query as Character) Object = rdo_fetch_assoc(query as Character) Object = mysql_fetch_array(query as Character) Object = mysql_fetch_assoc(query as Character)
This function returns a ResultSet Object for SELECT queries Object = rdo_query(query as Character [, connection as Numeric] ) Object = rdo_unbuffered_query(char query [, connection as Numeric] ) Object = mysql_query(query as Character [, connection as Numeric] ) Object = mysql_unbuffered_query(char query [, connection as Numeric] ) TIP The mysql_query() function returns an associative array where each item in the array is an associative array containing the fields for each record returned from the query. Use the FOREACH statement to traverse this data.
e.g.
connection = mysql_connect("localhost", myusername, mpassword) mysql_select_db("mydatabase") resultset = mysql_query("select * from customers", connection) foreach resultset as r
echo r["fieldname"]
endfor This function executes non-SELECT statements Numeric = rdo_exec(command as Character [, connection as Numeric] ) Numeric = mysql_exec(command as Character [, connection as Numeric] ) TIP You can use the mysql_exec() function to create tables and insert data.
e.g.
mysql_exec("create table mytable (name char(10))", connection) mysql_exec("insert into mytable values ('Hello world')")
However, Recital is a database centric scripting language so you can just place the sql commands directly in your program code.
// open a new mysql connection connection = mysql_connect("localhost", myusername, mypassword)
// The mysql connection is selected after the mysql_connect() function returns create table mytable (name char(10)) insert into mytable values ('Hello world')
// close the connection mysql_close(connection) The following functions returns the next row from a recordset as an Object Object = rdo_fetch_object(resultset as Object) Object = rdo_fetch_row(resultset as Object) Object = mysql_fetch_object(resultset as Object) Object = mysql_fetch_row(resultset as Object)
The mysql_num_rows() function returns the number of rows in a recordset Numeric = rdo_num_rows(resultset as Object) Numeric = mysql_num_rows(resultset as Object)
Returns the number of fields in a recordset Numeric = rdo_num_fields(resultset as Object) Numeric = mysql_num_fields(resultset as Object)
The mysql_data_seek() function moves the internal row pointer Numeric = rdo_data_seek(Resultset as Object, Row as Numeric) Numeric = mysql_data_seek(Resultset as Object, Row as Numeric)
The mysql_field_seek() function jumps to a specified field in a recordset Numeric = rdo_field_seek(Resultset as Object, Column as Numeric) Numeric = mysql_field_seek(Resultset as Object, Column as Numeric)
The mysql_fetch_field() function returns an object containing information of a field from a recordset Object = rdo_fetch_field(Resultset as Object, Column as Numeric) Object = mysql_fetch_field(Resultset as Object, Column as Numeric)
The mysql_fetch_lengths() function returns the length of the contents of each field in a row Object = rdo_fetch_lengths(Resultset as Object) Object = mysql_fetch_lengths(Resultset as Object)
The mysql_field_table() function returns the name of the table where a specified field is located Character = rdo_field_table(Resultset as Object, int field_offset) Character = mysql_field_table(Resultset as Object, int field_offset)
The mysql_field_name() function returns the name of a field in a recordset Character = rdo_field_name(Resultset as Object, Column as Numeric) Character = mysql_field_name(Resultset as Object, Column as Numeric)
The mysql_field_type() function returns the type of a field in a recordset Character = rdo_field_type(Resultset as Object, Column as Numeric) Character = mysql_field_type(Resultset as Object, Column as Numeric)
The mysql_field_len() function returns the length of a field in a recordset Numeric = rdo_field_len(Resultset as Object, Column as Numeric) Numeric = mysql_field_len(Resultset as Object, Column as Numeric)
The mysql_field_flags() function returns the flags of a field in a recordset Character = rdo_field_flags(Resultset as Object, Column as Numeric) Character = mysql_field_flags(Resultset as Object, Column as Numeric)
See Also
rdo_field_flags(), rdo_free_object(), rdo_free_result(), rdo_get_client_info(), rdo_get_host_info(), rdo_info(), rdo_ping(), rdo_real_escape_string(), rdo_result(), rdo_stat(), rdo_thread_id()