Re: [sqlite] readfile() enhancement request
On May 17, 2019, at 7:49 PM, sql...@zzo38computer.org wrote: > > (For Macintosh you may need to change "xclip -o" to the proper command on > Macintosh, pbpaste > For Windows, this extension is unlikely to work There are pipes in the NT line of kernels, and there are ways to tie that to stdin or stdout of a Windows Console process, but you’d have had to go out of your way in your extension to make use of these facilities. The easiest way is to use the Visual C++ _popen() function, which emulates the POSIX popen() function, but it looks like your extension isn’t written in terms of popen(). Plan B would be to run SQLite and your extension under Cygwin or WSL, either of which should work well with this extension. ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Cell pointer array values
On 5/18/19, Gravis wrote: > So would this pseudocode yield the correct address for cell number > "x"? (assuming cell x exists) > > ((page_number - 1) * page_size) + cell_pointer_array[x] Yes. You seem to be thinking in terms of overall file offsets. We tend to think in terms of offsets within a single page. You should get the same answer in either case, but just know that you are looking at this from a different angle. -- D. Richard Hipp d...@sqlite.org ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Cell pointer array values
So would this pseudocode yield the correct address for cell number "x"? (assuming cell x exists) ((page_number - 1) * page_size) + cell_pointer_array[x] On Sat, May 18, 2019 at 9:10 AM Richard Hipp wrote: > > On 5/18/19, Gravis wrote: > > I've been working on making a simple DB file reader and according to > > the file format document (https://sqlite.org/fileformat.html), > > immediately after a "B-tree Page Header" is the "cell pointer array". > > Unfortunately, it never actually states how to use these 16-bit values > > to compute the addresses they are supposed to point to. If someone > > could clarify this for me (and preferably get the documentation > > updated) that would be great. > > Each entry in the cell pointer array is a 16-bit unsigned integer, > which is the offset to the start of the cell from the beginning of the > page. > -- > D. Richard Hipp > d...@sqlite.org > ___ > sqlite-users mailing list > sqlite-users@mailinglists.sqlite.org > http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] Cell pointer array values
On 5/18/19, Gravis wrote: > I've been working on making a simple DB file reader and according to > the file format document (https://sqlite.org/fileformat.html), > immediately after a "B-tree Page Header" is the "cell pointer array". > Unfortunately, it never actually states how to use these 16-bit values > to compute the addresses they are supposed to point to. If someone > could clarify this for me (and preferably get the documentation > updated) that would be great. Each entry in the cell pointer array is a 16-bit unsigned integer, which is the offset to the start of the cell from the beginning of the page. -- D. Richard Hipp d...@sqlite.org ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
[sqlite] Cell pointer array values
I've been working on making a simple DB file reader and according to the file format document (https://sqlite.org/fileformat.html), immediately after a "B-tree Page Header" is the "cell pointer array". Unfortunately, it never actually states how to use these 16-bit values to compute the addresses they are supposed to point to. If someone could clarify this for me (and preferably get the documentation updated) that would be great. ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Re: [sqlite] readfile() enhancement request
sqlite-users@mailinglists.sqlite.org wrote: > It's quite often (for me, at least) the case I need to do something like this > from the command line: > > >sqlite3.exe my.db "insert into t values(`simple field','multi-line text > >copied > >from some other app') > > The problem is the multi-line text cannot be copy-pasted directly into the > command line as the first newline will terminate the command. So, I've been > using readline() like so: > > First, save the copied text into some arbitrary file (e.g., xxx), and then do > > >sqlite3.exe my.db "insert into t values(`simple field',readfile(`xxx')) If you are using a UNIX-based system, you can try my "pipe" extension, which would allow you to write: insert into t values('simple field',cast(pipe('','xclip -o') as text)); You can download this and other extensions at: http://zzo38computer.org/sql/sqlext.zip (For Macintosh you may need to change "xclip -o" to the proper command on Macintosh, which I don't know. For Windows, this extension is unlikely to work, but you can try if you want to.) ___ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users