Displaying 20 results from an estimated 80000 matches similar to: "How to use prepare statement?"
2007 Oct 08
1
How to get database adapter type programmatically in rails?
Hi,all
I am developing a Rails application supporting both Mysql and Oracle.
I have to use Native SQL statements some place. While we know the SQL
grammar is quite different for Mysql and Oracle, so I have to get
database adapter type programmatically in my codes to process
different native SQL statements. I haven''t found any document for this
situation. After some research, I have found
2006 Mar 23
8
ActiveRecord & Prepared Statement
I searched the archives and found a thread about it, but I didn''t
understand: are prepared statement used by ActiveRecord on those
databases that could handle them (Postgresql, Mysql, Oracle etc)?
In case they are not used, are they planned? Is there a roadmap about
Rails I can find somewhere?
2007 Mar 25
1
Can't use models in migrations
Hi there,
This always used to work for me... but not now. I want to blame Rails
1.2 but I''m sure its not.
I can''t use AR models in my migrations. To make sure its not just my
dodgy code I tried to do the same with a well known plugin..
acts_as_versioned.
A migration such as the one below (taken from acts_as_versioned) is
giving the error
undefined method
2011 Sep 13
4
Prepared statements and postgreSQL schemas
Hi guys.
I''m using a postgreSQL with multiple schemas. To change between schemas I
use the ''SET schema TO ...'' statement. That works ok in rails 3.0.
Rails 3.1 uses prepared statements and does not take into account the
''schema_search_path''. This is a big problem because the statement is
prepared once and then the same prepared statement is executed
2012 Jun 12
1
[0x721427d8@gmail.com: [php<=5.4.3] Parsing Bug in PHP PDO prepared statements may lead to access violation]
FYI
I verified this on a working system.
----- Forwarded message from 0x721427D8 0x721427D8 <0x721427d8@gmail.com> -----
Date: Sun, 10 Jun 2012 15:02:43 +0200
From: 0x721427D8 0x721427D8 <0x721427d8@gmail.com>
To: bugtraq@securityfocus.com
Subject: [php<=5.4.3] Parsing Bug in PHP PDO prepared statements may lead to
access violation
[php<=5.4.3] Parsing Bug in PHP PDO
2006 Feb 01
3
Getting database config info
Hi folks. I have a very small problem which is probably very simple. But
I''ve scoured the api and the rails book with no luck.
I''m trying to get information about the database definition out of active
record. When I go into console and say
ActiveRecord::Base.connection
I get a MysqlAdapter object, with an instance variable called @config that''s
a hash containing all
2009 Mar 09
2
rake:db:prepare Mysql::Error: #42000BLOB/TEXT column ' used in key specification without a length
I have a test environment running rails 1.2.3. I am just starting to
introduce testing into this project.
When I run a rake db:prepare. I see this message "Mysql::Error:
#42000BLOB/TEXT column ''short_description'' used in key specification
without a key length: CREATE INDEX ''short_description'' on cached_cars
(''short_description'')
The
2006 Mar 21
2
Migration ~ Create
In one of my migration files I have the following:
===========
def self.up
User.create :name => ''John Kopanas'', :email =>
''john@kopanas.com'', :password => ''test''
end
===========
When I run it I get the following error:
===========
undefined method `create'' for
2012 Sep 11
3
question about how to set up an active record adapter to prefer use of prepared statements...
Hi,
I am writing an active record adapter for our new database and when I run
the tests I see lots of statements that could be run as prepared
statements, but instead of passing me bindings AR passes me a fully
specialized SQL string, not in all cases, but in many. Here is an example:
SELECT addrs.* FROM addrs WHERE addrs.user_id = 153 FETCH FIRST 1 ROWS ONLY
I do have this hook set up:
2007 Jan 21
6
rake db:migrate "undefined method `default'" error
Hi all,
Just starting with Rails and working through the early chapters of the
Pragmatic Programmers Agile Development with Rails book (2nd addition).
When doing a "rake db:migrate" to add a column to a table I get this:
undefined method `default'' for
#<ActiveRecord::ConnectionAdapters::MysqlAdapter:0xb7517ec8>
Any ideas?
thanks,
David
PS: Here''s the full
2006 Apr 20
5
How to find the last SQL statement executed in ActiveRecord
Is there a method for retrieving the last SQL statement executed by
ActiveRecord? I realize I can open the log file, but I''m looking for a
programmatic way.
--
Posted via http://www.ruby-forum.com/.
2010 Nov 09
2
Undefined method
I am very new to ROR. (Ruby 1.8.7, rails 2.1.1, rack
0.8.7, mysql 5.1.41)
I has my_app/lib/migration_helpers.rb file:
module MigrationHelpers
def self.foreign_key(from_table, from_column, to_table)
constraint_name = "fk_#{from_table}_#{to_table}"
execute %{alter table #{from_table}
add constraint #{constraint_name}
foreign key (#{from_column})
2006 Mar 29
2
Rake Migrations for Rails 1.1
Hi all. I keep having the following error when I invoke the rake
db:migrate command for Rails 1.1 (Ruby 1.8.2 -- Windows 2000)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
== Realtorex: migrating
=======================================================
-- create()
rake aborted!
undefined method `create'' for
2012 Jan 02
4
Which AR Interfaces Leverage PreparedStatements/Binds?
I could not find the answer to this in a few Google searches and thought I would ask.
So when are prepared statements best leveraged in ActiveRecord''s interface? I never really noticed before, but simple condition hashes or scopes do not pass down the binds so that prepared statements are leveraged. So a `Car.find(1)` would but things like `Car.where(:id => 1).first` do not. Is it a
2005 Oct 14
10
Active Record: Prepared Statements?
Hello all,
my first project is on it''s way, and I am loving it!
But, and that''s a big BUT:
Active Record does not use prepared statements! How is that? Everybody is
bragging about performance and the most obvious tuning measure is missing.
Ok, I don''t know, if MySQL can even do them as I am using Postgres, but
still.
I started looking at the code and it is not
2006 Mar 16
1
Rails SQL generation (Firebird adapter) - can someone explain ...
I see some possible issues with the SQL that is being generated by the
firebird adapter.
Every SQL is being generated on the fly by concatenating strings.
Can someone please explain why the SQL is being generated the way it is?
I cannot use this in real life for a couple of reasons:
1. This introduces a security hole because a user, accidentally or
deliberately, could potentially submit a
2009 Jul 22
1
Ruby on Rails and prepated statements
It is knows that Ruby mysql driver supports prepared statements.
Why do not active record adapters support them? Is there any reason
for it?
2008 Apr 04
0
Can''t get backgroundrb to work with rails plugin ''batched_sql_fu''
Trying to use backgroundrb to process and insert a large list of bulk
records, but when I try to use it with the batched_sql_fu plugin
installed in vendor/plugins, I get the following error:
---SNIP---
/Users/jdonalds/Sites/3dial_ads/config/../vendor/plugins/
batched_sql_fu/lib/batched_sql_fu/active_record.rb:22:in
`alias_insert_sql_to_batched_version!'': undefined method
2010 Jul 08
25
Prepared SQL statements
Dear all great developers.
I wonder if there is any work being done or thoughts being shared
regarding prepared SQL statements.
Currently I am in heavy need of tuning SQL INSERTS that insert large
(3MB) images into blobs.
I am using rails 2.3.5 with postgres adapter and pg driver.
Any information would be appreciated.
Jarl
--
You received this message because you are subscribed to the
2008 Jun 24
9
ActiveRecord 2.1 Migration support
Hi all,
I am in the process of adding Migration support to the Ingres
ActiveRecord adapter and have run in to a problem. During the call to
create_table the Ingres adapter some how causes ruby to blow the stack
and coredump/segv. I have tracked down the problem down to
"add_column_options!" in
"lib/active_record/connection_adapters/abstract/schema_statements.rb".