GithubHelp home page GithubHelp logo

fb's People

Contributors

dkru avatar fernandobatels avatar golirev avatar legiar avatar mariuz avatar promfin avatar rowland avatar zedalaye avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

fb's Issues

Segfaulting on database connection

I'm running fb (0.7.4) with Ruby 2.0.0-p576 (x64) on a Windows 8 machine. When I attempt to connect to a database, Ruby sefgaults with no obviously useful information.

Read Uncommitted: Illegal transaction option was specified

READ UNCOMMITTED transactions don't seem to work. I get an error Illegal transaction option was specified.

require 'fb'
db = Fb::Database.new(database: "localhost:#{File.expand_path('../db/example.fdb', __FILE__)}")
conn = db.connect rescue db.create.connect

begin
  conn.execute("CREATE TABLE TEST (NAME VARCHAR(20))") if !conn.table_names.include?("TEST")
  conn.transaction 'READ UNCOMMITTED'
  conn.execute("INSERT INTO TEST VALUES (?)", 'Test')
  conn.commit
ensure
  conn.close
end

drivertest.fdb not present

The tests run against what looks like a demo database (drivertest.fdb). I don't see that in the repo or in my firebird installation, but I'd be interested in seeing if I can get the tests running. Can you add the file to the repo?

Thanks,
Patrick

clean codebase

Hi Rowland, after my first incursion with this gem (and a ruby c extension) I'm thinking a few ways to improve the gem aesthetically speaking to encourage collaboration so it's no so intimidating to newcomers:

  • fb.c is too long (3200 LOC), why not separate it by class?
  • set on a standard for whitespace: remove tabs and set on 2 or 4 spaces width?
  • remove trailing whitespaces
  • remove old commented code
  • better format for README, also with instructions how to colaborate (or a link maybe)

So, the codebase will remain the same.. what do you think? I can have a pull requests in the near future if you agree.

By the way, are you going to bump version to 0.8 and push to rubygems master?

rake LoadError 126

Something is wrong with fb on my pc. LoadError: 126: �� ������ ��������� ������. - C:/Ruby23/lib/ruby/gems/2.3.0/gems/fb-0.8.0/fb.so
I tried to user different versions of ruby, but it didn't helped.

Failed to build gem native extension on El Capitan

I tried with both Ruby 2.2.4 and 2.3.0, to install this gem. Here's the output I get:

/Users/Glenn/.rvm/rubies/ruby-2.2.4/bin/ruby -r ./siteconf20160307-31590-1kd5a3y.rb extconf.rb
checking for isc_attach_database() in -lfbclient... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/Users/Glenn/.rvm/rubies/ruby-2.2.4/bin/$(RUBY_BASE_NAME)
    --with-firebird-dir
    --without-firebird-dir
    --with-firebird-include
    --without-firebird-include=${firebird-dir}/include
    --with-firebird-lib
    --without-firebird-lib=${firebird-dir}/lib
    --with-fbclientlib
    --without-fbclientlib
/Users/Glenn/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /Users/Glenn/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:541:in `try_link0'
    from /Users/Glenn/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:556:in `try_link'
    from /Users/Glenn/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:735:in `try_func'
    from /Users/Glenn/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:966:in `block in have_library'
    from /Users/Glenn/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:911:in `block in checking_for'
    from /Users/Glenn/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:351:in `block (2 levels) in postpone'
    from /Users/Glenn/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:321:in `open'
    from /Users/Glenn/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:351:in `block in postpone'
    from /Users/Glenn/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:321:in `open'
    from /Users/Glenn/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:347:in `postpone'
    from /Users/Glenn/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:910:in `checking_for'
    from /Users/Glenn/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:961:in `have_library'
    from extconf.rb:71:in `block in <main>'
    from extconf.rb:71:in `each'
    from extconf.rb:71:in `find'
    from extconf.rb:71:in `<main>'

extconf failed, exit code 1

Before this I followed the instructions here: http://www.firebirdsql.org/file/documentation/papers_presentations/html/paper-fb-macosx-install.html

Which led me to download the latest Mac version here:
https://sourceforge.net/projects/firebird/files/

Are there other instructions I need to follow in order to get this installed? Please advise, thank you!

Problems connecting to firebird 3

Since it seems that issue #58 seems to be merged I make a new issue here.

I am trying to connect to a firebird 3 and am always getting an error (Firebird error unknown ISC error 335545106) which, after some research seems to be an authentication error. The firebird.log is also telling me, that the auth plugin not supported by network protocol
I have configured the db to use legacy_auth but still nothing changed. Do I have to configure something else as well?

reading of decimal(18, 5) gets corrupted

I've been caught by a very strange bug at my production server related to decimal fields:

  • Reading values bigger than 20000 (aprox) gets trash.
  • The issue only occurs with decimal(18, 5) fields.. but decimal(18, 2) fields work fine, haven't tested others.
  • The data is well written and correct at the db, I can check that using isql directly, the problem is when is read by fb.
  • I'm pretty sure the bug lurks at the fb gem (isql works fine and fb-activerecord-adapter is bypassed).
  • Strange enough I wasn't able to reproduce this bug at my dev machine.. but I've found why: it's a x86_64 architecture, and my production server is x86.
  • decimal(18, x) gets stored as 64bit integers, I think that fb is messing the math of the scale in some way that only affects 32bits arquitectures.
  • Maybe "static VALUE fb_cursor_fetch(struct FbCursor *fb_cursor)" at fb.c@1961 is the culprit ? Maybe the conditional compilation switched by HAVE_LONG_LONG is related?

How to reproduce (32bit architecture needed):

require 'fb'
include Fb
db = Database.new(:database => "#{File.expand_path(File.dirname(__FILE__))}/test.fdb", :username => 'sysdba', :password => 'masterkey')
conn = db.connect rescue db.create.connect
conn.execute("create table TEST (ID int not null primary key, N decimal(18, 5))") if !conn.table_names.include?("TEST")
conn.execute("delete from TEST")
conn.execute("insert into TEST values (?, ?)", 1, 50000)
puts "50000 = #{conn.query(:hash, "select * from TEST").first['N']} ?"

At my production server I get:
"50000 = 7050.32704 ?"
and at my dev machine of course:
"50000 = 50000.0 ?"

Fb for Ruby 1.9.1

Hello,

[2010-04-06 17:17:21] GEM_HOME='/Users/andrelima/.rvm/gems/ruby-1.9.1-p378' GEM_PATH='/Users/andrelima/.rvm/gems/ruby-1.9.1-p378/bin:/Users/andrelima/.rvm/gems/ruby-1.9.1-p378@global/bin' BUNDLE_PATH='/Users/andrelima/.rvm/gems/ruby-1.9.1-p378' gem install --ignore-dependencies fb
ERROR: Error installing fb:
ERROR: Failed to build gem native extension.

/Users/andrelima/.rvm/rubies/ruby-1.9.1-p378/bin/ruby extconf.rb
checking for isc_attach_database() in -lfbclient... no
checking for isc_attach_database() in -lgds... no
creating Makefile

