|
Post by bigbass on Apr 12, 2020 4:50:32 GMT 1
Hello Peter
Alex commented yesterday about a problem with the bacon demo from your website
I was testing yesterday and fixed some of my old demos then understood more how your demo should display (no out put was given) as an expected result I believe something changed in the new version of bacon or sqlite3 the good news it was an easy adjustment
(it may also be another raspberry pi thing)
joe
=========================== with web site demo sqlite3.bac ==============================
Using SQLite version: 3.27.2
query aborted someval sometxt 123 Hello
Error: query aborted
query aborted Method 2 - amount of records: 3 Error: query aborted
========================== after changing to a function ===========================
Using SQLite version: 3.27.2
someval sometxt 123 Hello 234 cruel 345 world
someval sometxt 123 Hello
Error: query aborted Method 1 - amount of records: 3
Method 2 - amount of records: 3 Error: query aborted
with the possible adjustment
FUNCTION sqlite_response(void *NotUsed, int amount, char **value, char **column_name) TYPE int
LOCAL i
IF sqlite_internal_flag AND amount > 0 THEN DB_RESULT$ = "" FOR i = 0 TO amount - 1 DB_RESULT$ = DB_RESULT$ & column_name[i] & DB_FS$ NEXT DB_RESULT$ = DB_RESULT$ & DB_RS$ sqlite_internal_flag = FALSE ENDIF
IF amount > 0 THEN FOR i = 0 TO amount - 1 DB_RESULT$ = DB_RESULT$ & value[i] & DB_FS$ NEXT DB_RESULT$ = DB_RESULT$ & DB_RS$ END IF RETURN FALSE END FUNCTION
|
|
|
Post by Pjot on Apr 12, 2020 12:56:16 GMT 1
Hi Joe (and Alex), Thanks for mentioning, but as often, I am not able to reproduce your problem. If I compile the SQlite demo from the website, then my output is: Using SQLite version: 3.31.1
someval sometxt 123 Hello 234 cruel 345 world
someval sometxt 123 Hello
someval sometxt 234 cruel
someval sometxt 345 world
Method 1 - amount of records: 3
Method 2 - amount of records: 3
This is the expected output, and even when running the SQlite demo with a memory checker like Valgrind there are no errors whatsoever. Nevertheless, the sqlite3_exec function refers to a callback which currently does not return a value (while it should). Therefore, indeed it technically is more correct to define the SUB 'sqlite_response' as a FUNCTION returning a value. This change did not make any difference on my system, but hopefully it works better on yours. I have updated the SQLite wrapper accordingly. Thanks for your input, Peter
|
|
|
Post by bigbass on Apr 12, 2020 16:08:50 GMT 1
Thanks Peter for taking a look and confirming the code on your side what is most important on the raspberry pi side of things is to see what is expected as output then we can take steps to get the same results
1.) I will update to the sqlite3 from git fossil to see if that helps or not ( I am using the latest version for the rpi3 already
2.)track down why we are getting those query aborted messages when I can confirm from the c and c++ demos of sqlite3 do work correctly and also after porting them to bacon compatible syntax
I know in advance any "fix" will not improve or change your code results it "may" discover some issues with 32 vs 64 bit systems allowing for more people to use the code examples on the main bacon page
Joe
|
|
|
Post by alexfish on Apr 12, 2020 18:25:44 GMT 1
Hi All & possible @ Vovchik using updated file: have test Vovchik's demo sql-mozart.bac I get Converting 'dat.bac'... done, 314 lines were processed in 0.210 seconds. Analyzing dependencies... chop chr concat delimengine error instrrev left malloc memcheck minmax right spc str tab utf8 Compiling 'dat.bac'... cc -c dat.bac.c cc -o dat dat.bac.o -ldl -lm Done, program 'dat' ready. it does compile to an exec, but read of displays zero. have tested Joes fix from another thread , that works Vovchik ? BR Alex
|
|
|
Post by bigbass on Apr 12, 2020 20:10:21 GMT 1
hello Alex
my edit from sub to function broke vovchik's demo (sorry) now its a greater mystery
if we leave the older include sqlite3.bac vovchick's demo works
I think it has to do with importing from the lib something changed on us since those demos were done
could be as simple as a cast in the right place still looking
I updated will check everything again
sqlite3 -version 3.32.0 2020-04-09 15:31:22 85d3dc8c50d8dbb8eac1956e8976e861d3b671e03355ca9257060fa3dca51cc4
|
|
|
Post by vovchik on Apr 12, 2020 20:34:53 GMT 1
Dear Joe, Alex and Peter, I just tested my mozart_sql.bac (fresh compile) using Peter's latest wrapper on my PI4 (Buster, 32-bit) and Mint 19.2 (64-bit). Working fine in both cases. This is truly a puzzling (Easter-related?) mystery...and I am scratching my head while self-distancing. Weird. With kind regards, vovchik
|
|
|
Post by bigbass on Apr 12, 2020 22:39:31 GMT 1
Hello vovchik
I just tested what you posted all is fine now
its always nice to see the output thanks maybe a reboot Joe
Record no.: 01 Koechel Verzeichnis No.: 24 Name of Composition: 8 Variations in G on Laat ons Juichen Composed during (date): January 1766 Composed at (location): The Hague ----- Record no.: 02 Koechel Verzeichnis No.: 25 Name of Composition: Variations in D on Willem van Nassau Composed during (date): February 1766 Composed at (location): Amsterdam ----- Record no.: 03 Koechel Verzeichnis No.: 26 Name of Composition: Sonata in E-flat for Violin and Keyboard Composed during (date): February 1766 Composed at (location): The Hague ----- Record no.: 04 Koechel Verzeichnis No.: 27 Name of Composition: Sonata in G for Violin and Keyboard Composed during (date): February 1766 Composed at (location): The Hague ----- Record no.: 05 Koechel Verzeichnis No.: 28 Name of Composition: Sonata in C for Violin and Keyboard Composed during (date): February 1766 Composed at (location): The Hague ----- Record no.: 06 Koechel Verzeichnis No.: 29 Name of Composition: Sonata in D for Violin and Keyboard Composed during (date): February 1766 Composed at (location): The Hague ----- Record no.: 07 Koechel Verzeichnis No.: 30 Name of Composition: Sonata in F for Violin and Keyboard Composed during (date): February 1766 Composed at (location): The Hague ----- Record no.: 08 Koechel Verzeichnis No.: 31 Name of Composition: Sonata in B-flat for Violin and Keyboard Composed during (date): February 1766 Composed at (location): The Hague ----- Record no.: 09 Koechel Verzeichnis No.: 32 Name of Composition: Gallimathias Musicum (Quodlibet) Composed during (date): March 1766 Composed at (location): The Hague ----- Record no.: 10 Koechel Verzeichnis No.: 33 Name of Composition: Kyrie in F Composed during (date): June 1766 Composed at (location): Paris -----
|
|
|
Post by alexfish on Apr 12, 2020 23:13:13 GMT 1
Hi All
think further look needed
Just seen this post whilst looking at mozart bits
I changed
IF res IS 0 THEN To IF res IS 1 THEN
and now it works
ADDED I looked there since if not blagh then print connection error
and in my case no error showed up , hence the connection succeeded, I think says he
BR Alex
|
|
|
Post by bigbass on Apr 15, 2020 15:25:28 GMT 1
Im quoting myself as a reference
I found out why one time vovchik's program didnt work then all of a sudden did
and its a glitch in geany for example you have an open tab with the file name in geany but you delete the file from the folder and download a new copy (so you believe when you open the new file it will be the cleanly downloaded file with the same name ) BZZZZZZ wrong!
solution close all tabs and try it again I have used this app for years and this is the first time I got bit by that one
I am still looking for the cause of the different output from the sqlite3.bac and the sq.bac example
because vovchik's demo works with the same include file
we have a few RPI# users any solutions ? Joe
|
|
|
Post by rikky on Apr 16, 2020 7:47:15 GMT 1
I have no idea. I'm working with Raspbian Stretch. Vovchicks example works for me. And presuming you mean the sq.bac from this post, the output is: Using SQLite version: 3.16.2
someval sometxt 123 Hello 234 cruel 345 world
someval sometxt 123 Hello
Error: callback requested query abort Method 1 - amount of records: 3
Method 2 - amount of records: 3 Error: callback requested query abort
Rik.
|
|