[racket-users] Re: query-exec SQLite3 multiple statements

2017-07-28 Thread Alexander McLin
Yes, you can use DrRacket to debug the file at 
collects/db/private/sqlite3/connection.rkt. That one is likely the most 
relevant one for you.

Alternatively, you could wait till Racket 6.10 is released which is very soon I 
think. The bug fixes to the db library might reveal the correct error message 
being generated by SQLite3.

> 
> It works, but I'd still like to figure out exactly what's wrong. I'm 
> relatively new to racket, is it possible to debug the standard library to see 
> whats going wrong?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: query-exec SQLite3 multiple statements

2017-07-27 Thread cmonbryan
For now I've just written a quick batch script that I execute via system

```
 #!/bin/bash

 for f in 'tmp/sql'/*.sql
 do
   echo "Filename: $f"
   ./sqlite3.exe output.sq3 < $f
   echo ""
 done
```

It works, but I'd still like to figure out exactly what's wrong. I'm relatively 
new to racket, is it possible to debug the standard library to see whats going 
wrong?

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: query-exec SQLite3 multiple statements

2017-07-27 Thread cmonbryan
> OMG!!!   Does the term "normalization" ring a bell? 

Yes but these are encoded file outputs. I'm only using SQL as an alternative to 
using a text editor.


> Have you tried removing the terminating semi-colon?

I just tried, same error

> I'm not sure what's causing your issue. What version of Racket and SQLite3 
> are you running on your machine?

I'm on Windows 10, Racket 6.9, SQLite 3.19.3

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: query-exec SQLite3 multiple statements

2017-07-26 Thread Alexander McLin
I tried query-exec on those SQL strings you posted on gist on my local copy of 
Racket 6.8 with an in-memory SQLite3 db and it worked fine.

I'm not sure what's causing your issue. What version of Racket and SQLite3 are 
you running on your machine? Is it Windows, Linux, or Mac OSX?



> https://gist.githubusercontent.com/abramsba/54de32406917e5fb0c480d9c214c3b08/raw/e7c0001ba19d211e856a4458316b391e77d0e530/query.sql
> 
> https://sqliteonline.com/#fiddle-5978e22b51dfap6hj5lcvher
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: query-exec SQLite3 multiple statements

2017-07-26 Thread George Neuner
On Wed, 26 Jul 2017 11:45:25 -0700 (PDT),
cmonbr...@gmail.com wrote:


>First the create table is called and afterwards I execute each insert 
>statement. This is what displayln shows as output for sql-create:
>
>https://gist.githubusercontent.com/abramsba/54de32406917e5fb0c480d9c214c3b08/raw/e7c0001ba19d211e856a4458316b391e77d0e530/query.sql

OMG!!!   Does the term "normalization" ring a bell?


>I've trimmed the string before calling query-exec but it still doesn't work. 

Have you tried removing the terminating semi-colon?  The db query
functions accept only one statement at a time and so the statements do
not need to be terminated as if typed at a console.

George

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: query-exec SQLite3 multiple statements

2017-07-26 Thread cmonbryan
On Wednesday, July 26, 2017 at 7:02:42 PM UTC+2, Alexander McLin wrote:
> One more thing for you to check, make sure there's no trailing whitespace 
> after the end of your statement's terminating semi-colon, that will also 
> trigger the `multiple statements given` error. That bug has been also fixed 
> in the current repository.

Sorry, I sent an e-mail to you individually by mistake. 

First the create table is called and afterwards I execute each insert 
statement. This is what displayln shows as output for sql-create:

https://gist.githubusercontent.com/abramsba/54de32406917e5fb0c480d9c214c3b08/raw/e7c0001ba19d211e856a4458316b391e77d0e530/query.sql

https://sqliteonline.com/#fiddle-5978e22b51dfap6hj5lcvher

The output sql statement file also can be read in perfectly fine using .read 
'filename.sql' or sqlite3 database.db < filename.sql

I've trimmed the string before calling query-exec but it still doesn't work. 

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: query-exec SQLite3 multiple statements

2017-07-26 Thread Alexander McLin
One more thing for you to check, make sure there's no trailing whitespace after 
the end of your statement's terminating semi-colon, that will also trigger the 
`multiple statements given` error. That bug has been also fixed in the current 
repository.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: query-exec SQLite3 multiple statements

2017-07-26 Thread Alexander McLin
It appears you're giving to `query-exec` a string consisting of two statements; 
the create table and insert into statements. `query-exec` only supports 
executing one statement at a time.

If you break your two statements up into two strings and call `query-exec` on 
each one, it should work.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: query-exec SQLite3 multiple statements

2017-07-26 Thread cmonbryan
I came across this post earlier. Does it possibly truncate the amount of 
characters that was passed to it? My statements don't have syntax errors, I can 
copy and paste them into the SQL console without a problem. Seeing as I'm 
looking at somewhere close to around 80.000 records I'd rather automate it.  
I've tested with python to make sure and it works fine there. 

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: query-exec SQLite3 multiple statements

2017-07-26 Thread Alex Harsanyi
There's a problem with the sqlite interface where "multiple statements given" 
error is reported for any syntax error.  This was fixed only recently.  See 
previous discussion:

https://groups.google.com/forum/#!searchin/racket-users/sqlite$20multiple$20statements$20given%7Csort:relevance/racket-users/s2wh-w2GF6M/Bh4A-DNKDAAJ

Best Regards,
Alex.

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.