make
gcc -I. -I/Users/andrelima/.rvm/rubies/ruby-1.9.1-p378/include/ruby-1.9.1/i386-darwin10.3.0 -I/Users/andrelima/.rvm/rubies/ruby-1.9.1-p378/include/ruby-1.9.1/ruby/backward -I/Users/andrelima/.rvm/rubies/ruby-1.9.1-p378/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/Library/Frameworks/Firebird.framework/Headers -fno-common -O2 -g -Wall -Wno-parentheses -pipe -fno-common -DOS_UNIX -o fb.o -c fb.c
fb.c:24:16: error: re.h: No such file or directory
fb.c: In function ‘fb_connection_close_cursors’:
fb.c:492: error: ‘struct RArray’ has no member named ‘len’
fb.c:493: error: ‘struct RArray’ has no member named ‘ptr’
fb.c: In function ‘fb_connection_drop_cursors’:
fb.c:501: error: ‘struct RArray’ has no member named ‘len’
fb.c:502: error: ‘struct RArray’ has no member named ‘ptr’
fb.c:504: error: ‘struct RArray’ has no member named ‘len’
fb.c: In function ‘trans_parseopts’:
fb.c:920: warning: format not a string literal and no format arguments
fb.c: In function ‘fb_cursor_set_inputparams’:
fb.c:1499: error: ‘struct RString’ has no member named ‘len’
fb.c:1501: error: ‘struct RString’ has no member named ‘len’
fb.c:1503: error: ‘struct RString’ has no member named ‘ptr’
fb.c:1503: error: ‘struct RString’ has no member named ‘len’
fb.c:1503: error: ‘struct RString’ has no member named ‘ptr’
fb.c:1503: error: ‘struct RString’ has no member named ‘len’
fb.c:1504: error: ‘struct RString’ has no member named ‘len’
fb.c:1514: error: ‘struct RString’ has no member named ‘len’
fb.c:1516: error: ‘struct RString’ has no member named ‘len’
fb.c:1518: error: ‘struct RString’ has no member named ‘ptr’
fb.c:1518: error: ‘struct RString’ has no member named ‘len’
fb.c:1518: error: ‘struct RString’ has no member named ‘ptr’
fb.c:1518: error: ‘struct RString’ has no member named ‘len’
fb.c:1519: error: ‘struct RString’ has no member named ‘len’
fb.c:1621: error: ‘struct RString’ has no member named ‘len’
fb.c:1622: error: ‘struct RString’ has no member named ‘ptr’
fb.c: In function ‘fb_cursor_execute_withparams’:
fb.c:1710: error: ‘struct RArray’ has no member named ‘len’
fb.c:1710: error: ‘struct RArray’ has no member named ‘ptr’
fb.c:1711: error: ‘struct RArray’ has no member named ‘len’
fb.c:1721: error: ‘struct RArray’ has no member named ‘len’
fb.c:1721: error: ‘struct RArray’ has no member named ‘ptr’
fb.c: In function ‘fb_cursor_fields_hash’:
fb.c:1850: error: ‘struct RArray’ has no member named ‘len’
fb.c: In function ‘fb_cursor_fetch’:
fb.c:2060: error: ‘struct RString’ has no member named ‘ptr’
fb.c:2074: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long int’
fb.c: In function ‘cursor_execute2’:
fb.c:2202: error: ‘struct RArray’ has no member named ‘len’
fb.c:2202: error: ‘struct RArray’ has no member named ‘ptr’
fb.c:2222: error: ‘struct RArray’ has no member named ‘len’
fb.c:2222: error: ‘struct RArray’ has no member named ‘ptr’
fb.c: In function ‘fb_hash_from_ary’:
fb.c:2304: error: ‘struct RArray’ has no member named ‘len’
fb.c: In function ‘cursor_drop’:
fb.c:2467: error: ‘struct RArray’ has no member named ‘len’
fb.c:2468: error: ‘struct RArray’ has no member named ‘ptr’
fb.c:2469: error: ‘struct RArray’ has no member named ‘ptr’
fb.c: In function ‘connection_columns’:
fb.c:2709: error: ‘RE_OPTION_IGNORECASE’ undeclared (first use in this function)
fb.c:2709: error: (Each undeclared identifier is reported only once
fb.c:2709: error: for each function it appears in.)
fb.c:2726: error: ‘struct RArray’ has no member named ‘len’
fb.c: In function ‘connection_index_columns’:
fb.c:2785: error: ‘struct RArray’ has no member named ‘len’
fb.c: In function ‘connection_indexes’:
fb.c:2815: error: ‘struct RArray’ has no member named ‘len’
fb.c: In function ‘hash_from_connection_string’:
fb.c:2884: warning: implicit declaration of function ‘rb_reg_regcomp’
fb.c:2889: error: ‘struct RArray’ has no member named ‘len’
fb.c:2892: error: ‘struct RArray’ has no member named ‘len’
make: *** [fb.o] Error 1

Gem files will remain installed in /Users/andrelima/.rvm/gems/ruby-1.9.1-p378/gems/fb-0.6.7 for inspection.
Results logged to /Users/andrelima/.rvm/gems/ruby-1.9.1-p378/gems/fb-0.6.7/gem_make.out

Thanks

Andre Lima

wrong ELF class: ELFCLASS32

/usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in require': /usr/local/rvm/gems/ruby-1.9.2-p290/gems/fireruby-0.4.3-x86-linux/lib/fr_lib.so: wrong ELF class: ELFCLASS32 - /usr/local/rvm/gems/ruby-1.9.2-p290/gems/fireruby-0.4 .3-x86-linux/lib/fr_lib.so (LoadError) from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:inrequire'
from /usr/local/rvm/gems/ruby-1.9.2-p290/gems/fireruby-0.4.3-x86-linux/lib/fireruby.rb:21:in <top (required)>' from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:inrequire'
from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:59:in rescue in require' from /usr/local/rvm/rubies/ruby-1.9.2-p290/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:35:inrequire'
from ./fireruby.rb:4:in `

'

Get cursor's name to run update where current of queries

It would be efficient to have a name attribute for the Fb::Cursor object so that we can run such queries :

cnx.execute('select * from table for update with lock') do |cursor|
  cnx.execute("update table set... where current of #{cursor.name}")
end

The new BOOLEAN datatype doesn't work in fb...

I'm trying Firebird 3 and in a Select statement if it includes a Boolean column I get the next error:

Specified table includes unsupported datatype (32764) (Fb::Error)

Please add support for the Boolean data type.

Thank tou.

wrong report of unique property in connection#indexes

The schema reversal of a rails production database started giving problems, all indexes thata were not unique started being reported as unique. But the development db worked fine.. after some research I was able to track the bug to connection#indexes:

  1. RDB$INDICES.RDB$UNIQUE holds the interesting property
  2. when FB first creates a not unique index, it fills the value with null, and everything works fine (it get's reported as not unique)
  3. but for some reason, after a backup-restore cycle, this value gets changed to '0'
  4. this has been reported here: [http://tracker.firebirdsql.org/browse/CORE-933;jsessionid=EBB3F797BE85B7CF5A6E6199ED6BB064?actionOrder=desc] but it's not a bug, just an inconsistency: "in system tables null and '0' it's the same".

fb.c line 2904

unique = RTEST(unique) ? Qtrue : Qfalse;
descending = RTEST(descending) ? Qtrue : Qfalse;

So if according to what I've read online RTEST is the same that "if" for ruby, the problem is that 0 is being evaluated to true: it should test for null or 0.

Maybe this is affecting descending also and other system table tests..

Sorry easy fix but I'm not confident touching c ruby

error when pulling fb gem down with bundler

I am trying to pull down the gem code directly with the bundler and am currently getting the following error:

Updating https://github.com/rowland/fb.git
Fetching source index for http://rubygems.org/
Could not find gem 'fb (>= 0, runtime)' in https://github.com/rowland/fb.git (at master).
Source does not contain any versions of 'fb (>= 0, runtime)'

This seems strange to me because there is a valid .gemspec file

gem 'sqlite3-ruby', :require => 'sqlite3'
gem 'nokogiri'
gem 'fb', :git=>'https://github.com/rowland/fb.git'
group :development,:test do
gem "rspec-rails", "2.4.0"

end

What does generally cause the "Dropped db cursor" error?

I'm using this gem in production alongside with Sinatra, ActiveRecord and Puma. Puma is running with 2 workers.

My code for database queries is identical to the following snippet:

database_connections =  YAML.load_file('./databases_list.yml')

database_connections.each do |connection_info|
  connection = ActiveRecord::Base.establish_connection(connection_info)
  connection.execute('SELECT * FROM ...')
  # Other SQL queries here
  connection.disconnect!
end

I have a list of identical databases (running on distinct servers) that I have to connect to and collect some data. But I'm suspecting I'm doing something terribly wrong, as when this code gets executed, the ruby interpreter raises a Dropped DB Cursor exception.

Do you have any idea of what can be possibly causing this error?

Cannot install gem with Ruby 2.0 preview...

Ruby version: ruby 2.0.0dev (2012-11-01 trunk 37411) [i686-linux]

I get this error:

Building native extensions. This could take a while...
ERROR: Error installing fb:
ERROR: Failed to build gem native extension.

    /usr/local/bin/ruby extconf.rb

checking for isc_attach_database() in -lfbclient... yes
creating Makefile

make
compiling fb.c
fb.c: In function ‘tm_from_timestamp’:
fb.c:321:22: warning: unused variable ‘tobj’ [-Wunused-variable]
fb.c: In function ‘fb_cursor_set_inputparams’:
fb.c:1503:7: warning: variable ‘type’ set but not used [-Wunused-but-set-variable]
linking shared-object fb.so

make install
/usr/bin/install -c -m 0755 fb.so /usr/local/lib/ruby/gems/2.0.0/gems/fb-0.7.0/.
/usr/bin/install: fb.so' and/usr/local/lib/ruby/gems/2.0.0/gems/fb-0.7.0/./fb.so' are the same file
make: *** [install-so] Error 1

Gem files will remain installed in /usr/local/lib/ruby/gems/2.0.0/gems/fb-0.7.0 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.0.0/gems/fb-0.7.0/./gem_make.out

Annoying warning with ruby 2.6.3

Hello
We have some warning using gem with new ruby version:
warning: BigDecimal.new is deprecated; use BigDecimal() method instead.

Everything works fine but its some annoying...
Might you check?
Thank you!

Error when installing on Windows 10

When installing using bundler or using gem install fb -v '0.9.0' --source 'https://rubygems.org/' I get the following error even though I have Firebird installed:
ERROR: Error installing fb:
ERROR: Failed to build gem native extension.
current directory: C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/fb-0.9.0
C:/RailsInstaller/Ruby2.3.3/bin/ruby.exe -r ./siteconf20190422-7048-1hqvyu5.rb extconf.rb
No any Firebird instances found in system.

Makefile not found

Gem files will remain installed in C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/fb-0.9.0 for inspection.
Results logged to C:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/extensions/x86-mingw32/2.3.0/fb-0.9.0/gem_make.out

Statement loses parameters

As title says we're experiencing weird behaviour when passed parameters do not reach database itself.
I've made some research, but got nothing so far.
Our exec_query method is:

        def exec_query(sql, name = 'SQL', binds = [], prepare: false)
          type_casted_binds = type_casted_binds(binds)

          log(sql, name, binds, type_casted_binds) do
            ActiveSupport::Dependencies.interlock.permit_concurrent_loads do
              result = @connection.execute(sql, *type_casted_binds)
              if result.is_a?(Fb::Cursor)
                fields = result.fields.map(&:name)
                rows = result.fetchall.map do |row|
                  row.map do |col|
                    col.encode('UTF-8', @connection.encoding)
                  rescue StandardError
                    col
                  end
                end
                result.close
                ActiveRecord::Result.new(fields, rows)
              else
                result
              end
            rescue => e
              result.close if result && result.is_a?(Fb::Cursor)
              raise e
            end
          end
        end

Rails correctly passes sql statement and its parameters to connection_execute method:

[DEBUG 2020-03-20 11:36:25.9990 #28337] :    IssueStatus Load (1.0ms)  SELECT "ISSUE_STATUSES".* FROM "ISSUE_STATUSES" WHERE "ISSUE_STATUSES"."ID" = ?  [["id", 5]]

Before executing a sqlvar had parameter value, but eventually IB API executing query without params:

2020-03-20T11:36:25.9980 (49:0x7f4e18fb4040) EXECUTE_STATEMENT_FINISH
	test (ATT_13, SYSDBA:NONE, UTF8, TCPv4:xx.xx.xx.xx/56944)
	/home/makurin/.rbenv/versions/2.5.3/bin/ruby:28337
		(TRA_71263, READ_COMMITTED | NO_REC_VERSION | NOWAIT | READ_WRITE)

Statement 285585:
-------------------------------------------------------------------------------
SELECT "ISSUE_STATUSES".* FROM "ISSUE_STATUSES" WHERE "ISSUE_STATUSES"."ID" = ?

param0 = integer, "<NULL>"

0 records fetched
      0 ms, 2 fetch(es)

I have kinda reproducible test case, but I'm not familiar with C or ruby C API. Do you have any ideas what could causes it?

Can't install on OSX Mavericks

I have Firebird CS-2.5.2-26540-0-lipo-x86_64 installed at /Library/Frameworks/Firebird.framework. Before I upgraded to Mavericks, I had no trouble installing.

Here's mkmf.log:

"/usr/bin/clang -o conftest -I/Users/ray/.rvm/rubies/ruby-2.0.0-p353/include/ruby-2.0.0/x86_64-darwin13.0.0 -I/Users/ray/.rvm/rubies/ruby-2.0.0-p353/include/ruby-2.0.0/ruby/backward -I/Users/ray/.rvm/rubies/ruby-2.0.0-p353/include/ruby-2.0.0 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl/include   -I/Library/Frameworks/Firebird.framework/Headers  -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration  -fno-common -pipe -DOS_UNIX conftest.c  -L. -L/Users/ray/.rvm/rubies/ruby-2.0.0-p353/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib -L. -fstack-protector -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl/lib  -framework Firebird     -lruby.2.0.0  -lpthread -ldl -lobjc "
ld: framework not found Firebird
clang: error: linker command failed with exit code 1 (use -v to see invocation)
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

Strings are always ASCII-8BIT...

The adapter ignores the default charset, if I use utf8 It should return UTF-8 encoded strings, but It always returns ASCII-8BIT strings.

This is a problem concatenating strings in Ruby, becase UTF-8 and ASCII-8BIT are not compatible, for example this causes an error if the string containts any of the characters á é í ó ú.

"Hello" + data["my_string"]

I need to do this

"Hello" + data["my_string"].force_encoding("UTF-8")

Doing this is tedious, specially in Sinatra applications.

Ruby 2.0.0(x64) Segmentation fault

I have an application that runs under Ruby 2.0.0-p648 (x64).
After configuring Devkit (x64), installing Firebird 2.5 (x64):
I successfully install the gem.

But by running the simple test:
require 'fb' include Fb db = Database.new( :database => "localhost:d:/readme.fdb", :username => 'sysdba', :password => 'masterkey') conn = db.connect rescue db.create.connect

I get the following generic error: conn = db.connect ... [BUG] Segmentation fault #38
The error also happens in a clean install of the measured versions.

If I do the same steps however everything on x86 (Ruby 2.0.0-p648 (x86), Devkit (x86), Firebird 2.5 (x86)) the code runs normally.
I've checked in many ways for the correct DLL installed on each version of Firebird.

Today I can't upgrade Ruby as there is a large application running with this specific version.

Any suggestions on how to make it work?
Thank you.

Cannot install on Windows 7 64 / Firebird 64...

I get this error while trying to install it on Windows 64 with Firebird 2.5.1 64, this is the log using the latest source

C:/Ruby192/bin/ruby -e "puts 'EXPORTS', 'Init_fb'" > fb-i386-mingw32.def
gcc -I. -IC:/Ruby192/include/ruby-1.9.1/i386-mingw32 -I/C/Ruby192/include/ruby-1
.9.1/ruby/backward -I/C/Ruby192/include/ruby-1.9.1 -I. "-IC:\Program Files\Fireb
ird\Firebird_2_5/include" -O3 -g -Wextra -Wno-unused-parameter -Wno-parenthe
ses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wno-long-lo
ng -DOS_WIN32 -o fb.o -c fb.c
gcc -shared -s -o fb.so fb.o -L. -LC:/Ruby192/lib -L"C:\Program Files\Firebird\F
irebird_2_5/lib" -L. -Wl,--enable-auto-image-base,--enable-auto-import fb-i386
-mingw32.def -lmsvcrt-ruby191 -lfbclient_ms -lshell32 -lws2_32
c:/rubydevelopment/mingw/bin/../lib/gcc/mingw32/4.5.1/../../../../mingw32/bin/ld
.exe: C:\Program Files\Firebird\Firebird_2_5/lib/fbclient_ms.lib(fbclient.dll):
Recognised but unhandled machine type (0x8664) in Import Library Format archive

fb.o: In function fb_error_check': C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:479: undefined reference toi
sc_sqlcode@4'
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:481: undefined reference to i sc_sql_interprete@12' fb.o: In functionfb_error_msg':
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:221: undefined reference to f b_interpret@12' fb.o: In functionfb_cursor_drop':
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:1460: undefined reference to isc_dsql_free_statement@12' C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:1457: undefined reference to
isc_dsql_free_statement@12'
fb.o: In function fb_error_check_warn': C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:495: undefined reference toi
sc_sqlcode@4'
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:498: undefined reference to i sc_sql_interprete@12' fb.o: In functionfb_cursor_drop_warn':
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:1471: undefined reference to isc_dsql_free_statement@12' C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:1468: undefined reference to
isc_dsql_free_statement@12'
fb.o: In function fb_connection_disconnect_warn': C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:608: undefined reference toi
sc_commit_transaction@8'
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:611: undefined reference to i sc_detach_database@8' fb.o: In functionfb_connection_db_SQL_Dialect':
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:649: undefined reference to i sc_database_info@24' C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:655: undefined reference toi
sc_vax_integer@8'
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:656: undefined reference to i sc_vax_integer@8' fb.o: In functiondatabase_create':
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:3012: undefined reference to isc_dsql_execute_immediate@28' C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:3020: undefined reference to
isc_detach_database@8'
fb.o: In function fb_connection_disconnect': C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:593: undefined reference toi
sc_commit_transaction@8'
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:597: undefined reference to i sc_drop_database@8' C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:599: undefined reference toi
sc_detach_database@8'
fb.o: In function cursor_close': C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:2467: undefined reference to
isc_dsql_free_statement@12'
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:2469: undefined reference to isc_dsql_free_statement@12' C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:2473: undefined reference to
isc_commit_transaction@8'
fb.o: In function fb_cursor_fetch_prep': C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:1922: undefined reference to
isc_dsql_describe@16'
fb.o: In function fb_cursor_fetch': C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:1983: undefined reference to
isc_dsql_fetch@16'
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:2077: undefined reference to isc_open_blob2@28' C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:2079: undefined reference to
isc_blob_info@24'
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:2086: undefined reference to isc_vax_integer@8' C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:2090: undefined reference to
isc_vax_integer@8'
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:2102: undefined reference to isc_get_segment@20' C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:2105: undefined reference to
isc_close_blob@8'
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:2062: undefined reference to isc_decode_sql_time@8' C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:2093: undefined reference to
isc_vax_integer@8'
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:2096: undefined reference to isc_vax_integer@8' C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:2070: undefined reference to
isc_decode_sql_date@8'
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:2057: undefined reference to isc_decode_timestamp@8' fb.o: In functionconnection_cursor':
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:1291: undefined reference to isc_dsql_alloc_statement2@12' fb.o: In functiondatabase_connect':
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:3062: undefined reference to isc_attach_database@24' fb.o: In functionfb_connection_disconnect':
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:593: undefined reference to i sc_commit_transaction@8' C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:599: undefined reference toi
sc_detach_database@8'
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:597: undefined reference to i sc_drop_database@8' fb.o: In functionfb_cursor_set_inputparams':
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:1664: undefined reference to isc_create_blob2@28' C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:1671: undefined reference to
isc_put_segment@16'
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:1680: undefined reference to isc_close_blob@8' C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:1707: undefined reference to
isc_encode_sql_date@8'
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:1691: undefined reference to isc_encode_timestamp@8' C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:1699: undefined reference to
isc_encode_sql_time@8'
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:1677: undefined reference to isc_put_segment@16' fb.o: In functionfb_cursor_execute_withparams':
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:1780: undefined reference to isc_dsql_execute2@24' C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:1771: undefined reference to
isc_dsql_execute2@24'
fb.o: In function fb_connection_commit': C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:1148: undefined reference to
isc_commit_transaction@8'
fb.o: In function fb_connection_rollback': C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:1157: undefined reference to
isc_rollback_transaction@8'
fb.o: In function cursor_execute2': C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:2194: undefined reference to
isc_dsql_prepare@28'
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:2198: undefined reference to isc_dsql_sql_info@24' C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:2210: undefined reference to
isc_dsql_describe_bind@16'
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:2213: undefined reference to isc_dsql_describe@16' C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:2268: undefined reference to
isc_dsql_execute2@24'
fb.o: In function cursor_rows_affected': C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:2132: undefined reference to
isc_dsql_sql_info@24'
fb.o: In function cursor_execute2': C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:2222: undefined reference to
isc_dsql_describe_bind@16'
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:2259: undefined reference to isc_dsql_describe@16' C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:2204: undefined reference to
isc_vax_integer@8'
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:2205: undefined reference to isc_vax_integer@8' fb.o: In functioncursor_rows_affected':
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:2139: undefined reference to isc_vax_integer@8' C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:2152: undefined reference to
isc_vax_integer@8'
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:2143: undefined reference to isc_vax_integer@8' fb.o:C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:2149: more undefined refe rences toisc_vax_integer@8' follow
fb.o: In function cursor_execute2': C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:2246: undefined reference to
isc_dsql_execute2@24'
fb.o: In function cursor_execute': C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:2309: undefined reference to
isc_dsql_free_statement@12'
fb.o: In function fb_connection_transaction_start': C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:1139: undefined reference to
isc_start_transaction'
fb.o: In function fb_connection_rollback': C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:1157: undefined reference to
isc_rollback_transaction@8'
fb.o: In function fb_connection_commit': C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:1148: undefined reference to
isc_commit_transaction@8'
fb.o: In function database_connect': C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:3062: undefined reference to
isc_attach_database@24'
fb.o: In function database_drop': C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:3103: undefined reference to
isc_drop_database@8'
fb.o: In function database_connect': C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:3062: undefined reference to
isc_attach_database@24'
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:3062: undefined reference to isc_attach_database@24' fb.o: In functiondatabase_drop':
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:3103: undefined reference to isc_drop_database@8' fb.o: In functionfb_connection_transaction_start':
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:1139: undefined reference to isc_start_transaction' fb.o: In functionfb_connection_rollback':
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:1157: undefined reference to isc_rollback_transaction@8' fb.o: In functionfb_connection_commit':
C:\Ruby192\lib\ruby\gems\1.9.1\gems\fb-0.6.8/fb.c:1148: undefined reference to `
isc_commit_transaction@8'
collect2: ld returned 1 exit status
make: *** [fb.so] Error 1

