Sha256: 02fac4568e24b785b9c5f22fbeb84e0e91658e4648ea2947d895505eda5b8a4d

Contents?: true

Size: 909 Bytes

Versions: 2

Compression:

Stored size: 909 Bytes

Contents

#ifndef SWIFT_H
#define SWIFT_H

#include <dbic++.h>
#include <ruby/ruby.h>
#include <ruby/io.h>
#include <stdint.h>

#define CONST_GET(scope, constant) rb_funcall(scope, rb_intern("const_get"), 1, rb_str_new2(constant))
#define TO_S(v)                    rb_funcall(v, rb_intern("to_s"), 0)
#define CSTRING(v)                 RSTRING_PTR(TO_S(v))

extern VALUE eSwiftError;
extern VALUE eSwiftArgumentError;
extern VALUE eSwiftRuntimeError;
extern VALUE eSwiftConnectionError;

#define CATCH_DBI_EXCEPTIONS() \
  catch (dbi::ConnectionError &error) { \
    rb_raise(eSwiftConnectionError, "%s", CSTRING(rb_str_new2(error.what()))); \
  } \
  catch (dbi::Error &error) { \
    rb_raise(eSwiftRuntimeError, "%s", CSTRING(rb_str_new2(error.what()))); \
  }

#include "adapter.h"
#include "iostream.h"
#include "query.h"
#include "result.h"
#include "statement.h"
#include "request.h"
#include "pool.h"

#endif

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
swift-0.5.1 ext/swift.h
swift-0.5.0 ext/swift.h