|
Post by votan on Jul 14, 2008 7:09:50 GMT -5
Could you also concider adding a way to write SQL results and function results to a file.... like for example
open $filename for output as #sqlfile print #sqlfile, #queryhandle contents$() close #sqlfile
or even better might be something like this
open $filename for output as #sqlfile print #sqlfile, render #queryhandle close #sqlfile
Same for reading it back of cause....
|
|
|
Post by carlgundel on Jul 14, 2008 13:29:42 GMT -5
Could you also concider adding a way to write SQL results and function results to a file.... like for example open $filename for output as #sqlfile print #sqlfile, #queryhandle contents$() close #sqlfile or even better might be something like this open $filename for output as #sqlfile print #sqlfile, render #queryhandle close #sqlfile Same for reading it back of cause.... It's not hard to just iterate over the results of a request and write to file yourself. Just a few lines of code. Reading a file is just as easy. -Carl
|
|
|
Post by votan on Jul 14, 2008 20:41:00 GMT -5
Already tried that, but couldn't get it to work. Can you mabe help with writing a basic write and read routine?.... I'm kind of really lost here.... Thanx in advance...
|
|
|
Post by mackrackit on Jul 14, 2008 21:24:37 GMT -5
|
|
|
Post by votan on Jul 15, 2008 2:22:34 GMT -5
n Well, no..... writing something to disk or reading it is not the problem.... I just can't get the result of an SQL query grabbed in a way that enables me to write this result to disk and read it back for reuse...
|
|
|
Post by mackrackit on Jul 15, 2008 3:06:15 GMT -5
Try this. It will should get the column headers from a data base and write to a text file.
[columnHeaders] sqliteconnect #dBase,"tBase.db" query$ = "select * from Table1" #dBase execute(query$) cnames$ = #dBase columnnames$() open "G:\directory\test.txt" for output as #f print #f, cnames$ close #f #dBase disconnect() wait
|
|
|
Post by votan on Jul 15, 2008 3:45:14 GMT -5
Thanks, that really helped a lot! Now I'll try to make it work the way I need it.... -edit- Ok, well.... but couldn't get it to work the way it should.... guess I actually need a way to not just store the sql query results, but instead directly render to file. And when needed open that file and re-render then. Like open "sqltest.txt" for output as #sqltest render #sqltest, #sqlresult close #sqltest So the normal print command would be replaced by the render command in that case... Same procedure needs to apply for reading it back again.... or write all the stuff to file what is currently buffered by the #queryhandle in sort of raw format, so that this can be reused anytime by just reading it and treating it as if the query just got executet.
|
|
|
Post by mackrackit on Jul 15, 2008 9:22:12 GMT -5
I do not understand, why render to a file? Once the data is in a file I would think you could read it back and display it anyway you want.
|
|
|
Post by votan on Jul 15, 2008 10:48:19 GMT -5
Yes, I can read and display the data back again... but can not reuse the stored data like it is a freshly execute SQL query. What I need to achieve is to store the complete result of an SQL query in a file... then open that file again and reuse this data as if it would be freshly generated by an query, but without actually executing this query. I'm kind of lost with that.... storing the query as a strings just doesn't help to rebuild the query again when reading it back, so that I simply can use "render #sqlquery" by using the stored data....
|
|
|
Post by carlgundel on Jul 15, 2008 11:50:40 GMT -5
Yes, I can read and display the data back again... but can not reuse the stored data like it is a freshly execute SQL query. What I need to achieve is to store the complete result of an SQL query in a file... then open that file again and reuse this data as if it would be freshly generated by an query, but without actually executing this query. I'm kind of lost with that.... storing the query as a strings just doesn't help to rebuild the query again when reading it back, so that I simply can use "render #sqlquery" by using the stored data.... Do you mean that you want to store the HTML table tags and all that? Why didn't you say so? Interesting idea. -Carl
|
|
|
Post by mackrackit on Jul 15, 2008 12:01:37 GMT -5
A possible idea. Read the file back as an array(comma or something delimited) and build the HTML table with that.
|
|
|
Post by votan on Jul 15, 2008 18:30:02 GMT -5
Yes, that's what I want. ...Guess I have to brush up my englich a bit... Else explaining simple things will always fail....
|
|