Gem files will remain installed in C:/Ruby192/lib/ruby/gems/1.9.1/gems/fb-0.6.8
for inspection.
Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/gems/fb-0.6.8/./gem_make.out

numeric(15, 4) column type returns wrong value

Having a column declared numeric(15, 4) the correct values are inserted into the database, but select the column return incorrect value. E.g. if I insert 100 then that is what is stored in the database, but when selecting it fb returns 1000000

Firebird 2.0.4
OS: Suse 11.1

How to create a rails Model

Hello,

I have a program, it connects to MySQL and Firebird.
The default database is MySQL
How can i create a migration database using fb?

Insert with return clause broken in 0.9.0

When migrating code to a new server I found that code which works with 0.7.0 fails with 0.9.0. I tested to make sure it was not a ruby or firebird issue. The insert statement succeeds but attempting to retrieve the expected value from the cursor fails with: " The cursor identified in an OPEN statement is already open."

I had to change the PLATFORM const to RUBY_PLATFORM in order to build the gem

Hi Brent,

I tried to build the fb gem using RubyInstaller 1.9.2p136 + DevKit on Windows and the gem build command failed complaining that the PLATFORM const was not declared.

I had to change it to RUBY_PLATFORM to make the gem builder happy.

s.platform = case RUBY_PLATFORM
when /win32/ then Gem::Platform::WIN32
else
Gem::Platform::RUBY
end

