similar to: How to use SQL without a model?

Displaying 20 results from an estimated 10000 matches similar to: "How to use SQL without a model?"

2007 Feb 26
5
Multiple uplinks, ssh connections hang
Folks, Ive got two ISP connections that I am using with: --- ip route add 192.168.200.0/24 dev eth2 src 192.168.200.11 table connection1 ip route add default via 192.168.200.1 table connection1 ip route add x.175.244.0/24 dev eth1 src x.175.244.2 table connection2 ip route add default via x.175.244.1 table connection2 ip rule add from 192.168.200.11 table connection1 ip rule add from x.175.244.2
2006 Jan 11
3
How do you do a custom sql call in rails?
Hi. I am developing an industry specific crm that allows busineses to track customers in a particular way. Each customer will be assigned a customer number. The first customer will have a customer number of 1, the second customer_number = 2, etc... Note that this customer number is not global but particular to the account that created the customer (see schema snip below). I need to have a
2006 Jan 13
6
Locating Objects by associated object.properties
I am just getting the hang of this, so forgive me if this is a stupid question... - I have two models/tables: Owners and Cars - Owners may have many cars. Cars have one owner. - Cars have a property named Color. Question: how do I get a list of all the Owners who have RED cars? I want something like this to work: Owner.find_by_car.color("RED") Thanks for any help! -- Posted via
2006 Jul 18
5
SQL query question
Hello, I know it''s off-topic. But I''m sure you are using SQL and can help me ;) I''ve a table CARS and a table KEYS and a LOCKS table. CARS id|name 1|audi 2|ford 3|mazda 4|porsche ... KEYS id|car_id|lock_id 1|1|1 2|2|1 3|2|2 4|3|1 5|3|2 6|4|1 7|4|2 8|4|3 ... LOCKS id|name 1|main 2|spare 3|engine ... A car can have many keys. Keys are for different locks. How can I
2006 Jun 03
1
Unable to connect to ms sql server.
I get the following error message when trying to connect to ms sql server: Open OLE error code:80040E4D in Microsoft OLE DB Provider for SQL Server Login failed for user ''XXXXXXXX''. HRESULT error code:0x80020009 Exception occurred. I google''d for those error codes but nothing useful so far. To set up ruby for ms sql server, I followed the
2006 Apr 21
5
Simple Question: How to merge SQL results?
Hopefully an easy one, how do I merge two or more SQL query results? Example: result1 = find_by_sql(x) result2 = find_by_sql(y) What is the best way to merge result1 and result2? I want to be able to reference the objects as if they were obtained via one query. Cheers, Dan
2009 Sep 16
3
find_by_sql - multiple selects, same statement SQL error
I''m trying to get the following statement to work using variable substitution (it works if hard-code the where (med_type) param in the inner SQL statement): med_type = ''game'' @mediaformats = MediaFormat.find_by_sql("select * from media_formats where media_formats.media_type_id = (select media_type_id from media_types where media_type = ?, :med_type) order by
2007 Jan 20
2
find_by_sql with named parameterized sql
I tried to use named parameters in my SQL query , using find_by_sql Order.find_by_sql ([select * from orders where amount > ? and quantity > ?", [ @amount, @quantity ] works;.. but Order.find_by_sql ([select * from orders where amount > :amount and quantity > :quantity ", [ :amount => @amt, :quantity => @qty ] is not working a I wrong or should I use a plain select
2006 Jan 19
2
NOOB: Using locals to pass data to a SQL query
I want to show a users entries based on there login id. I have tried this: View: <div id="myfish"> <%= render :partial => ''myfish'', :locals => {:user => session [:user].id } %> </div> Partial: <% for entry in @entries %> <table border ="0" CELLSPACING="0"> <tr class="<%= alternate
2006 Jan 10
15
KISS and DRY? Not even close!
Hi all, After working on my first rails app and having handed over some very sophisticated coding from a lot of you guys. My app does what I want it to do, but I''m no where near the end yet, and it seems that the KISS and DRY objectives already went down the drain. It could be lack of knowledge, only doing Ruby on (and) Rails for a month, but I''m stuck on the following:
2016 Apr 11
4
Problems with scsi-target-utils when hosted on dom0 centos 7 xen box
Hello We were attempting to use scsi-target-utils, hosted on a xen dom0 vm using localhost, and running into some problems. I was not able to reproduce this on a centos 7.2 server using the default kernel. (From dmesg) Apr 4 11:18:42 funk kernel: [ 596.511204] connection2:0: detected conn error (1022) Apr 4 11:18:42 funk kernel: connection2:0: ping timeout of 5 secs expired, recv
2006 Apr 03
4
How to fake composite primary keys?
I know ActiveRecord doesn''t support composite primary keys, but I need to use one, and I need it ASAP. I don''t need any composite foreign keys, luckily; what I have is a table that stores old versions of rows in another table, so the composite key is an id + date stamp. Would someone tell me a hack I can use to support this? -- View this message in context:
2006 Mar 02
3
Custom SQL Question
Hello, can search with following SQL Statement: def execute_search @result = Search.find_by_sql ["SELECT * FROM customers WHERE firstname LIKE ? LIMIT 10",params[:firstname]] render :template => "search/resultlist", :layout => false end My question is, how do I use 2 or more Parameters - and with the "%"? (I Like to use SQL-Statements because
2008 May 21
3
Test returned value by sql statement
Hello people, just wanted to know how to actually test returned value from sql statement like : @alreadyused = Promotioncodes.find_by_sql [ "select alreadyused from promotioncodes where id = ?", @codeid ] I would like to check whether @alreadyused has value 1 or 0 It doesn''t seem a simple if @alreadyused would word ... Regards Joel
2013 Dec 17
1
ActiveRecord and tiny_tds
Hi, I''m having some issues trying to run .find_by_sql against a Win MSSQL 2008 server. When I use the tiny_tds gem the query works without any issues. require ''rubygems'' gem ''tiny_tds'', ''= 0.6.2'' require ''tiny_tds'' gem ''activerecord'', ''= 3.2.12'' require
2007 May 18
2
Winbindd breaks after first unsuccessfull authentication
I have the following problem: # wbinfo -V Version 3.0.24 # wbinfo -a anyuser%goodpassword plaintext password authentication succeeded challenge/response password authentication succeeded # wbinfo -a anyuser%badpassword plaintext password authentication failed error code was NT_STATUS_WRONG_PASSWORD (0xc000006a) error messsage was: Wrong Password Could not authenticate user anyuser%badpassword
2024 May 22
2
OpenSSH server doesn't log client disconnect without SSH_MSG_DISCONNECT
On Tue, 21 May 2024, Opty wrote: > Hello, > > can anyone confirm that OpenSSH server doesn't log client disconnect > without SSH_MSG_DISCONNECT? OpenSSH logs the disconnection regardless of whether the client sends SSH_MSG_DISCONNECT or just drops the connection. A little more information may be logged from the disconnect packet if it was sent, but there should always be a
2006 Apr 13
7
Complex SQL in paginate command?
Hi all, Is there a way to create pagination with a complex SQL, more complex than the :conditions option will support? I have two databases, houses and images. Houses has_many images, and each Image belongs_to house. I''m creating a search engine for the house records and I''d like to be able to filter out all the houses without any associated images. So far I''m
2006 Mar 18
9
How do I write this SQL the Rails way?
I''m trying to find all the unique bill_number, status records in Bills table. I can do it with a find_by_sql statement like this: @records = Bill.find_by_sql( "select distinct bill_number, status from bills group by bill_number, status;") How would I rewrite it using ''find :all
2006 Mar 06
6
Executing SQL in rails, and the types of the data returned
Hi, Every once in while I have to run SQL by hand, in my models mostly. But I''m wondering if there is a better way of doing it than I do. And, I have a question concerning types of the fields in the result the query produces. First, about the types. In a certain model, to get and return the value of a boolean function, I have to do: result =