setDataMappings           package:RSQLite           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 _R_D_B_M_S _a_n_d _R/_S

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

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

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

     setDataMappings(res, ...)

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

     res: a `dbResultSet' object as returned by `dbExecStatement'. 

    flds: a field description object as returned by `getFields'. 

    ... : 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.

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

     `dbExecStatement' `dbExec' `fetch' `getFields'

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

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

     rs <- dbExecStatement(con, sql.query)
     flds <- getFields(rs)
     flds[3, "Sclass"] <- makeImage

     setDataMappings(rs, flds)

     im <- fetch(rs, n = -1)

