dbConnectionInfo            package:Rdbi            R Documentation

_R_e_t_u_r_n_s _a _l_i_s_t _o_f _c_o_n_n_e_c_t_i_o_n _s_t_a_t_u_s _a_t_t_r_i_b_u_t_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     'dbConnectionInfo' is a generic function that, when called on a
     valid connection object, returns a list containing connection
     status information.  It is called by 'print.Rdbi.conn'.

_U_s_a_g_e:

     dbConnectionInfo(conn)

_A_r_g_u_m_e_n_t_s:

    conn: A database connection object.

_D_e_t_a_i_l_s:

     Any useful information such as the database host and connection
     status should be returned.

_V_a_l_u_e:

     An arbitrary list of connection attributes.

_N_o_t_e:

     I should probably define a 'dbConnectionOK' method that is generic
     and return 'TRUE' when the connection is valid.  However, you
     don't need to constantly check for a valid connection object. 
     Keep the code path short!  For example, in Rdbi.PgSQL, there is a
     C function that submits a query request to the database backend. 
     This is the only time that the connection object is actually
     derefenced to its connection pointer.  This C function checks for
     a valid connection and returns and error if needed.  Therefore
     there is no reason to check whether the connection is valid before
     passing it to a query function; the C code will do the check.  In
     this way the interface is simplified and the connection checking
     is localized to a single call instead of scattered all over the
     code.  As Bertrand Meyer put it: _"Defensive coding is
     offensive!"_.

_A_u_t_h_o_r(_s):

     Timothy H. Keitt

_R_e_f_e_r_e_n_c_e_s:

     <URL: http://rdbi.sourceforge.net/>

_S_e_e _A_l_s_o:

     'dbConnect', 'dbDisconnect', methods, 'class'

