Displaying 20 results from an estimated 8000 matches similar to: "Question marks in SQL string literals"
2011 Sep 13
4
Changing adapters in ActiveRecord does not change the generated sql
If I establish a new connection with a new adapter (ie. switch from mysql to
postgresl) the generated sql is still mysql specific. I tried all sorts of
reset methods on AR::Base but to no avail. There must be something being
memoized on ActiveRecord base that has to do with the adapter and it doesn''t
get cleared when you establish a connection with a new adapter.
I know this
2008 Sep 17
13
Capturing the sql from a statement without executing it?
Hi guys,
Is there an elegant way to capture the sql that would have been
executed by an ActiveRecord statement, without actually executing
it? :)
I''m imagining something like
sql = User.find(1).groups.to_sql
or perhaps
sql = ActiveRecord::Base.capture_sql { User.find(1).groups }
resulting in sql = ''SELECT * FROM groups INNER JOIN memberships....
WHERE users.id =
2017 Jun 16
0
[WISH / PATCH] possibility to split string literals across multiple lines
On 16/06/2017 2:04 PM, Radford Neal wrote:
>> On Wed, 14 Jun 2017, G?bor Cs?rdi wrote:
>>
>>> I like the idea of string literals, but the C/C++ way clearly does not
>>> work. The Python/Julia way might, i.e.:
>>>
>>> """this is a
>>> multi-line
>>> lineral"""
>>
>> luke-tierney at uiowa.edu:
2006 Jan 06
2
Paginate from a difficult sql query
Hello,
I have 2 tables
table colors :
+----------------------+
| id | user_id | name |
+----------------------+
| 1 | 1 | test1 |
| 2 | 2 | test2 |
| 3 | 3 | test3 |
+----------------------+
table users :
+----------------------+
| id | enabled | name |
+----------------------+
| 1 | 1 | bob |
| 2 | 1
2017 Jun 16
0
[WISH / PATCH] possibility to split string literals across multiple lines
On Fri, Jun 16, 2017 at 7:04 PM, Radford Neal <radford at cs.toronto.edu> wrote:
>> On Wed, 14 Jun 2017, G?bor Cs?rdi wrote:
>>
>> > I like the idea of string literals, but the C/C++ way clearly does not
>> > work. The Python/Julia way might, i.e.:
>> >
>> > """this is a
>> > multi-line
>> >
2009 Nov 09
3
How can I improve a Ruby on Rails code that hast a lot of SQL as strings?
Hello Railists,
I have a piece of Ruby on Rails code that has a complex SQL query (well, not
that complex, but as far as I know beyond the ORM capabilities) and for my
taste it has too many strings and harcoded values. I''d like to improve it as
much as possible, so my question is open ended, what else can I do to
improve it?
Some particular issues I have
- Is there a way to get a table
2017 Jun 14
0
[WISH / PATCH] possibility to split string literals across multiple lines
Having some line-breaking character for string literals would have benefits
as string literals can then be constructed parse-time rather than run-time.
I have run into this myself a few times as well. One way to at least
emulate something like that is the following.
`%+%` <- function(x,y) paste0(x,y)
"hello" %+%
" pretty" %+%
" world"
-Mark
Op wo 14 jun.
2006 Mar 13
7
Wilcard search
Hello,
I''m writing a search function for my application, but I am unsure on how
to search for all results that contain my search string; here''s what
I''ve got:
def search
@products = Product.find(:all,
:conditions => "date_available < now()",
:conditions => [ "title ilike ?",
2007 Feb 15
1
mongrel process stopped listening but "phantom thread" still going
Hi,
I run a medium-sized website that uses mongrel/rails in the following
configuration:
-frontend reverse proxy to a cluster of 7 app servers
-each app server runs apache 2.2 with mod_proxy_balancer that balancers
the requests out into a mongrel cluster of 35 servers.
-each mongrel is version 1.0.1
the mongrel cluster config looks like:
port: "1620"
environment: production
address:
2017 Jun 16
4
[WISH / PATCH] possibility to split string literals across multiple lines
> On Wed, 14 Jun 2017, G?bor Cs?rdi wrote:
>
> > I like the idea of string literals, but the C/C++ way clearly does not
> > work. The Python/Julia way might, i.e.:
> >
> > """this is a
> > multi-line
> > lineral"""
>
> luke-tierney at uiowa.edu:
> This does look like a promising option; some more careful checking
2017 Jun 14
0
[WISH / PATCH] possibility to split string literals across multiple lines
I know it doesn't cause construction at parse time, and it was also not
what I said. What I meant was that it makes the syntax at least look a
little as if you have a line-breaking character within string literals.
Op wo 14 jun. 2017 om 14:18 schreef Joris Meys <jorismeys at gmail.com>:
> Mark, that's actually a fair statement, although your extra operator
> doesn't cause
2006 Apr 09
1
Join using :THROUGH - SQL is wrong even when using :SOURCE
Here''s a join table for an educational institution:
create_table "student_appointments", :force => true do |t|
t.column "supervisor_id", :integer, :default => 0, :null => false
t.column "student_id", :integer, :default => 0, :null => false
t.column "course_id", :integer, :default => 0, :null => false
[other columns
2006 Jan 22
2
acts_as_taggable: weird SQL problem with untagging
Setup as follows:
class Resource < ActiveRecord::Base
belongs_to :user
validates_presence_of :filename
validates_uniqueness_of :filename, :scope => "user_id",
:message => "already exists, try uploading another file or deleting first."
acts_as_taggable :join_class_name => ''TagResource''
2017 Jun 15
0
[WISH / PATCH] possibility to split string literals across multiple lines
On Wed, 14 Jun 2017, G?bor Cs?rdi wrote:
> I don't think it is reasonable to change the parser this way. This is
> currently valid R code:
>
> a <- "foo"
> "bar"
>
> and with the new syntax, it is also valid, but with a different
> meaning. Or you can even consider
>
> a <- "foo"
> bar %>% func() %>% print()
>
>
2017 Jun 14
1
[WISH / PATCH] possibility to split string literals across multiple lines
On Wed, Jun 14, 2017 at 8:48 AM, Simon Urbanek
<simon.urbanek at r-project.org> wrote:
> As I recall this has been discussed at least a few times (unfortunately I'm traveling so can't check the references), but the justification was never satisfactory.
>
> Personally, I wouldn't mind string continuation supported since it makes for more readable code (I had one of my
2011 Nov 22
4
A "strict Arel" mode for ActiveRecord to prevent SQL injection vulnerabilities
Hello rubyonrails-core,
I’ve been looking into possible changes to ActiveRecord / Arel to make it
easier to write Rails applications that are free of SQL injection
vulnerabilities, and in particular do so in a way that makes it easy for a
code reviewer to verify that the app is safe from such bugs.
The concern:
-----------------
With the ActiveRecord API as is, it’s relatively easy to write
2017 Jun 14
0
[WISH / PATCH] possibility to split string literals across multiple lines
On 14/06/2017 5:58 AM, Andreas Kersting wrote:
> Hi,
>
> I would really like to have a way to split long string literals across
> multiple lines in R.
I don't understand why you require the string to be a literal. Why not
construct the long string in an expression like
paste0("aaa",
"bbb")
? Surely the execution time of the paste0 call is
2017 Jun 14
0
[WISH / PATCH] possibility to split string literals across multiple lines
As I recall this has been discussed at least a few times (unfortunately I'm traveling so can't check the references), but the justification was never satisfactory.
Personally, I wouldn't mind string continuation supported since it makes for more readable code (I had one of my packages raise a NOTE in examples because there is no way in R to split a long hash into multiple lines), but
2017 Jun 14
0
[WISH / PATCH] possibility to split string literals across multiple lines
If you are changing the parser (which is a major change) you
might consider treating strings in the C/C++ way:
char *s = "A"
"B";
means the same as
char *s = "AB";
I am not a big fan of that syntax but it is widely used.
A backslash at the end of the line leads to errors when you accidently
put a space after the backslash and the editor
2017 Jun 14
0
[WISH / PATCH] possibility to split string literals across multiple lines
On 14/06/2017 6:45 AM, Andreas Kersting wrote:
> On Wed, 14 Jun 2017 06:12:09 -0500, Duncan Murdoch <murdoch.duncan at gmail.com> wrote:
>
>> On 14/06/2017 5:58 AM, Andreas Kersting wrote:
>>> Hi,
>>>
>>> I would really like to have a way to split long string literals across
>>> multiple lines in R.
>>
>> I don't understand why