This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static VALUE | |
| pgconn_async_exec(obj, str) | |
| VALUE obj, str; | |
| { | |
| PGconn *conn = get_pgconn(obj); | |
| PGresult *result; | |
| char *msg; | |
| int cs; | |
| int ret; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'mysqlplus' | |
| ActiveRecord::ConnectionAdapters::MysqlAdapter.class_eval do | |
| def execute(sql, name = nil) #:nodoc: | |
| if @connection.respond_to?(:send_query) | |
| log(sql, "Async result #{name || ''}") { @connection.async_query(sql) } | |
| else | |
| log(sql, name) { @connection.query(sql) } | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/ext/extconf.rb b/ext/extconf.rb | |
| index d14738e..73bef6d 100644 | |
| --- a/ext/extconf.rb | |
| +++ b/ext/extconf.rb | |
| @@ -71,4 +71,4 @@ File.open('error_const.h', 'w') do |f| | |
| end | |
| end | |
| -create_makefile("mysql") | |
| +create_makefile("mysql") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static VALUE mysqlres2obj(MYSQL_RES* res) | |
| { | |
| VALUE obj; | |
| struct mysql_res* resp; | |
| obj = Data_Make_Struct(cMysqlRes, struct mysql_res, 0, free_mysqlres, resp); | |
| rb_iv_set(obj, "colname", Qnil); | |
| rb_iv_set(obj, "tblcolname", Qnil); | |
| resp->res = res; | |
| resp->freed = Qfalse; | |
| rb_obj_call_init(obj, 0, NULL); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static void schedule_query(VALUE obj, VALUE timeout) | |
| { | |
| MYSQL* m = GetHandler(obj); | |
| fd_set read; | |
| timeout = ( NIL_P(timeout) ? m->net.read_timeout : INT2NUM(timeout) ); | |
| struct timeval tv = { tv_sec: timeout, tv_usec: 0 }; | |
| FD_ZERO(&read); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/sbin/dtrace -Zs | |
| /* | |
| * rb_syscalls.d - count Ruby calls and syscalls using DTrace. | |
| * Written for the Ruby DTrace provider. | |
| * | |
| * $Id: rb_syscalls.d 20 2007-09-12 09:28:22Z brendan $ | |
| * | |
| * USAGE: rb_syscalls.d { -p PID | -c cmd } # hit Ctrl-C to end | |
| * | |
| * FIELDS: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #abstract/database_statements.rb | |
| # Returns the last auto-generated ID from the affected table. | |
| def insert_sql(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil) | |
| execute(sql, name) | |
| id_value | |
| end | |
| #mysql_adapter.rb | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'rubygems' | |
| require 'activesupport' | |
| z = returning( "" ) do |html| | |
| html += "stuff" | |
| html += "more stuff" if true | |
| end | |
| z = returning( [] ) do |html| | |
| html << "stuff" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Class | |
| def publicize_methods! | |
| hidden_methods = self.private_instance_methods + self.protected_instance_methods | |
| self.class_eval { public *hidden_methods } | |
| end | |
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module ActiveResource | |
| class Base | |
| protected | |
| alias :original_create :create | |
| def create( attributes = {} ) | |
| self.attributes = attributes | |
| original_create |