Pierre

can't install on Mac OS X

FYI, I installed FirebirdSS-2.1.4-18393-x86_64.pkg.zip into /Library/Frameworks/Firebird.framework

I noticed that the install is looking for re.h. I'm not sure if that is supposed to be part of the Firebird install, but the /Library/Frameworks/Firebird.framework/Headers directory only contains:

cd /Library/Frameworks/Firebird.framework/Headers
lvoows07:Headers$ ll
total 624
drwxr-xr-x 6 firebird 204 Mar 14 07:52 ./
drwxr-xr-x 6 firebird 204 Mar 14 07:52 ../
-rw-r--r-- 1 firebird 1061 Mar 14 07:52 ib_util.h
-rw-r--r-- 1 firebird 202068 Mar 14 07:52 ibase.h
-rw-r--r-- 1 firebird 105754 Mar 14 07:52 iberror.h
-rw-r--r-- 1 firebird 2273 Mar 14 07:52 perf.h

Any help would be appreciated.

Thanks,

Steve
$ gem install fb
Building native extensions. This could take a while...
ERROR: Error installing fb:
ERROR: Failed to build gem native extension.

    /Users/snewell/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb

checking for isc_attach_database() in -lfbclient... no
checking for isc_attach_database() in -lgds... no
creating Makefile

make
gcc -I. -I/Users/snewell/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/x86_64-darwin10.7.0 -I/Users/snewell/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1/ruby/backward -I/Users/snewell/.rvm/rubies/ruby-1.9.2-p180/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -I/Library/Frameworks/Firebird.framework/Headers -fno-common -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -fno-common -pipe -DOS_UNIX -o fb.o -c fb.c
fb.c:24:16: error: re.h: No such file or directory
fb.c: In function ‘fb_sql_type_from_code’:
fb.c:322: warning: assignment discards qualifiers from pointer target type
fb.c:326: warning: assignment discards qualifiers from pointer target type
fb.c:331: warning: assignment discards qualifiers from pointer target type
fb.c:332: warning: assignment discards qualifiers from pointer target type
fb.c:333: warning: assignment discards qualifiers from pointer target type
fb.c:339: warning: assignment discards qualifiers from pointer target type
fb.c:340: warning: assignment discards qualifiers from pointer target type
fb.c:341: warning: assignment discards qualifiers from pointer target type
fb.c:346: warning: assignment discards qualifiers from pointer target type
fb.c:351: warning: assignment discards qualifiers from pointer target type
fb.c:352: warning: assignment discards qualifiers from pointer target type
fb.c:353: warning: assignment discards qualifiers from pointer target type
fb.c:358: warning: assignment discards qualifiers from pointer target type
fb.c:362: warning: assignment discards qualifiers from pointer target type
fb.c:366: warning: assignment discards qualifiers from pointer target type
fb.c:369: warning: assignment discards qualifiers from pointer target type
fb.c:373: warning: assignment discards qualifiers from pointer target type
fb.c:377: warning: assignment discards qualifiers from pointer target type
fb.c:381: warning: assignment discards qualifiers from pointer target type
fb.c:386: warning: assignment discards qualifiers from pointer target type
fb.c:387: warning: assignment discards qualifiers from pointer target type
fb.c:388: warning: assignment discards qualifiers from pointer target type
fb.c:393: warning: assignment discards qualifiers from pointer target type
fb.c: In function ‘fb_connection_close_cursors’:
fb.c:492: error: ‘struct RArray’ has no member named ‘len’
fb.c:493: error: ‘struct RArray’ has no member named ‘ptr’
fb.c: In function ‘fb_connection_drop_cursors’:
fb.c:501: error: ‘struct RArray’ has no member named ‘len’
fb.c:502: error: ‘struct RArray’ has no member named ‘ptr’
fb.c:504: error: ‘struct RArray’ has no member named ‘len’
fb.c: At top level:
fb.c:618: warning: initialization discards qualifiers from pointer target type
fb.c:618: warning: initialization discards qualifiers from pointer target type
fb.c:619: warning: initialization discards qualifiers from pointer target type
fb.c:620: warning: initialization discards qualifiers from pointer target type
fb.c:627: warning: initialization discards qualifiers from pointer target type
fb.c:628: warning: initialization discards qualifiers from pointer target type
fb.c:629: warning: initialization discards qualifiers from pointer target type
fb.c:636: warning: initialization discards qualifiers from pointer target type
fb.c:636: warning: initialization discards qualifiers from pointer target type
fb.c:637: warning: initialization discards qualifiers from pointer target type
fb.c:644: warning: initialization discards qualifiers from pointer target type
fb.c:645: warning: initialization discards qualifiers from pointer target type
fb.c:645: warning: initialization discards qualifiers from pointer target type
fb.c:652: warning: initialization discards qualifiers from pointer target type
fb.c:653: warning: initialization discards qualifiers from pointer target type
fb.c:654: warning: initialization discards qualifiers from pointer target type
fb.c:654: warning: initialization discards qualifiers from pointer target type
fb.c:655: warning: initialization discards qualifiers from pointer target type
fb.c:655: warning: initialization discards qualifiers from pointer target type
fb.c:656: warning: initialization discards qualifiers from pointer target type
fb.c:657: warning: initialization discards qualifiers from pointer target type
fb.c: In function ‘trans_parseopts’:
fb.c:696: warning: assignment makes pointer from integer without a cast
fb.c:745: warning: assignment discards qualifiers from pointer target type
fb.c:753: warning: assignment discards qualifiers from pointer target type
fb.c:768: warning: assignment discards qualifiers from pointer target type
fb.c:773: warning: assignment discards qualifiers from pointer target type
fb.c:777: warning: implicit conversion shortens 64-bit value into a 32-bit value
fb.c:788: warning: assignment discards qualifiers from pointer target type
fb.c:793: warning: implicit conversion shortens 64-bit value into a 32-bit value
fb.c:799: warning: implicit conversion shortens 64-bit value into a 32-bit value
fb.c:801: warning: implicit conversion shortens 64-bit value into a 32-bit value
fb.c:804: warning: assignment discards qualifiers from pointer target type
fb.c:828: warning: assignment discards qualifiers from pointer target type
fb.c:852: warning: assignment discards qualifiers from pointer target type
fb.c:866: warning: assignment discards qualifiers from pointer target type
fb.c:878: warning: assignment discards qualifiers from pointer target type
fb.c:915: warning: implicit conversion shortens 64-bit value into a 32-bit value
fb.c:920: warning: format not a string literal and no format arguments
fb.c: In function ‘fb_cursor_set_inputparams’:
fb.c:1499: error: ‘struct RString’ has no member named ‘len’
fb.c:1501: error: ‘struct RString’ has no member named ‘len’
fb.c:1503: error: ‘struct RString’ has no member named ‘ptr’
fb.c:1503: error: ‘struct RString’ has no member named ‘len’
fb.c:1503: error: ‘struct RString’ has no member named ‘ptr’
fb.c:1503: error: ‘struct RString’ has no member named ‘len’
fb.c:1504: error: ‘struct RString’ has no member named ‘len’
fb.c:1514: error: ‘struct RString’ has no member named ‘len’
fb.c:1516: error: ‘struct RString’ has no member named ‘len’
fb.c:1518: error: ‘struct RString’ has no member named ‘ptr’
fb.c:1518: error: ‘struct RString’ has no member named ‘len’
fb.c:1518: error: ‘struct RString’ has no member named ‘ptr’
fb.c:1518: error: ‘struct RString’ has no member named ‘len’
fb.c:1519: error: ‘struct RString’ has no member named ‘len’
fb.c:1561: warning: implicit conversion shortens 64-bit value into a 32-bit value
fb.c:1578: warning: implicit conversion shortens 64-bit value into a 32-bit value
fb.c:1621: error: ‘struct RString’ has no member named ‘len’
fb.c:1622: error: ‘struct RString’ has no member named ‘ptr’
fb.c: In function ‘fb_cursor_execute_withparams’:
fb.c:1710: error: ‘struct RArray’ has no member named ‘len’
fb.c:1710: error: ‘struct RArray’ has no member named ‘ptr’
fb.c:1711: error: ‘struct RArray’ has no member named ‘len’
fb.c:1721: error: ‘struct RArray’ has no member named ‘len’
fb.c:1721: error: ‘struct RArray’ has no member named ‘ptr’
fb.c: In function ‘fb_cursor_fields_hash’:
fb.c:1850: error: ‘struct RArray’ has no member named ‘len’
fb.c: In function ‘fb_cursor_fetch’:
fb.c:2017: warning: passing argument 2 of ‘fb_mktime’ discards qualifiers from pointer target type
fb.c:2025: warning: passing argument 2 of ‘fb_mktime’ discards qualifiers from pointer target type
fb.c:2060: error: ‘struct RString’ has no member named ‘ptr’
fb.c:2074: warning: format ‘%d’ expects type ‘int’, but argument 3 has type ‘long int’
fb.c: In function ‘cursor_execute2’:
fb.c:2149: warning: assignment makes pointer from integer without a cast
fb.c:2202: error: ‘struct RArray’ has no member named ‘len’
fb.c:2202: error: ‘struct RArray’ has no member named ‘ptr’
fb.c:2222: error: ‘struct RArray’ has no member named ‘len’
fb.c:2222: error: ‘struct RArray’ has no member named ‘ptr’
fb.c: In function ‘fb_hash_from_ary’:
fb.c:2304: error: ‘struct RArray’ has no member named ‘len’
fb.c: In function ‘cursor_drop’:
fb.c:2467: error: ‘struct RArray’ has no member named ‘len’
fb.c:2468: error: ‘struct RArray’ has no member named ‘ptr’
fb.c:2469: error: ‘struct RArray’ has no member named ‘ptr’
fb.c: In function ‘dbp_add_string’:
fb.c:2522: warning: implicit conversion shortens 64-bit value into a 32-bit value
fb.c: In function ‘connection_create_dbp’:
fb.c:2545: warning: passing argument 3 of ‘dbp_add_string’ makes pointer from integer without a cast
fb.c:2546: warning: passing argument 3 of ‘dbp_add_string’ makes pointer from integer without a cast
fb.c:2548: warning: passing argument 3 of ‘dbp_add_string’ makes pointer from integer without a cast
fb.c:2551: warning: passing argument 3 of ‘dbp_add_string’ makes pointer from integer without a cast
fb.c: At top level:
fb.c:2557: warning: initialization discards qualifiers from pointer target type
fb.c:2558: warning: initialization discards qualifiers from pointer target type
fb.c:2559: warning: initialization discards qualifiers from pointer target type
fb.c:2560: warning: initialization discards qualifiers from pointer target type
fb.c:2561: warning: initialization discards qualifiers from pointer target type
fb.c:2562: warning: initialization discards qualifiers from pointer target type
fb.c: In function ‘connection_table_names’:
fb.c:2634: warning: initialization discards qualifiers from pointer target type
fb.c: In function ‘connection_generator_names’:
fb.c:2647: warning: initialization discards qualifiers from pointer target type
fb.c: In function ‘connection_view_names’:
fb.c:2660: warning: initialization discards qualifiers from pointer target type
fb.c: In function ‘connection_role_names’:
fb.c:2671: warning: initialization discards qualifiers from pointer target type
fb.c: In function ‘connection_procedure_names’:
fb.c:2683: warning: initialization discards qualifiers from pointer target type
fb.c: In function ‘connection_trigger_names’:
fb.c:2695: warning: initialization discards qualifiers from pointer target type
fb.c: In function ‘connection_columns’:
fb.c:2709: error: ‘RE_OPTION_IGNORECASE’ undeclared (first use in this function)
fb.c:2709: error: (Each undeclared identifier is reported only once
fb.c:2709: error: for each function it appears in.)
fb.c:2720: warning: initialization discards qualifiers from pointer target type
fb.c:2726: error: ‘struct RArray’ has no member named ‘len’
fb.c: In function ‘connection_index_columns’:
fb.c:2776: warning: initialization discards qualifiers from pointer target type
fb.c:2785: error: ‘struct RArray’ has no member named ‘len’
fb.c: In function ‘connection_indexes’:
fb.c:2807: warning: initialization discards qualifiers from pointer target type
fb.c:2815: error: ‘struct RArray’ has no member named ‘len’
fb.c: In function ‘hash_from_connection_string’:
fb.c:2889: error: ‘struct RArray’ has no member named ‘len’
fb.c:2892: error: ‘struct RArray’ has no member named ‘len’
fb.c: In function ‘database_initialize’:
fb.c:2934: warning: passing argument 2 of ‘default_string’ discards qualifiers from pointer target type
fb.c:2934: warning: passing argument 3 of ‘default_string’ discards qualifiers from pointer target type
fb.c:2935: warning: passing argument 2 of ‘default_string’ discards qualifiers from pointer target type
fb.c:2935: warning: passing argument 3 of ‘default_string’ discards qualifiers from pointer target type
fb.c:2936: warning: passing argument 2 of ‘default_string’ discards qualifiers from pointer target type
fb.c:2936: warning: passing argument 3 of ‘default_string’ discards qualifiers from pointer target type
fb.c:2939: warning: passing argument 2 of ‘default_int’ discards qualifiers from pointer target type
fb.c: In function ‘database_connect’:
fb.c:3024: warning: passing argument 3 of ‘isc_attach_database’ makes pointer from integer without a cast
make: *** [fb.o] Error 1

