dbSetDataMappings-methods        package:DBI        R Documentation

_S_e_t _d_a_t_a _m_a_p_p_i_n_g_s _b_e_t_w_e_e_n _a_n _D_B_M_S _a_n_d _R/_S-_P_l_u_s

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

     Sets one or more conversion functions to handle the translation 
     of DBMS data types to R/S-Plus objects.   This may be only needed
     for non-primitive data, since all DBI drivers  handle the common
     base types (integers, numeric, strings, etc.)

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

       dbSetDataMappings(res, flds, ...)

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

     res: a 'DBIResult' object as returned by 'dbSendQuery'. 

    flds: a data.frame with field descriptions as returned by 
          'dbColumnInfo'. 

    ... : any additional arguments are passed to the implementing
          method. 

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

     The details on conversion functions (e.g., arguments, whether they
     can invoke initializers and/or destructors) have not been
     specified.

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

     a logical specifying whether the conversion functions were
     successfully installed or not.

_S_i_d_e _E_f_f_e_c_t_s:

     Conversion functions are set up to be invoked for each element of
     the corresponding fields in the result set.

_N_o_t_e:

     No driver has yet implemented this functionality.

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

     See the Database Interface definition document 'DBI.pdf' in the
     base directory of this package or <URL:
     http://developer.r-project.org/db>.

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

     'dbSendQuery', 'fetch', 'dbColumnInfo'.

_E_x_a_m_p_l_e_s:

     ## Not run: 
     makeImage <- function(x) {
       .C("make_Image", as.integer(x), length(x))
     }

     res <- dbSendQuery(con, statement)
     flds <- dbColumnInfo(res)
     flds[3, "Sclass"] <- makeImage

     dbSetDataMappings(rs, flds)

     im <- fetch(rs, n = -1)
     ## End(Not run)

