Sha256: e86fc4a181d265e1bee89163be1c33659218b9b23a249b974410c881a0568b14

Contents?: true

Size: 902 Bytes

Versions: 7

Compression:

Stored size: 902 Bytes

Contents

/*------------------------------------------------------------------------------
 * rfbstr.c
 *----------------------------------------------------------------------------*/

/* Includes. */
#include "rfbstr.h"

/**
 * This function converts a sql data into ruby string
 * respecting data encoding
 *
 * @param connection  The connection object relating to the data
 * @param sqlsubtype  SQL subtype of the field (fot character types - used to hold encoding information)
 * @param data  A pointer to the sql data
 * @param length  Length of the sql data
 *
 * @return  A Ruby String object with correct encoding
 *
 */
VALUE rfbstr(VALUE connection, short sqlsubtype, const char *data, short length) {
  VALUE value = Qnil;
  if (length >= 0) {
    value = rb_str_new(data, length);
    value = rb_funcall(connection, rb_intern("force_encoding"), 2, value, INT2FIX(sqlsubtype));
  }
  return value;
}

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rubyfb-0.6.7 ext/rfbstr.c
rubyfb-0.6.4 ext/rfbstr.c
rubyfb-0.6.3 ext/rfbstr.c
rubyfb-0.6.2 ext/rfbstr.c
rubyfb-0.6.1 ext/rfbstr.c
rubyfb-0.6 ext/rfbstr.c
rubyfb-0.5.9 ext/rfbstr.c