dyld: Symbol not found: _isc_attach_database

On ruby 2.1.2 i've this error when i try to connect to db:

dyld: lazy symbol binding failed: Symbol not found: _isc_attach_database
Referenced from: /Users/squid/git/spherav2/vendor/bundle/extensions/x86_64-darwin-13/2.1.0-static/fb-0.7.2/fb.bundle
Expected in: flat namespace

Invalid page_size 16384

I teste rowland/fb, this don't allow 16484 page size.

fb.c(2888)
static void check_page_size(int page_size)
{
if (page_size != 1024 && page_size != 2048 && page_size != 4096 && page_size != 8192) {
rb_raise(rb_eFbError, "Invalid page size: %d", page_size);
}
}

is need fix:

static void check_page_size(int page_size)
{
if (page_size != 1024 && page_size != 2048 && page_size != 4096 && page_size != 8192 && page_size != 16384) {
rb_raise(rb_eFbError, "Invalid page size: %d", page_size);
}
}

Blobs are threted like strings, even if it is binary data...

I have blob field in a table where I store PDFs, there is no problem storing them, but when I retrieve a PDF from then blob field and save it to a file, the PDF file is corrupted, if I do table['pdf_field'].class I get "string", why? it is supposed to be binary.

This is the code to extract the PDF file from the field.

File.open(p_ruta_tmp, "w") do |f|
    f.write(p_adjunto[0]['adjunto_pdf'])
end

If I extract those fileds in C# the fields are extracted fine.

Thanks.

undefined symbol: isc_attach_database

Excited to find this gem, but I'm having trouble getting it to run. I installed version 0.7.4 via 'gem install fb', and it built the native extension without a problem.

When I try to run the README, though, it complains:

$ ruby README 
ruby: symbol lookup error: /home/patrick/.rvm/gems/ruby-2.2.1@fb/gems/fb-0.7.4/fb.so: undefined symbol: isc_attach_database

I think I have the required client installed:

$ ls /usr/lib/libfb*
/usr/lib/libfbclient.so  /usr/lib/libfbclient.so.1  /usr/lib/libfbclient.so.1.5.6  /usr/lib/libfbembed.so  /usr/lib/libfbembed.so.1  /usr/lib/libfbembed.so.1.5.6

