ext/statement.cc in swift-0.11.0 vs ext/statement.cc in swift-0.12.0
- old
+ new
@@ -96,14 +96,21 @@
CATCH_DBI_EXCEPTIONS();
return Qnil;
}
+VALUE statement_command(VALUE self) {
+ return rb_iv_get(self, "@sql");
+}
+
void init_swift_statement() {
VALUE mSwift = rb_define_module("Swift");
cSwiftStatement = rb_define_class_under(mSwift, "Statement", rb_cObject);
rb_define_method(cSwiftStatement, "execute", RUBY_METHOD_FUNC(statement_execute), -1);
rb_define_method(cSwiftStatement, "initialize", RUBY_METHOD_FUNC(statement_initialize), 2);
rb_define_method(cSwiftStatement, "insert_id", RUBY_METHOD_FUNC(statement_insert_id), 0);
+ rb_define_method(cSwiftStatement, "command", RUBY_METHOD_FUNC(statement_command), 0);
+
+ rb_define_alias(cSwiftStatement, "to_s", "command");
rb_define_alloc_func(cSwiftStatement, statement_alloc);
}