Displaying 20 results from an estimated 36 matches for "my_tabl".
Did you mean:
my_table
2006 May 23
3
ez-where headscratch
Hi there,
I''m puzzled by this apparently simple query I can''t manage to reassemble
using ez_where plugin.
cond = Caboose::EZ::Condition.new :my_table do
start_on < Time.now
any {end_on > Time.now; end_on.nil?}
end
I keep getting the following result :
>> cond.to_sql
=> ["my_table.start_on < ? AND (my_table.end_on > ?)", Tue May 23
17:11:43 CEST 2006, Tue May 23 17:11:43 CEST 2006]
while the expected resu...
2005 May 19
5
[OT] Sqlite2 question
So, under Sqlite2, if I want to update a database''s schema, I have to
dump the DB, modify the table''s structure, then go and modify EVERY
insert statement.
The insert statements look like (from memory):
INSERT INTO my_table VALUES (''some_id'', ''some_val'', '''', '''', '''',
''some_other val'', '''', '''', '''', '''')
Assuming a my_table def like:
CREATE TAB...
2009 Oct 01
1
Help me replace a for loop with an "apply" function
...08/11/02 2001
2008/11/02 2005
2008/11/03 2001
2008/11/03 2003
2008/11/03 2004
2008/11/03 2005
2008/11/04 2001
2008/11/04 2003
2008/11/04 2004
2008/11/04 2005
--- R code follows
------------------------------------------------------
# turn it to a contingency table
my_table <- table(user_id, day)
# get the streaks
rle_table <- apply(my_table,1,rle)
# verify the longest streak of "1"s for user 2001
# as.vector(tapply(rle_table$'2001'$lengths, rle_table$'2001'$values,
max)["1"])
# loop to get the results
# initiate results m...
2007 Aug 30
1
belongs_to with foreign keys that reference non primary key columns
Hello,
I have a situation where the foreign key into a table doesn''t
correspond to that table''s primary key:
my_table
-------------
id (pk)
name
...
other_table
--------------
id (pk)
my_table_name (fk references my_table(name))
...
I want to be able to say something like:
class OtherTable < ActiveRecord::Base
belongs_to :my_table, :foreign_key => { :my_table_name => :name }
end
OtherTable.find(:fir...
2006 Jul 17
4
Inner SELECT-s in Rails
Is there a proper way of doing inner selects in rails.
Basically, I run in issues where I need the count of a query and end up
using find_by_sql. I was wondering if there was any elegant way of doing
such queries.
Roland
--
Posted via http://www.ruby-forum.com/.
2006 Jul 18
2
Scaffold a Plural table w/ No Pluralization in environment
Hi guys,
I have a situation here. I have my project set to no pluralization due
to legacy tables in environment.rb. Now, I have some new tables which
I''m starting to pluralize. When I do a generate a scaffold to this new
table:
script/generate scaffold my_tables table
it seems to work out fine for certain sections like
http://mysite.com/railsapp/new (which also inserts properly to my
database). But when I go to http://mysite.com/railsapp/list, I get an
application error. My logs are:
Processing SpielController#list (for 210.5.98.178 at 2006-07-18
1...
2006 Jul 12
1
Dumping schema
All,
It looks like rake db:schema:dump does not dump primary keys.
I have some legacy table that don''t follow the convention ie pk = id
and
none of the primary keys for these tables are getting dumped...
Seems strange as this should be readily available from the db. I am
using
MySQL. Is anybody else seeing that ?
Incidentally how does one specify a primary key using
2006 Apr 18
3
ez_where query question
I''m having fun composing queries with ez_where, but am stuck on how to
formulate the following using the ez syntax:
(begin_date >= ? OR end_date >= ?) AND (description LIKE ? OR name LIKE ?)
There are two clauses, each containing OR operators (the ez ''any'' syntax)
but both clauses must evaulate to true for a match.
Can anyone suggest the proper way to construct
2006 Apr 10
1
Add Column After Column in Migrations
Adding a column to a table just places the column at the end, but I
like to keep related columns together. Is there a way to specify
where the column is added in a table with migrations? For example, in
MySQL you can do:
ALTER TABLE my_table ADD COLUMN new_column INT AFTER other_column
I was hoping migrations would support something like this:
add_column :my_table, :new_column, :integer, :after => :other_column
I couldn''t find anything mentioned in the documentation or in a quick
search of this mailing list.
Thanks,...
2010 Jun 10
1
Can RMySQL be used for a paramterized query?
..._table where emp_id = :sampleEmployee
> would take the vector sampleEmployee and iterate over each of its elements
> to get the result. Perhaps the DBI could at some point in the future
> implement
> this feature.
>
I can connect, and execute a SQL query such as "SELECT id FROM my_table",
and display a frame with all the IDs from my_table. But I need also to do
something like "SELECT * FROM my_other_table WHERE t1_id = x" where 'x' is
one of the IDs returned by the first select statement. Actually, I have to
do this in two contexts, one where the data ar...
2006 Jun 14
6
find and LIKE ''xxx%'' clause
Hi there !
I try to figure out how to do something like this in Rails :
SELECT * FROM my_table WHERE name LIKE ''GOGONAM%''
My problem is the % and the quotes.
>From now, I do like this :
searched_name = params[:name]+''%''
user = MyTable.find(:all, :conditions => ["name LIKE ?", searched_name])
But is there a more gracefull way to do a LI...
2011 Sep 12
0
Migrate column from text to binary (PostgreSQL)
Hello,
So I''ve realized one of the columns in a table has to be binary
instead of text. However, a straightforward
change_column :my_table, :my_column, :binary
fails under PostgreSQL (9.x series) The error message being:
PGError: ERROR: column "my_column" cannot be cast to type bytea
: ALTER TABLE "my_table" ALTER COLUMN "my_column" TYPE bytea
Now I''ve being told this problem can be solved...
2018 Feb 15
3
[Bug 1226] New: Segmentation fault when printing a rule checking byte zero of NFT_PAYLOAD_LL_HEADER
...ftnl_rule *setup_rule()
{
struct nftnl_rule *rule;
struct nftnl_expr *payload_expr, *cmp_expr;
uint8_t mac[6] = {0, 0, 0, 0, 0, 0};
rule = nftnl_rule_alloc();
// The segfault is only triggered if the rule is an NFPROTO_INET rule.
nftnl_rule_set(rule, NFTNL_RULE_TABLE, "my_table");
nftnl_rule_set(rule, NFTNL_RULE_CHAIN, "my_chain");
nftnl_rule_set_u32(rule, NFTNL_RULE_FAMILY, NFPROTO_INET);
payload_expr = nftnl_expr_alloc("payload");
nftnl_expr_set_u32(payload_expr, NFTNL_EXPR_PAYLOAD_BASE,
NFT_PAYLOAD_LL_HEADER);
nftnl_expr_...
2008 Mar 21
5
foreign key question
Hi-
Say I have a db with following schema:
MyTable:
Id, name, user_id, date
User:
id, name, description
I know that I want to add "belongs_to" in my "user" model but how can
I enforce a proper constraint on the user_id in "MyTable"? Is this
done using a has_one in the "MyTable" model?
Thanks!
--~--~---------~--~----~------------~-------~--~----~
You
2006 Jan 17
2
How to run direct sql
How can i run and get the value from the following sql:
select avg(my_field) from my_table where which_year=''0506'' and
which_week <= 21 and my_foreign_key_id=10
cheers
--
Posted via http://www.ruby-forum.com/.
2006 Nov 08
0
Fw: data frames re-ordering and naming columns
...stat.math.ethz.ch] On Behalf Of Jabez Wilson
> Sent: Wednesday, 8 November 2006 4:25 a.m.
> To: r-help@stat.math.ethz.ch
> Subject: [R] data frames re-ordering and naming columns
>
> Dear all, I have read in a table using read.table(). The data
> frame looks like this:
> > my_table
> V1 V2
> 1 3 320
> 2 2 230
> 3 3 300
> 4 2 220
> 5 3 320
> 6 2 210
> 7 freq size
> 8 0 0
> 9 2 220
> 10 2 210
> 11 2 220
> 12 1 110
> 13 2 240
> 14 1 110
> I then remove the dupli...
2007 Mar 16
0
find() and SQL functions
...I have a complex SQL request to perform. I don''t want to manually do the
whole query (find_by_sql) because of the complex joins, but I want to
use MySQL functions, such as:
Model.find(:all,
:include => [../..],
:conditions => ["(../..) AND YEAR(STR_TO_DATE(my_table.my_row,''%Y-%m-%d %H:%i:%s'')) = #{year})"],
:select => [../..])
or
Model.find(:all,
:include => [../..],
:conditions => ["(../..) AND YEAR(STR_TO_DATE(my_table.my_row,GET_FORMAT(DATETIME,''ISO''))) = #{year})&qu...
2005 Mar 21
1
working with tables
...mbine them to get
something like a "spreadsheet" that my colleagues can import in EXCEL.
Up to now I'm doing it as follows:
With each loop-step I assign new values for each "column" of my desired
output like
colum_A=c(column_A,new_value)
At the end I combine all columns: my_table=cbind(column_A,column_B ... )
I think there should be another easier way to assign the new lines directly,
isn't it?
(2) I often have to use the "fitdistr" function included in library MASS.
The generated output for e.g. $estimate has the following format:
mean sd...
2004 Mar 17
1
help with file
...ff.
I want to do clustering of data. It works perfectly, but now I want to
export my file form R to my Linux directory. The problem is that the file
is generated only with the cluster numbers, but it does not carry over the
identifiers. Let me show you what I did :
1. demo<-read.table("my_table", sep=",", header=TRUE) # I
imported my table into R as a data frame. I had header and one of my
columns was called KEYS; this was the unique identifier for my data.
2. #clustering part
>names(demo)
>dm<-dist(demo[,c(3,4,5)])
>names(dm)<-demo...
2006 Aug 04
3
Migration::alter statements ??
Hi,
Where to put the execute statements in migration scripts?
e.g, I would like to create a table and add a foreign_key reference.
def self.up
?? execute "alter table ...."
create_table :my_table do |t|
t.column :user, :string
end
?? execute "alter table ...."
end
Should the execute statement be above the table creation or below the table
creation? Logically I would like to put it below the table creation.
But sometimes the script is executed from the bottom and somet...