Skip to content

RSQLite: Tracking an error message to its source

8 messages · Ista Zahn, Andrew Hoerner, Jeff Newmiller +1 more

#
Andrew Hoerner <ahoerner <at> rprogress.org> writes:
("C:\\R_PROJ\\INEQ_TRENDS\\TESTS\\minifile\\cps_00077.csv",
ran
("C:\\R_PROJ\\INEQ_TRENDS\\TESTS\\minifile\\cps_00077.csv",
database
file
datatypes; a
"AGE","RACE","FTOTVAL"
DearFolks--
This is an update on my previous posting. 

This does not change the error, but I have fixed the code creating 
command, which now reads:
    command   <-paste("CREATE INDEX IF NOT EXISTS ", DBname_c, ".", 
              indexName_c, " ON ", yourTable_c, " (", 
              paste(indexVars_C, collapse=", "), ")", sep='')

I have established that the error is coming out of the call to dbGetQuery 
toward the end of my function code..

dbGetQuery is a generic function with methods for conn and statement.. 

DBI:::dbGetQuery  tells me that:
standardGeneric for "dbGetQuery" defined from package "DBI"

showMethods(DBI:::dbGetQuery) says that  there are methods for 
conn="SQLiteConnection", statement="character"

isS4(dbGetQuery) returns TRUE.

I have not been able to figure out how to look at the actual code of 
dbGetQuery.

But from the original error, it appears the dbGetQuery must call 
sqliteExecStatement, which I did find code for, and which in turn calls 
RS_SQLite_exec.

RS_SQLite_exec is allegedly in RSQLite, or so I gather from this code:
Call("RS_SQLite_exec", conId, statement, bind.data, 
        PACKAGE = .SQLitePkgName) 

So I have tried ::, :::, showMethod, and everything else I could think of, 
including plain google searches, and the only place I have been able to 
find any trace of RS_SQLite_exec is in other people?s error messages. No 
code anywhere. 

So I still have not found a path back to RS-DBI, which I assume generated 
the original message, passing it up through an unknown number of 
intermediate steps to RS_SQLite_exec, then directly to 
sqliteExecStatement, and then again through an unknown number of 
intermediate steps to dbGetQuery.

getAnywhere(RS_SQLite_exec) says ?no object named ?RS_SQLite_exec? was 
found?
So does getAnywhere("RS-DBI").

You know, for a language that prides itself on being open source, there 
are still things that are pretty hard for a non-expert to find. That?s 
unfortunate.

Warmest regards, andrewH
#
dbGetQuery doesn't like the "." in your index name. Change to
something else, e.g.,

            command   <-paste("CREATE INDEX IF NOT EXISTS ", DBname_c, "_",
              indexName_c, " ON ", yourTable_c, " (",
              paste(indexVars_C, collapse=", "), ")", sep='')
  }

Best,
Ista
On Sat, Jan 4, 2014 at 7:00 PM, Andrew Hoerner <ahoerner at rprogress.org> wrote:
#
I recommend that you NOT try to go down that particular rabbit hole unless you are very confident in your computer science skills... database engines are very complicated. Learn to work with the error messages provided to you, and think in SQL when working with a SQL database.
---------------------------------------------------------------------------
Jeff Newmiller                        The     .....       .....  Go Live...
DCN:<jdnewmil at dcn.davis.ca.us>        Basics: ##.#.       ##.#.  Live Go...
                                      Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/Batteries            O.O#.       #.O#.  with
/Software/Embedded Controllers)               .OO#.       .OO#.  rocks...1k
--------------------------------------------------------------------------- 
Sent from my phone. Please excuse my brevity.
Andrew Hoerner <ahoerner at rprogress.org> wrote:
#
Look at the source code for the package - you'll probably find the dev
version available at https://github.com/rstats-db/rsqlite easier to
understand.

Hadley
#
I think you've misinterpreted what database name means in this context
- sqlite only has one database per file called "main". You can attach
others using the ATTACH command
(http://www.sqlite.org/lang_attach.html).

Hadley
6 days later