... but perhaps not...

I tried building from source and I see this when running extconf.rb:

$ ruby extconf.rb
checking for isc_attach_database() in -lfbclient... no
checking for isc_attach_database() in -lgds... no
creating Makefile

I'm running 2.2.1 in RVM.

Any help would be greatly appreciated. This library will be a huge help to me :)

Possible to check for results before #fetch(:hash)? (segfault)

I'm getting a segfault if I do a query that has no results and then try to #fetch it. Is there a way to safely check if a result exists before doing a #fetch?

Thanks,
Patrick

For example (a result is found):

$ rails runner "p Firebird::Address._connection.execute('select ADDRESS_ID from TBL_ADDRESS where ADDRESS_ID = 1').fetch(:hash)"

{"ADDRESS_ID"=>1}

(no result found, segfault):

$ rails runner "p Firebird:Address._connection.execute('select ADDRESS_ID from TBL_ADDRESS where ADDRESS_ID = 9999').fetch(:hash)" 2>&1 | head -50

/home/patrick/.rvm/gems/ruby-2.2.1@workbench/gems/railties-4.2.0/lib/rails/commands/runner.rb:62: [BUG] Segmentation fault at 0x00000000000008
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux]

-- Control frame information -----------------------------------------------
c:0012 p:---- s:0045 e:000044 CFUNC  :fetch
c:0011 p:0022 s:0041 e:000039 EVAL   /home/patrick/.rvm/gems/ruby-2.2.1@workbench/gems/railties-4.2.0/lib/rails/commands/runner.rb:62 [FINISH]
c:0010 p:---- s:0038 e:000037 CFUNC  :eval
c:0009 p:0258 s:0031 E:000ff0 TOP    /home/patrick/.rvm/gems/ruby-2.2.1@workbench/gems/railties-4.2.0/lib/rails/commands/runner.rb:62 [FINISH]
c:0008 p:---- s:0027 e:000026 CFUNC  :require
c:0007 p:0014 s:0023 E:000968 METHOD /home/patrick/.rvm/gems/ruby-2.2.1@workbench/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:123
c:0006 p:0009 s:0019 E:0009f0 METHOD /home/patrick/.rvm/gems/ruby-2.2.1@workbench/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:90
c:0005 p:0033 s:0016 E:000a88 METHOD /home/patrick/.rvm/gems/ruby-2.2.1@workbench/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39
c:0004 p:0116 s:0012 E:001750 TOP    /home/patrick/.rvm/gems/ruby-2.2.1@workbench/gems/railties-4.2.0/lib/rails/commands.rb:17 [FINISH]
c:0003 p:---- s:0008 e:000007 CFUNC  :require
c:0002 p:0034 s:0004 E:0025d0 EVAL   bin/rails:4 [FINISH]
c:0001 p:0000 s:0002 E:000f00 TOP    [FINISH]

-- Ruby level backtrace information ----------------------------------------
bin/rails:4:in `<main>'
bin/rails:4:in `require'
/home/patrick/.rvm/gems/ruby-2.2.1@workbench/gems/railties-4.2.0/lib/rails/commands.rb:17:in `<top (required)>'
/home/patrick/.rvm/gems/ruby-2.2.1@workbench/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
/home/patrick/.rvm/gems/ruby-2.2.1@workbench/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:90:in `runner'
/home/patrick/.rvm/gems/ruby-2.2.1@workbench/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:123:in `require_command!'
/home/patrick/.rvm/gems/ruby-2.2.1@workbench/gems/railties-4.2.0/lib/rails/commands/commands_tasks.rb:123:in `require'
/home/patrick/.rvm/gems/ruby-2.2.1@workbench/gems/railties-4.2.0/lib/rails/commands/runner.rb:62:in `<top (required)>'
/home/patrick/.rvm/gems/ruby-2.2.1@workbench/gems/railties-4.2.0/lib/rails/commands/runner.rb:62:in `eval'
/home/patrick/.rvm/gems/ruby-2.2.1@workbench/gems/railties-4.2.0/lib/rails/commands/runner.rb:62:in `<top (required)>'
/home/patrick/.rvm/gems/ruby-2.2.1@workbench/gems/railties-4.2.0/lib/rails/commands/runner.rb:62:in `fetch'

-- Machine register context ------------------------------------------------
 RIP: 0x00007fbee4127290 RBP: 0x0000000000000001 RSP: 0x00007fffe5f80288
 RAX: 0x00000000069aeb50 RBX: 0x0000000000000000 RCX: 0x0000000000002000
 RDX: 0x0000000000000000 RDI: 0x0000000000000008 RSI: 0x0000000000000000
  R8: 0x0000000000000000  R9: 0x00007fbee47d8138 R10: 0x0000000000000000
 R11: 0x00007fbee3eb7870 R12: 0x00000000069aeb78 R13: 0x00000000069aeab0
 R14: 0x0000000000000008 R15: 0x00000000069aeb50 EFL: 0x0000000000010206

-- C level backtrace information -------------------------------------------
/home/patrick/.rvm/rubies/ruby-2.2.1/bin/../lib/libruby.so.2.2(rb_vm_bugreport+0x51f) [0x7fbee42e02bf] vm_dump.c:693
/home/patrick/.rvm/rubies/ruby-2.2.1/bin/../lib/libruby.so.2.2(rb_bug_context+0xcb) [0x7fbee4173ddb] error.c:425
/home/patrick/.rvm/rubies/ruby-2.2.1/bin/../lib/libruby.so.2.2(sigsegv+0x3e) [0x7fbee4253b7e] signal.c:879
/lib/x86_64-linux-gnu/libc.so.6 [0x7fbee3d67d40]
[0x7fbee4127290]
/home/patrick/.rvm/gems/ruby-2.2.1@workbench/gems/fb-0.7.4/fb.so(cursor_fetch+0xce) [0x7fbed37261be] fb.c:2340
/home/patrick/.rvm/rubies/ruby-2.2.1/bin/../lib/libruby.so.2.2(vm_call_cfunc+0x11e) [0x7fbee42c7b7e] vm_insnhelper.c:1382
/home/patrick/.rvm/rubies/ruby-2.2.1/bin/../lib/libruby.so.2.2(vm_call_method+0x11e) [0x7fbee42de78e] vm_insnhelper.c:1691
/home/patrick/.rvm/rubies/ruby-2.2.1/bin/../lib/libruby.so.2.2(vm_exec_core+0x25c2) [0x7fbee42cf622] insns.def:1054

I can't install fb on Fedora 28

Hello!

I'm struggling to install this gem. I have already installed the firebird-devel and firebird-client packages, but despite that, a fatal error: ibase.h: No such file or directory is being thrown during the install process.

Is it possible to point out the absolute path to ibase.h in my host at the gem install moment?

fixed decimal values converted to floats

Rowland: Hi, after your last fix about the rounding issue I've looked at little closer at the fb implementation because something got my attention (extracted from fb.c@2039)

static VALUE fb_cursor_fetch(struct FbCursor *fb_cursor)
(...)
case SQL_INT64:
        if (var->sqlscale < 0) {
          ratio = 1;
          for (scnt = 0; scnt > var->sqlscale; scnt--) ratio *= 10;
          dval = (double)*(ISC_INT64*)var->sqldata/ratio;
          val = rb_float_new(dval);
        } else {
          val = LL2NUM(*(ISC_INT64*)var->sqldata);
        }
  break;

FB is handling fixed precision decimals (sqlscale > 0) converting them back to C doubles and ruby floats..! But wait, I said.. at ActiveRecord I'm pretty sure I'm getting back BigDecimals.. that's true, but they are being instantiated from the Floats so the precision lost already happened!

I 've made this simple script to expose the issue:

require 'active_record'
require 'fb'

