similar to: Defining the expected behavior of DatabaseStatements.execute()

Displaying 20 results from an estimated 3000 matches similar to: "Defining the expected behavior of DatabaseStatements.execute()"

2005 Oct 17
8
Using active record for SELECT MAX(column) FROM ...
Hi, Is there an easy way of querying an active record for a maximum column value? I need to do queries like: SELECT MAX(salary) FROM employees TIA, Jeroen
2006 Feb 25
5
MySQL client ran out of memory
I''m getting the following error unexpectedly for my rails app. I just exported the databae from dreamhost and imported it on textdrive for my rails app. Mysql::Error: MySQL client ran out of memory: SELECT COUNT(*) FROM comments WHERE (comments.listing_id = 2666) /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.13.2/lib/active_record/connection_adapters/abstract_adapter.rb:88:in
2006 May 06
7
New Ajax and Rails tutorial
Hi, I just published the first version of a small tutorial I''ve written on Ajax and Rails. It is called "How to paginate, sort and search a table with Ajax and Rails" (sorry, I didn''t manage to find a longer title !) and is available at : http://dev.nozav.org/rails_ajax_table.html There is nothing really new in it, it''s rather a compilation and
2007 Oct 08
1
Rails reverses apostrophes
Hi, I am quite new to Ruby on Rails so this might have a very simple answer... My problem gives the following error message when I try to call the count function for an item. Mysql::Error: Unknown column ''TournamentTemplate'' in ''where clause'': SELECT count(*) AS count_all FROM action_logs WHERE (action_logs.loggable_id = 1 AND action_logs.loggable_type =
2011 May 11
2
Issue with Arel::SelectManager and insert Method
Hello, Arel::SelectManager (arel 2.0.9) uses following statement to insert a new record: @engine.connection.insert im.to_sql, ''AREL'', primary_key_name, primary_key_value But in DatabaseStatements insert ist defined as: insert(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil) Actually, Arel::SelectManager does not use the sequence name. This leads to issues
2006 Jun 15
4
testing with transactions
Hello! I experienced problems with testing transactions which are supposed to be rolled back, but are not, because of transactional fixtures eliminating the inner transaction. Can this be worked around somehow without turning off transactional fixtures? Maybe savepoints can help this? Does anyone have any experience with savepoints to achieve nested transaction functionality? Both Postgres
2006 Feb 01
5
Sybase ctlib Adapter
Hi, I''ve been trying to update Will Sobel''s sybase-ctlib adapter to pass unit tests on Rails 1.0. It''s been a slow, sloggy process for me so far, as I''ve been learning Ruby, Rails, and Sybase administration all in one go. (c: It''s been a saving grace to have a good starting point (thanks Will!). http://dev.rubyonrails.org/ticket/2030
2006 Apr 20
1
has_many.count not accepting options hash
has_many.count does not seem to support an options hash like ActiveRecord::Base.count does. Example: >> AcademicProgram.find(:first).course_requirements.count :conditions => "courses.name LIKE ''a%''", :include => :course => 40 >> ap.ap_requirements.count :conditions => "courses.name LIKE ''a%''", :include =>
2006 Mar 10
7
ODBC adapter connection help please.
Does anyone have any experience getting ODBC to work? I could really use some help here. I''m having trouble accessing a db2 database via odbc using rails. It''s an external database, that I import data from. I have placed the connection code in my model : unless connected? establish_connection( :adapter => "odbc", :dsn => "<dsn
2003 Oct 16
1
Raw Volumes?
Hi, folks. <shameless plug for rsync> rsync has changed the way I handle mirroring tasks, and is a wonderful compliment to EMC's timefinder product. EMC handles their BCV mirror splits, and rsync handles files and hierarchies on non-EMC disk. I am quite happy with this arrangement. For small numbers of systems, rsync is far simpler than NIS+/LDAP for replicating certain types of
2006 Jan 11
2
How to execute an SQL statement in rails?
Hello, This is probably a silly question but looking at "api.rubyonrails.org", I can''t seem to figure out which method I should be using ... I want to execute an sql statement, like "truncate table BLAH" from within one of my rails app ... What''s the "right" way to do this? Thanks, /B -- Bruno Mattarollo <bruno.mattarollo@gmail.com>
2006 Jul 24
7
[PATCH] Support for DB Clusters/Replication in ActiveRecord (RFC)
Skipped content of type multipart/alternative-------------- next part -------------- Index: connection_adapters/abstract/connection_specification.rb =================================================================== --- connection_adapters/abstract/connection_specification.rb (revision 4617) +++ connection_adapters/abstract/connection_specification.rb (working copy) @@ -1,10 +1,21 @@ require
2010 Apr 28
1
Trying to get Rails working with Sybase ASE
Hi I''m trying to use the activerecord-sybase-adapter to be able to use ASE with my rails applications. But, I am struggling... I followed (most of) the steps on this informative page: http://trevoke.net/blog/2009/09/11/connecting-to-sybase-with-rails-on-windows-xp/ Initially I had Rails 2.3.5 installed. I copied the "Ruby Sybase files" as instructed and the Sybase dll files
2005 Dec 21
7
use of SET command in find_by_sql
Hi, I''m trying to execute something like this method in a model: def self.sql_for_rankings() sql = "SET @counter:=0;" sql << " SET @counter:=0; SELECT *, @counter:=@counter+1 AS rank FROM testscores. " find_by_sql(sql) end Where the new rank column is a kind of autoincrementer inside of
2008 Mar 28
6
Eager Loading + Confusion
So I''m trying to do a find with an order by specific column values thing, but some of the columns are attributes through associations. So I did some eager loading with the :include option to try and access the attributes of the object I''m doing the find on. Stuff has been blowing up on me so far. Here''s the code in the controller right now: sort_by = params[:sort_by]
2009 Oct 14
18
sybase in rails2?
Has anyone actually gotten the activerecord-sybase-adapter to work in Rails2? I can''t seem to, and can''t figure out why. I am on RedHat linux. I have the sybase client libraries installed, I have the adapter installed. After installing the patch at https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/2455-update-for-sybase_adapter#ticket-2455-4 to get a slightly
2006 Jan 10
1
sql server & linux: left join problem
I''ve got a left join problem of some sort connecting from linux FreeTDS/ODBC to SQL Server. It''s similar to the false post I had earlier, but this is a real problem. Here''s my code: def find_recipes_for_workorder @recipe_pages, @recipes = paginate_with_sort :recipes, :per_page => 10, \ :joins => ''left join workorder on
2006 Mar 05
0
Can I execute DML from within Rails?
Is it possible to execute a DML statement against a MySQL database from within Rails? I have a table I''m using for batch processing. It needs to be truncated to reset the primary key before each batch insert statement. I looked at the API here: http://api.rubyonrails.com/classes/ActiveRecord/ConnectionAdapters/DatabaseStatements.html#M000532 and didn''t notice anything that
2000 May 24
2
RODBC
Dear R-fans, My database access package RODBC is now available on CRAN. For those who have never used it, odbc is a database and platform independant API which provides an SQL interface to a large number of database engines. The databases supported include not only SQL based RDBMS but also CSV files, foxbase, dBase, MSExcel etc. ODBC has been promoted mainly by Microsoft and this is where the
2000 May 24
2
RODBC
Dear R-fans, My database access package RODBC is now available on CRAN. For those who have never used it, odbc is a database and platform independant API which provides an SQL interface to a large number of database engines. The databases supported include not only SQL based RDBMS but also CSV files, foxbase, dBase, MSExcel etc. ODBC has been promoted mainly by Microsoft and this is where the