similar to: ActiveRecord - INSERT options for MySQL

Displaying 20 results from an estimated 60000 matches similar to: "ActiveRecord - INSERT options for MySQL"

2006 Jul 10
1
ActiveRecord batch insert for MySQL
Hi guys, I am a pretty new developer for RoR, and I am wondering whether batch inserts for ActiveRecord are available. I know that ActiveRecord::Base::create accepts an array of hashes, but from the MySQL logs, I can see that the inserts are not batched. Would like to stay within the ActiveRecord framework, if possible. Thanks in advance for comments and suggestions. v -- Posted via
2006 Nov 04
0
ActiveRecord, insert and not auto-incremented primary keys...
Hi, After playing while with ActiveRecord, I''m surprised it isn''t easier to insert data into a table whose primary key is not auto-incremented by the database server. The following code... --------------------------------------- -- MySQL database "test" --------------------------------------- CREATE TABLE gardens ( code integer NOT NULL, name
2009 Mar 07
0
Be careful of BIGINT primary key fields in MySQL. Will cause problems with ActiveRecord create (but not find)
The MySQL/Ruby library doesn''t properly handle inserts into tables with the primary key being a BIGINT If the ID returned to the MySQL/Ruby library is LARGER than the INT range, the value is returned to Ruby truncated and incorrect. This is then passed up to ActiveRecord and into the id field of your model. The actual INSERT worked properly and when do you an ActiveRecord find for the
2006 Jan 17
1
Insert blob - rails 1.0.0 mysql 3.23 - sql syntax error
Hi, Experimenting with upload and insert a picture into a MySQL database - using Agile Web Development with Rails p362-3. We have rails 1.0.0 and MySQL 3.23.58. I get an error ''You have an error in your SQL syntax near'' because rails uses the x''ffdbff....'' notation for the blob which is not available until MySQL 4 Is there a way of switching Rails to use
2007 Sep 11
3
ActiveRecord, blocking or async, logging, syslog/udp
Here''s a gedanken experiment for those w/ far more knowledge than I about ActiveRecord, etc.: Let''s say my database is very remote and on a very slow machine. Let''s further say that my app has an action that leads to a very simple insert into the "impressions" table of the db, a la "INSERT INTO impressions(docid) VALUES($docid);" - and
2006 Dec 25
2
how to insert data using has_and_belongs_to_many
I''am newbie in RoR, so my question might look stupid, but I stuck in one thing. I''ve created 3 tables: users{ id, user } books { id, book } books_users{ book_id, user_id} Model class Book< ActiveRecord::Base has_and_belongs_to_many:users I can''t figure out how to insert data to the books_users table. For example users post info about new book and information
2006 May 04
7
ActiveRecord and SQL Server
Hi all, I am exploring using RoR for a new project but have run into a problem with ActiveRecord and SQL Server''s timestamp datatype. We have a NOT NULL timestamp column in a table and ActiveRecord keeps trying to update it, which promptly causes it to blow up. I have tried making the value NULL for insert and update in the model, but SQL Server doesn''t like that
2010 Jun 25
0
activerecord + ms sql.. rowguid field for merge replication breaking inserts
i got my app running with ms sql server as the database and everything worked fine. migrations, indexes, constraints, find, create, update, etc.. the app isn''t actually a web app, butwill be running isolated on severally diff machines that may not have consistent internet access.. part of the requirements was to setup replication so that eventually the separate instances would
2005 Feb 02
2
using the MYSQL command to insert a record
I am trying to use the MYSQL command to insert a record into a database and I can't seem to get it to work. I can do an UPDATE with no problem. Here is the line in my dialplan exten => s,12,MYSQL(QUERY resultid ${connid} INSERT INTO `member` ( `id` , `member_num` , `active` )VALUES ('',${number}' , '1')) Does anyone have an example of an INSERT INTO that I could look
2006 Aug 04
1
ActiveRecord, Mysql, NULL columns and uniqueness
Hi all. Mysql allows to set multiple NULLs on columns with unique constraint, it''s normal SQL. Well, but when I try to submit some form, all unspecified values will be consodered as '''' (empty string) and (Mysql::Error: Duplicate entry occurs (((. How I can teach ActiveRecord to consider empty fields as NULL?
2006 Jun 18
0
Thread safety in activerecord(?), connection lost to mysql server - simple code sample provided
Hello all, I know that this issue has come up before, but I read all the previous posts regarding thread safety and haven''t come up with a solution. I''m spawning lots of threads in a backgroundrb worker that each do things with activerecord models. I get the connection lost to mysql server exception about 90% of the time, with my process working by sheer luck the other 10%.
2010 Mar 25
0
ActiveRecord::Base.transaction MySQL Lock Errors...
Hi there, is there any known issues when using ActiveRecord::Base.transaction with models who tables have constraints applied? I have two models: one (is associated with model two) two (has MySQL foreign key and unique key constraints) I''m doing something like this: ActiveRecord::Base.transaction one.create two.create(reference to one) one.create two.create(reference to
2009 Sep 04
1
MySQL BIT column type in ActiveRecord
I''m attempting to access a MySQL BIT(1) column with b''1'' as the data in the case of a true boolean from within activerecord and am unable to get any output. The table was created by Hibernate (which uses BIT as it''s boolean type). I''ve done a considerable amount of searching on this but have not been able to find an answer. Am I missing something
2006 Mar 21
4
activerecord - mysql blobs...
I''m struggling with activerecord and mysql blobs (uploading files)... blobs over 400K-ish cause the below exception... ActiveRecord::StatementInvalid in File#upload Mysql::Error: Lost connection to MySQL server during query: I''ve tried blob, mediumblob, and longblob... I''m using windows xp for development - and have not installed the mysql gem... simlar google
2006 Aug 09
0
Bug in ActiveRecord 1.14.4 and select_limited_ids_list method using mysql?!?!
All - I just upgraded to rails 1.1.5 (per the announcement) which also updated active record to 1.14.4 (was 1.14.2). I know have a problem... Author has many Articles... @authors = Author.find(:all, :limit => 10, :offset => 0 :include => [:articles], :conditions => ["hide =
2006 Apr 18
0
activerecord(mysql) and hash to unique count
I am working with ruby(activerecord) and want to save a ''hash'' of URLs such that a key is the URL and the value points to a count of how many times it occurs after processing a csv file my question; all I know of is right now is to attempt to save, get a unique error and then when handling the exception increment the hash value (really a column in a table) Is this bad? Or
2007 Jan 26
2
ActiveRecord: Reading MySQL views
My production environment is actually Oracle, in which case if I say: set_table_name "v_table" It will treat it as a readonly table. However, doing the same under MySQL throws an ActiveRecord::StatementInvalid error, saying that the table db.view doesn''t exist. Is there a way to get around this? I am using MySQL to test some new code I am working on, and wouldn''t
2009 May 18
0
ActiveRecord SerializationTypeMismatch MySQL SQLite
I was having this error in Development but not in Test: ActiveRecord::SerializationTypeMismatch: cambiable_attributes was supposed to be a Hash, but was a String Which was the problem? I was using MySQL in Development and SQLite3 in Test. Field ''cambiable_attributes'' was type String in the DB schema and had to be type Text. I changed the data type to Text and it worked well in
2008 Apr 22
2
Custom Mysql queries slower than ActiveRecord in production
I have been working on optimizing the performance of a Rails app by rewriting the AR record methods into custom sql queries. What I did is that the result from the query is not instantiated as an object, which is supposed to be too time consuming. Here are the performance difference between using default AR methods and its custom equivalent. The number of requests per second was read from the log
2011 Sep 23
4
Could not find a valid gem 'activerecord-mysql-adapter' (>= 0) in any repository
Hi, since upgrading my gems from activerecord-3.0.10 to activerecord-3.1.0 my scripts using activerecord don''t work anymore. I get an error message Error Please install the mysql adapter: `gem install activerecord- mysql-adapter` (Could not find RubyGem mysql (~> 2.8.1) ) but gem does not find such a package: ERROR: Could not find a valid gem