Skip to content
Back to formatted view

Raw Message

Message-ID: <CAP01uRkOv5g0y=FipiUayxAUXRoQKE2_aF0iPxj_bLkXU+vUeg@mail.gmail.com>
Date: 2011-11-09T01:15:05Z
From: Gabor Grothendieck
Subject: multi-line query
In-Reply-To: <CAG2PC+cN5kUBq+6OaOA5KstN459YJAQsk6CKnXkBw8gshaqoNQ@mail.gmail.com>

On Tue, Nov 8, 2011 at 11:43 AM, Ben quant <ccquant at gmail.com> wrote:
> Hello,
>
> I'm using package RpgSQL. Is there a better way to create a multi-line
> query/character string? I'm looking for less to type and readability.
>
> This is not very readable for large queries:
> s <- ?'create table r.BOD("id" int primary key,"name" varchar(12))'
>
> I write a lot of code, so I'm looking to type less than this, but it is
> more readable from and SQL standpoint:
> s <- gsub("\n", "", 'create table r.BOD(
> "id" int primary key
> ,"name" varchar(12))
> ')
>
> How it is used:
> dbSendUpdate(con, s)
>

The gsub is not needed:

s <- "create table x (
   a real,
   b integer
)"
dbSendUpdate(con, s)


-- 
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com