Difference between revisions of "Remote Data Connectivity"

From Recital Documentation Wiki
Jump to: navigation, search
(Navigating the Result Set)
(Examples)
Line 242: Line 242:
  
 
====Examples====
 
====Examples====
 +
<code lang="recital">
 +
<code>
  
 
===Using Recital Client/Server ===
 
===Using Recital Client/Server ===
Line 247: Line 249:
 
===Using Recital with PostgreSQL===
 
===Using Recital with PostgreSQL===
 
===Using Recital with Oracle===
 
===Using Recital with Oracle===
===Using Recital with DB2===
+
===Using Recital with DB2===</code>

Revision as of 08:57, 29 July 2010

Remote Data Connectivity

Overview of Remote Data Connectivity Functions

Overview of Recital Data Objects (RDO)

The RDO functions can be used for data access for both remote third-party/Recital and local Recital data sources. The functions allow a connection to be made to the data, SQL queries to be sent and the results to be loaded into a result set object for further processing.

Each MySQL compatible RDO function also has a MySQL-named equivalent for ease of use, e.g. rdo_connect() and mysql_connect() are synonyms.

Connecting to a Data Source

numeric = rdo_connect(servertype as character, hostname_or_ip as character, account as character, 
  password as character [, database as character])
numeric = rdo_select_db(database as character [, connection as numeric])

Disconnecting from a Data Source

numeric = rdo_close(connection as numeric)

Sending SQL Queries and Statements

numeric = rdo_exec(statement as string [, connection as numeric])
  • rdo_query() - return a result set object for a SELECT query
object = rdo_query(query as string [, connection as numeric])
object = rdo_unbuffered_query(query as string [, connection as numeric])
array = rdo_fetch_array(query as string)
array = rdo_fetch_assoc(query as string)
string = rdo_real_escape_string(query as string [, connection as numeric])
numeric = rdo_affected_rows()
  • rdo_info() - return information about the last query
string = rdo_info()

Processing Result Sets

Navigating the Result Set
object = rdo_fetch_row(resultset as object)
object = rdo_fetch_object(resultset as object)
numeric = rdo_data_seek(resultset as object, row as numeric)
numeric = rdo_field_seek(resultset as object, column as numeric)
  • rdo_result() - return the value of a field in a result set
string = rdo_result(resultset as object, row as numeric, column as string)
Result Set Information
  • rdo_fetch_field() - return an object containing information about a field from a result set
object = rdo_fetch_field(resultset as object, field as numeric)
object = rdo_fetch_lengths(resultset as object)
numeric = rdo_num_fields(resultset as object)
numeric = rdo_num_rows(resultset as object)
Field Information
string = rdo_field_flags(resultset as object, column as numeric)
numeric = rdo_field_len(resultset as object, column as numeric)
string = rdo_field_name(resultset as object, column as numeric)
string = rdo_field_type(resultset as object, column as numeric)
  • rdo_field_table() - return the name of the table where a specified field is located
string = rdo_field_table(resultset as object, column as numeric)
Freeing Memory
numeric = rdo_free_object(resultset as object)
numeric = rdo_free_result(resultset as object)

Getting Error Information

numeric = rdo_errno()
  • rdo_error() - return the error description of the last Recital error
string = rdo_errno()

Getting Environment Information

string = rdo_get_client_info()
string = rdo_get_host_info(connection as numeric)
  • rdo_list_dbs() - list the available databases for the current or specified connection
object = rdo_list_dbs([connection as numeric])
  • rdo_ping() - check whether a server connection is active
logical = rdo_ping(connection as numeric)
  • rdo_stat() - return the current system status of Recital
numeric = rdo_stat(connection as numeric)
numeric = rdo_thread_id([connection as numeric])

Examples

<code>
 
===Using Recital Client/Server ===
===Using Recital with MySQL===
===Using Recital with PostgreSQL===
===Using Recital with Oracle===
===Using Recital with DB2===