Re: [R] The RSQLite version of dbGetQuery drops colums

2009-12-29 Thread Seth Falcon
Hi  Magnus,

Magnus Torfason zulutime.net at gmail.com writes:
 I just noticed (the hard way of course) that when a query returns 0 
 rows, the columns in the resulting data.frame get dropped as well. See 
 the following example code (where conn is an active connection to an 
 SQLite db):
 
   dbGetQuery(conn, select 1 as hey, 2 as ho where 1)
hey ho
 1   1  2
   dbGetQuery(conn, select 1 as hey, 2 as ho where 0)
 data frame with 0 columns and 0 rows
 
 I believe that the second query should return a 0x2 data.frame instead, 
 that is, the same value as:

I agree that keeping the column dimension is sensible.  I will see
about fixing that for the next release.

 Any thoughts? Is this a bug, and are the developers of RSQLite
 reading this?

A much better forum for RSQLite issues is the r-sig-db list.

+ seth

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] The RSQLite version of dbGetQuery drops colums

2009-12-18 Thread Magnus Torfason

Hi all,

I just noticed (the hard way of course) that when a query returns 0 
rows, the columns in the resulting data.frame get dropped as well. See 
the following example code (where conn is an active connection to an 
SQLite db):


 dbGetQuery(conn, select 1 as hey, 2 as ho where 1)
  hey ho
1   1  2
 dbGetQuery(conn, select 1 as hey, 2 as ho where 0)
data frame with 0 columns and 0 rows

I believe that the second query should return a 0x2 data.frame instead, 
that is, the same value as:


 dbGetQuery(conn, select 1 as hey, 2 as ho where 1)[FALSE,]
[1] hey ho
0 rows (or 0-length row.names)

Any thoughts? Is this a bug, and are the developers of RSQLite reading this?

Best regards,
Magnus

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.