db = Fb::Database.new(:database => "#{File.expand_path(File.dirname(__FILE__))}/test.fdb", :username => 'sysdba', :password => 'masterkey')
conn = db.connect rescue db.create.connect
conn.execute("create table TESTS (ID int not null primary key, N decimal(18, 2))") if !conn.table_names.include?("TESTS")
conn.execute("delete from TESTS")
conn.execute("insert into TESTS values (?, ?)", 1, BigDecimal.new('91520.65'))
value = conn.query(:hash, "select * from TESTS").first['N']
puts 'fb directly'
puts "91520.65 = #{value}? (class #{value.class})"
puts "but actually.. surprise!! " + "%.13f" % value

CONFIG = <<-EOS
test:
  adapter: fb
  database: test.fdb
  username: sysdba
  password: masterkey
  host: localhost
  create: true
  encoding: UTF-8
EOS

ActiveRecord::Base.configurations = YAML::load(CONFIG)
ActiveRecord::Base.establish_connection('test')
class Test < ActiveRecord::Base
end
puts "\nthrough activerecord-fb-adapter"
value = Test.first.n
puts "91520.65 = #{value}? (class #{value.class})"
puts "\nerror only when displaying..?"
puts "915206500000 = #{(value * BigDecimal('10000000')).to_i} nope..!!"

That output's

fb directly
91520.65 = 91520.65? (class Float)
but actually.. surprise!! 91520.6499999999942

through activerecord-fb-adapter
91520.65 = 91520.64999999999? (class BigDecimal)

error only when displaying..?
915206500000 = 915206499999 nope..

So actually this is what is happening here:

  • At first sight it looks like fb is handling the issue correctly, but actually this is an illusion because most decimal numbers don't have an exact binary representation but when they are inspected they are rounded.. so 91520.65 is rounded for displaying, but actually is a floating value like 91520.6499999999942 etc..
  • When AR get's the value it says this is a decimal column, so instantiate a BigDecimal with it.. here the precision lost is exposed.
  • Most of the time, this didn't make a diference, that's why I haven't noticed this until now.. because the precision lost is small and only happens when you read values from the db (writing is ok).. so for the problem to scale you have to operate a lot on this BigDecimals (and usually calculations like sum are handled directly to SQL). Also when I was displaying this values back to my users through format_currency it rounded them hiding the issue.
  • But believe me, this is a serious issue lurking, someone will shot very bad in his foot with this sooner or latter.. mixing floats and money is a recipe for disaster at financial domains.

So the question is.. do you think is possible to, instead of instantiate a Float, to return a BigDecimal there without creating havoc on the user base? I may even try to pull the patch myself..

Something like:

rb_funcall(rb_path2class("BigDecimal"), rb_intern("new"), 1, rb_str_new(str_decimal, 6));

Why any select in WRITE transactions?

After every select commit transaction is called. Why is that? And how to turn this feature off?

`Statement 395766:

SELECT * FROM PROJECTS
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PLAN (PROJECTS NATURAL)

2017-03-02T16:55:15.2890 (2124:00000000015FA0B8) COMMIT_TRANSACTION
E:\WORK\TRUNKDB\RED2MINE.FDB (ATT_46229, SYSDBA:NONE, UTF8, TCPv4:127.0.0.1)
C:\Ruby23\bin\ruby.exe:4124
(TRA_304960647, CONCURRENCY | WAIT | READ_WRITE)
0 ms, 1 read(s), 1 write(s), 1 fetch(es), 1 mark(s)

2017-03-02T16:55:37.1870 (2124:00000000015FA0B8) START_TRANSACTION
E:\WORK\TRUNKDB\RED2MINE.FDB (ATT_46229, SYSDBA:NONE, UTF8, TCPv4:127.0.0.1)
C:\Ruby23\bin\ruby.exe:4124
(TRA_304960648, CONCURRENCY | WAIT | READ_WRITE)

2017-03-02T16:55:37.1920 (2124:00000000015FA0B8) PREPARE_STATEMENT
E:\WORK\TRUNKDB\RED2MINE.FDB (ATT_46229, SYSDBA:NONE, UTF8, TCPv4:127.0.0.1)
C:\Ruby23\bin\ruby.exe:4124
(TRA_304960648, CONCURRENCY | WAIT | READ_WRITE)
`

Using gem 'fb' with Rails 3.2.12 in production mode

Hi!
In my Rails 3.2.12 application i need to connect to Firebird server located in local network from server with application.
The next code works well in development mode

require 'fb'
include Fb
db = Database.new(
  :database => Rails.configuration.firebird_url,
  :username => Rails.configuration.firebird_username,
  :password => Rails.configuration.firebird_password,
  :encoding => 'cp1251')

conn = db.connect rescue db.create.connect

client = conn.query(:hash, 'select * from "SomeTable" where "ID"= ?', id)

But returns nothing (query returns nothing) in production mode.
It also works well in rails console both in production and development.
Maybe some part of Rails refuses connection or data returned by query.
Please, help me to figure out this problem.

How do I install fb on Windows?

I ran gem install fb and the output was:

Fetching: fb-0.7.0.gem (100%)
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing fb:
ERROR: Failed to build gem native extension.

C:/Ruby/200/bin/ruby.exe extconf.rb

checking for main() in -lfbclient... no
checking for main() in -lgds... no
checking for main() in -lfbclient_ms... yes
checking for isc_attach_database() in ibase.h... yes
creating Makefile

make
generating fb-i386-mingw32.def
compiling fb.c
fb.c: In function 'tm_from_timestamp':
fb.c:321:22: warning: unused variable 'tobj'
linking shared-object fb.so

make install
/usr/bin/install -c -m 0755 fb.so C:/Ruby/200/lib/ruby/gems/2.0.0/gems/fb-0.7.0/.
/usr/bin/install: fb.so' andC:/Ruby/200/lib/ruby/gems/2.0.0/gems/fb-0.7.0/./fb.so' are the same file
make: *** [install-so] Error 1

Gem files will remain installed in C:/Ruby/200/lib/ruby/gems/2.0.0/gems/fb-0.7.0 for inspection.
Results logged to C:/Ruby/200/lib/ruby/gems/2.0.0/gems/fb-0.7.0/./gem_make.out

dyld: lazy symbol binding failed

dyld: lazy symbol binding failed: Symbol not found: _isc_attach_database
Referenced from: ~/.rvm/gems/ruby-2.3.0/gems/fb-0.8.0/fb.bundle
Expected in: flat namespace

dyld: Symbol not found: _isc_attach_database
Referenced from: ~/.rvm/gems/ruby-2.3.0/gems/fb-0.8.0/fb.bundle
Expected in: flat namespace

I am running FirebirdCS-2.5.7-27050-i386 with fb 0.8.0 and Ruby 2.3.0 on macOS 10.12 (Sierra).

I can connect using .Net and Java drivers but not using Ruby driver.

Make it work with Firebird 3...

Currently fb only works with firebird 2.5, there is currently firebird 3 and distros like Fedora and Ubuntu are updating their packages to install Firebird 3 and deprecating 2.5 making it hard to install fb with Ruby.

Thanks.

Connection timeout

As best I can tell, there is no timeout when establishing a connection. The following script ran for about 4 minutes on my machine:

#!/usr/bin/env ruby
require 'fb'

Fb::Database.new(
  database: 'fakeurl.com:/fake/database/path.fdb',
  username: 'sysdba',
  password: 'masterkey'
).connect

When it finally did exit, this was the error:

$  time ./connection_timeout.rb
./connection_timeout.rb:8:in `connect': Unsuccessful execution caused by a system error that precludes successful execution of subsequent statements (Fb::Error)
Unable to complete network request to host "fakeurl.com".
Failed to establish a connection.
    from ./connection_timeout.rb:8:in `<main>'
./connection_timeout.rb  0.07s user 0.02s system 0% cpu 4:16.76 total

The connection should probably bail after a certain amount of time. Ideally, this amount of time would be configurable in the connection hash. I'm not a C guy, so I'm not sure I'll be of any help.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.