Method: Mysql2::Client#info

Defined in:
ext/mysql2/client.c

#infoObject


360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
# File 'ext/mysql2/client.c', line 360

static VALUE rb_mysql_client_info(VALUE self) {
  VALUE version = rb_hash_new(), client_info;
  GET_CLIENT(self);
#ifdef HAVE_RUBY_ENCODING_H
  rb_encoding *default_internal_enc = rb_default_internal_encoding();
  rb_encoding *conn_enc = rb_to_encoding(wrapper->encoding);
#endif

  rb_hash_aset(version, sym_id, LONG2NUM(mysql_get_client_version()));
  client_info = rb_str_new2(mysql_get_client_info());
#ifdef HAVE_RUBY_ENCODING_H
  rb_enc_associate(client_info, conn_enc);
  if (default_internal_enc) {
    client_info = rb_str_export_to_enc(client_info, default_internal_enc);
  }
#endif
  rb_hash_aset(version, sym_version, client_info);
  return version;
}