|
Post by pierre on May 14, 2020 14:06:41 GMT -5
ppro06 said:
hello ppro06,
I have read the documentation and according to the different dll's you are trying currently, I understand that you want to import / export compressed data
from / to 'zip' files or special SQLite Archive files...I never tried these functions from the Command Line Shell. Curious to see what the results will be.
pierre
|
|
|
Post by ppro06 on May 15, 2020 1:45:00 GMT -5
Pierre, let me speculate. with an input method like this, it should be possible to import some simple tables in plain text files provided if a tab like delimiter is chosen. I found a way to import and export simple tab delimted text files. - for simple INSERT statement I just took the whole line, replaced the chr$(9) by a comma and placed the individual elements between simple quotes. - for INSERT statements with bound parameters, I used the inputto$ function, isolating every entry for binding. see attached ' 'tab input output.bas' this is the tab.txt file:
Mystery Ltd John Doe 25, Main St Nowhere Good Lawyer Joe O'Brien Parkway Ave Anywhere High Flyer W.Wright Jr Airport Drv Somewhere
If instead you aimed at 'xml' type files with delimiters as '<' 'and '>', then we should first have to determine what is the root element, what is or are the element(s) - with or without attributes - and what is the data to enter..... not that simple, perhaps. What file format are you working with ? Thanks Pierre, I am working with a similar format that can be opened in notepad, the code works fairly well for simple organised text columns. The limitation I can think of are files having, in addition to organised columns, page headers and footers and other markers which risk being read into columns. So for it to work well the input pages have to be cleared of other text and characters that are not part of the fields (for instance Pragma printed statements on an sqlite dump file).
|
|
|
Post by ppro06 on May 15, 2020 1:47:08 GMT -5
ppro06 said:
hello ppro06,
I have read the documentation and according to the different dll's you are trying currently, I understand that you want to import / export compressed data
from / to 'zip' files or special SQLite Archive files...I never tried these functions from the Command Line Shell. Curious to see what the results will be.
pierre
I will definitely share once I get the libraries to work.
|
|
|
Post by pierre on May 17, 2020 11:05:57 GMT -5
The new SQLite interface provided by Chris, is introducing a couple of new functions, some of them requiring yet another dll, but in my opinion one of the
most important assets is the direct access to prepared statements with bound variables, which are standard functions of the SQLite C language interface.
We have already seen how to use them with 'blob' files, but this method is also particularly important for data security reasons : It is indeed claimed that it is the best way to avoid the so-called 'sql injection' 3 steps are necessary: - Precompile the SQL statement with placeholders for the user input (i.e. a question mark) --> SQL3Prepare() - Bind the user input to these placeholders --> SQL3BindInt() or SQL3BindText() - Execute the query, replacing the placeholders by the user input --> SQL3Step() Taking advantage of this method is a definitive way to separate strictly the already compiled SQL statement from the input data itself, avoiding any erroneous interpretation of some purposely malicious user input. Every input will be considered data and nothing more than data. Other functions have been supplied on this forum or on the Run BASIC forum, in order to sanitize the user input, i.e. 'clean string' or 'strip' (delete unwanted characters) and 'double quote' (doubling embedded simple quotes), but generally, PREPARED STATEMENTS with BOUND PARAMETERS are considered to be
THE SAFEST SOLUTION. Unfortunately , this method is not present in the old 'SQ3_4_LB' wrapper and - as far as I have been able to see - neither in Run BASIC nor in LB5 alpha.... So, what about the future ? The functions provided by Chris are allowing us to access directly the sqlite3.dll, just as the SQLite database accessor in RB/LB5 is supposed to do. As far as the prepared statements with bound parameters are concerned, they are most probably already present in the SmallTalk SQLite API.... Will the future LB5 and the long awaited Run BASIC '2.0' eventually benefit from Chris's work and see these functions included in their SQLite methods? Let us hope that this will be the case. pierre
|
|
|
Post by ppro06 on May 21, 2020 2:19:46 GMT -5
Pierre, let me speculate. with an input method like this, it should be possible to import some simple tables in plain text files provided if a tab like delimiter is chosen. I found a way to import and export simple tab delimted text files. - for simple INSERT statement I just took the whole line, replaced the chr$(9) by a comma and placed the individual elements between simple quotes. - for INSERT statements with bound parameters, I used the inputto$ function, isolating every entry for binding. see attached ' 'tab input output.bas' this is the tab.txt file: Mystery Ltd John Doe 25, Main St Nowhere Good Lawyer Joe O'Brien Parkway Ave Anywhere High Flyer W.Wright Jr Airport Drv Somewhere
If instead you aimed at 'xml' type files with delimiters as '<' 'and '>', then we should first have to determine what is the root element, what is or are the element(s) - with or without attributes - and what is the data to enter..... not that simple, perhaps. What file format are you working with ? Hello Pierre, I came across this while combing through the LB encyclopedia, I thought it might be of interest. See link; alycesrestaurant.com/lbpe/XML%20Data%20Storage.html
|
|
|
Post by pierre on May 21, 2020 3:31:50 GMT -5
ppro06 said :
Oh, yes ! Thank you, ppro06 !
I didn't know that this existed.....I'll give it a try.
pierre
|
|
|
Post by ppro06 on May 30, 2020 12:44:12 GMT -5
Hello there, I am experimenting with window controls to come up with a listbox display having a header (see first link). From my research, I have to work with Comctl32.dll and invoke the CreateWindowExA function on top of which the listbox has to be self-made (or made by a similar method). Anybody with such experience? below are the links;
1)https://docs.microsoft.com/en-us/windows/win32/controls/header-controls 2)https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-createwindowexa#parameters
|
|
|
Post by Rod on May 30, 2020 13:33:34 GMT -5
I think you are talking about a header window for a listview, subtly different from a simple listbox and orders of magnitude more complex.
I have posted code that replicates listviews but I suspect the code will be of little interest. We have as yet no native listview. Its all API. There are examples.
|
|
|
Post by metro on May 30, 2020 20:11:38 GMT -5
Hello there, I am experimenting with window controls to come up with a listbox display having a header (see first link). From my research, I have to work with Comctl32.dll and invoke the CreateWindowExA function on top of which the listbox has to be self-made (or made by a similar method). Anybody with such experience? below are the links; 1)https://docs.microsoft.com/en-us/windows/win32/controls/header-controls 2)https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-createwindowexa#parameters A simple approach could be to use statictext or even a bitmap but the best aesthetically by far is the listview IMHO, I have a listview and listbox in one of my programs if I could just get my head around some parts or Brandon's code I would use two listviews
|
|
|
Post by Brandon Parker on May 30, 2020 20:52:36 GMT -5
If I have time tomorrow, I will update that example to have two ListView objects. I will most likely create a new post for it, but I will post here to let you know when it is up.
{:0)
Brandon Parker
|
|
|
Post by metro on May 30, 2020 22:33:11 GMT -5
If I have time tomorrow, I will update that example to have two ListView objects. I will most likely create a new post for it, but I will post here to let you know when it is up. {:0) Brandon Parker Brandon, I don't believe there is anything wrong with the examples of your code already on the forum, fairly sure there are a couple of examples with two listviews
my issues are related to capturing double click (with out errors) and the method you use to update a row, which is different to other examples I have used
The latter is me not spending enough time digesting your approach. The former may have been solved Tasp, yet to try his code though.
However I am looking forward to your latest efforts, I wish I had the ability to think in Functions and Subs like you do
would love to emulate your style of coding.
I still remember my first post on the old forum and Janet posted very restrained and polite comment about how convoluted it was , my code is less spaghetti like now days but still needs a lot of polish
|
|
|
Post by ppro06 on May 30, 2020 23:02:01 GMT -5
Thank you all for your responses. I'm glad there is code on a listview because my listbox is very crude.
|
|