SQLite Forum

Timeline
Login

47 forum posts by user RandomCoder

2021-11-21
03:32 Reply: Language pairs strings how to (artifact: 547d889f77 user: RandomCoder)

One option I've seen used is a table something like:

CREATE TABLE strings(id INT, lang TEXT, string TEXT);
INSERT INTO strings VALUES (1, 'en', 'Hello World');
INSERT INTO strings VALUES (1, 'es', 'Hola Mundo');
INSERT INTO strings VALUES (2, 'en', 'Header');
INSERT INTO strings VALUES (2, 'es', 'El encabezamiento');

It has the advantage of being fairly easy to add new languages or words and phrases without needing to change schemas.

2021-11-17
23:22 Reply: sqlite3.dll is not returning control to my program (artifact: 4fb1d2044f user: RandomCoder)

You mention using the DLL. How are you getting pointers to and calling those pointers? I wouldn't be surprised to see the stack is being corrupted due to different calling conventions.

Also, why are you using the DLL? If you're writing a C++ app, why not just use the amalgamation?

2021-11-03
18:35 Reply: Get SQLITE_READONLY when using UPDATE command (artifact: 41e287cb8c user: RandomCoder)

Correct, stream names have the same rules for allowed characters as filenames on NTFS. So, <>:"/\|?* are not allowed in either.

2021-10-29
18:12 Reply: Database on android SD CARD (artifact: 11bd454f34 user: RandomCoder)

I'll try to be as direct as I can be:

Are you trying to run sqlite3 that you downloaded from SQLite's Download Page on your phone using a shell running on an Android device?

This has basically no hope of working. The download page includes x86 binaries, and your phone is running some version of arm, unless it's an unusual phone.

2021-10-28
12:48 Reply: Database on android SD CARD (artifact: bb5d42b1a3 user: RandomCoder)

Unix binaries can be run, but only if they're for the right architecture.

None of the downloads on the SQLite downloads page are for Arm, so unless the OP has an unusual phone, it won't work.

04:38 Reply: Database on android SD CARD (artifact: 3364a101e6 user: RandomCoder)

Where did you get the file named sqlite3 that you placed on the SD card for your device?

2021-10-27
18:39 Reply: Database on android SD CARD (artifact: 7e56c9e329 user: RandomCoder)

One thing I've not see in this thread:

How are you building the SQLite shell? Or, are you just trying to run the linux/x86 build on an Android device?

2021-10-26
17:57 Reply: Get SQLITE_PROTOCOL error when opening database (artifact: f22d79300e user: RandomCoder)

On WinRT, it's fairly unlikely that the processes current directory is writable. You'll need to explicitly specify one of the writable directories.

Also, how are you compiling the SQLite library?

I don't see any mention of setting the SQLITE_OS_WINRT macro that's necessary for SQLite to function on WinRT.

2021-10-02
16:37 Reply: How to read Images from sqlite3 and show via opencv, PIL or Matplot lib ? (artifact: 28b6d5292c user: RandomCoder)

As mentioned by Ryan Smith, this is a question that's outside the domain of SQLite. You asked SQLite for bytes, and it gave you bytes back, what you do with those bytes to display them is very much not something SQLite handles.

That said, the issue is because you're passing the bytes to a function that expects a filename. If you insist on using OpenCV to decode the image, you need to follow an explicit decode path:

for x in m:
    # Convert the image to a numpy array
    image = numpy.asarray(bytearray(x[0]), dtype="uint8")
    # Decode the image to a cv2 image
    s = cv2.imdecode(image, cv2.IMREAD_COLOR)
    # Convert the image from cv2's BGR to RGB that matplotlib expects
    s = cv2.cvtColor(s, cv2.COLOR_BGR2RGB)

    # s = mpimg.imread(io.BytesIO(x[0]))
    plt.imshow(s)
    plt.show()

If the goal is actually to just display the image, it's much easier to just use matplotlib directly instead of taking a detour into OpenCV:

import matplotlib.image as mpimg
import io
for x in m:
    # Just use matplotlib to decode the image
    plt.imshow(mpimg.imread(io.BytesIO(x[0])))
    plt.show()

2021-09-20
17:57 Reply: Database anomaly (artifact: c5db0a55f8 user: RandomCoder)

No, it means unknown code doing unknown things produced unknown results.

It's hard to guess what's happening, but trying to reverse engineer the results is likely a waste of time. It could be memory corruption, it could be specifically doing that for its own odd reasons. It could be a stack corruption causing a call to some other function.

If you want to dive into it in a debugger, feel free, of course, but it's unlikely anyone here can gaze into a crystal ball and figure out what happened, we simply don't have enough information.

2021-09-16
16:09 Reply: Javascript enforcement (artifact: b1acb4e770 user: RandomCoder)

All of the download links on the download page lead to the hp1 link if Javascript isn't allowed to run.

2021-09-14
20:04 Reply: Can BLOB incremental I/O be employed to manage edits to a block of text? (artifact: 8a15d13d30 user: RandomCoder)

At the risk of an off-topic answer:

You might consider looking into text editing data storage structures like a piece table. It might make sense to store in a SQLite database, to some degree, and prevent you from needing to make large changes for small changes in text.

There are of course other techniques around storing and managing documents for a text editor. They could very well all be overkill for your needs, just thought I'd throw one option out there.

2021-09-08
20:02 Reply: SQLite3.exe fails to handle huge multi-line-comment (artifact: 262dcf630b user: RandomCoder)

Looks like it's this bit in shell.c:

        else if (nSql && _all_whitespace(zSql)) {
            if (ShellHasFlag(p, SHFLG_Echo)) printf("%s\n", zSql);
            nSql = 0;
        }

As zSql is built up line by line during the comment, _all_whitespace works on the string character by character. Pretty much the poster child for an On^2 loop.

Not sure the best way to solve it. Commenting out this bit prevents the slowdown, but also prevents the printf call, of course.

2021-08-19
21:57 Reply: "database or disk is full" with in-memory database. Suggested next steps? (artifact: d592a0554b user: RandomCoder)

I think this stems from rqlite's use of sqlite3_deserialize(). When using this, the resulting memory database is limited by SQLITE_CONFIG_MEMDB_MAXSIZE, which is documented as defaulting to 1073741824 bytes

You could try increasing that value to see if it solves the issue for this user.

For instance, running a 64-bit build of SQLite on a machine with 256gb of RAM, it's fairly easy to hit this limit:

$ sqlite3 test.db
SQLite version 3.36.0 2021-06-18 18:36:39
Enter ".help" for usage hints.
sqlite> create table a(x);
sqlite> create table b(x);
sqlite> insert into a values ('abcdefghijklmnopqrstuvwxyz');
sqlite> .exit

$ sqlite3 --deserialize test.db
SQLite version 3.36.0 2021-06-18 18:36:39
Enter ".help" for usage hints.
sqlite> .schema
CREATE TABLE a(x);
CREATE TABLE b(x);
sqlite> insert into aux1.b select x from aux1.a;insert into aux1.a select x from aux1.b;
Error: no such table: aux1.b
sqlite> insert into b select x from a;insert into a select x from b;
[ .. repeated command 16 times .. ]
sqlite> insert into b select x from a;insert into a select x from b;
Error: database or disk is full
sqlite>

SQLite errored out with around 1gb of RAM usage. If I use a memory database directly, SQLite will use much more memory as I repeat the doubling of these two tables.

2021-08-17
16:21 Reply: sqlite DB + data file - write out all entries (artifact: 68c0685fe0 user: RandomCoder)

The .dat file doesn't include any obvious formats, and the database has no hints as to it's format. I'm sorry to say, unless someone here decides to reverse engineer the format, you're probably best off finding a forum for the application meant to read it and ask if anyone is aware of documentation for the file's data format.

2021-08-16
21:16 Reply: Comment about application file format (artifact: cf0c07843b user: RandomCoder)

Correct. The history of it continues on for other use cases, but at least as far Office is concerned (excluding Access, I think), it's no longer used as the primary format.

20:19 Reply: Comment about application file format (artifact: 80541d6ba9 user: RandomCoder)

How do I get Office to produce a CFBF-based file, one that fails this unzip test?

You can save in one of the older formats, for instance in PowerPoint, go to Save As, click Browse, and select PowerPoint 97-2003 Presentation (*.ppt) in the type selection dropdown in the file dialog.

I've seen this format used in some professional video production pipelines as well. Still, they have very specific requirements there, so it makes a little sense.

2021-08-09
22:02 Reply: reading multiple lines from multiple sources... (artifact: 3e91f3f086 user: RandomCoder)

The reason you get the last line of each file is that is exactly what your code is doing, without the break, it's processing each file in turn, then after it's done processing each file, it inserts a row into your database table. You then repeat the process 9 times.

If you want to operate on each line of the file in turn, you'll need to open them up, and enumerate through all of the files in lockstep. There are several ways to do this, one such way is to use the built in Python operator zip to work through the enumeration of each file for you:

#!/usr/bin/env python3

import sqlite3

def printthis():
    db = sqlite3.connect("example.db")
    db.execute("CREATE TABLE IF NOT EXISTS datasamples(names, colors, shapes, favfood);")
    sql = 'INSERT INTO datasamples(names, colors, shapes, favfood) VALUES(?,?,?,?)'
    print("Connected to SQLite")

    with open("names.txt") as f1, open("colors.txt") as f2, open("shapes.txt") as f3, open("favfood.txt") as f4:
        for name, color, shapes, favfood in zip(f1, f2, f3, f4):
            db.execute(sql, (name.strip(), color.strip(), shapes.strip(), favfood.strip()))
    db.commit()

    print("-- results --")
    for row in db.execute("SELECT * from datasamples;"):
        print(", ".join(row))

if __name__ == "__main__":
    printthis()

And as a side note: While I've answered the question for you, and fixed a bug in your SQL (you had one too many ? for the bound parameters, really your question had nothing to do with SQLite. You'll probably get much better help with Python specific issues on a forum for Python issues.

2021-08-07
18:54 Reply: SQLite with NFS + cachefilesd (artifact: 461ce4df1f user: RandomCoder)

EBS's multi-attach doesn't support I/O fencing, meaning I'd expect putting an application that isn't aware of what's happening with such a volume on it to encounter issues. (And given my luck, I'd expect those issues to first happen a month after I've gone live during my first big burst of business)

It also doesn't help you if there's an issue with the volume.

If you really need no downtime, is there some reason you're not using RDS or some other service that has failover support, mutli-AZ support, and is just generally meant to be used in a scenario like this?

2021-08-06
21:13 Reply: SQLite3.exe - How to use arguments AND remain in interactive mode? (artifact: daa259511a user: RandomCoder)

As others have mentioned, there's no direct way to do this, however, you could add an .interactive quasi-command to the command line parser if you really want to by modifying shell.c and building it yourself:

22295c22295,22297
<       if( azCmd[i][0]=='.' ){
---
>       if( strcmp(azCmd[i],".interactive")==0 ){
>         readStdin=1;
>       }else if( azCmd[i][0]=='.' ){
22316c22318,22319
<   }else{
---
>   }
>   if( readStdin ){

Though, I don't know shell.c that well, there may be reasons this is a horrid idea.

14:08 Reply: Fail to calculate long expression (artifact: bcfbed2e7e user: RandomCoder)

PYTHON = 7.70154259312e+12

Nope

Python 3.9.6 (default, Jun 29 2021, 07:18:15)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> (((((((788)*(8.46))))+8342*1.803-1))*4186.4*(15))*(((22/((7530/((2)*(((((25))-421))))))*597)+7283.8-9.60+167))+(8871)
8259816920615.111

Of course, I'm not sure what any of this proves. Different tools calculate things differently. In this case, I think you're running Python 2 (why?) and between Python 2.x and Python 3.x the behavior for / was changed. Good luck tracking down all of the differences between all of the things, but this has very little to do with SQLite.

2021-08-02
20:31 Reply: null character sorts greater than 0x7f and less than 0x80 (artifact: 0a02515bd5 user: RandomCoder)

I had thought that's no longer true:

Before the Unicode Standard, Version 3.1, the problematic "non-shortest form" byte sequences in UTF-8 were those where BMP characters could be represented in more than one way. These sequences are ill-formed, because they are not allowed by Table 3-7.

The example in the spec specifically calls out "C0" as an invalid first byte in a sequence:

The byte sequence C0 AF is ill-formed, because C0 is not well-formed in the "First Byte" column.

Or, is C0 80 as a replacement for 00 a special case?

19:03 Reply: Fail to calculate long expression (artifact: 2cd3ae0e3b user: RandomCoder)

I'm not the OP, but, long story short: I'm pretty sure the issue boils down to how SQLite handles modulus operations on floating point values:

In Python (and a other languages I know of that allow % on a floating point value):

>>> 0.1 % 2.0
0.1
>>> 1.0 / (0.1 % 2.0)
10.0

Where as, in SQLite:

sqlite> select 0.1 % 2.0;
0.0
sqlite> select 1.0 / (0.1 % 2.0);

sqlite>
2021-07-30
13:39 Reply: Round function returning -0.0 (artifact: 58a7226aa3 user: RandomCoder)

I don't think so:

sqlite> .version
SQLite 3.36.0 2021-06-18 18:36:39 5c9a6c06871cb9fe42814af9c039eb6da5427a6ec28f187af7ebfb62eafa66e5
zlib version 1.2.11
msvc-1926
sqlite> select round(0.0), round(0.0, 1), round(-0.0), round(-0.0, 1);
0.0|0.0|0.0|0.0
2021-07-08
20:22 Reply: edit() function usage (artifact: f27c65abef user: RandomCoder)

Correct, you need to call bbedit with a -w flag to cause the CLI shim to wait for the GUI app to close before exiting.

2021-07-06
17:34 Reply: Shortcut to change a non changing update or upsert in a noop (artifact: 6e69ecc8cf user: RandomCoder)

I would think that this might better be an option offered by a VFS. There is little point to doing work to avoid some byte writes if a page is dirtied elsewhere anyway and has to be written out.

I might be misunderstanding your point, but:

The VFS might not have enough information to optimize this. If SQLite can determine that the a write is unnecessary from an index lookup, say, then skipping the write saves the VFS from having to determine if a non-index page is dirty in the first place.

2021-06-30
00:37 Reply: Better download file naming (artifact: 9f84e8f5f0 user: RandomCoder)

I was curious, since I'm responsible for a small package manager, and this sort of problem isn't new to it. I've absolutely run across situations like SQLite where the version number alone isn't enough to find the download. I wasn't able to find enough documentation. I went looking at existing packages and found one that followed the pattern I used:

https://npackd.org/p/kodi

(I think you'll need to "login" to the website to see the form showing the regexp capture and replace group)

I'll admit I know nothing about this package manager beyond this little bit of digging. I was just curious how it worked, since the package managers I've worked with before have at least some basic scripting to solve this sort of issue. Furthermore, for all I know this npackd is somehow different from the npackd that nolasd was referring to.

2021-06-29
21:16 Reply: Better download file naming (artifact: 6f339c83c7 user: RandomCoder)

Rather than getting the website to match the package manager, wouldn't this work for this package manager?

Discovery page (URL): 
https://sqlite.org/download.html
Discovery regular expression:
[0-9]+/sqlite-dll-win32[^,]+zip
Discovery package download URL pattern: 
https://sqlite.org/${match}
2021-06-28
22:29 Reply: php sqlite3_create_window_function (artifact: 86b8740e6f user: RandomCoder)

PHP's SQLite interface has no method to call sqlite3_create_window_function at present. You will need to work with the PHP community to add such a feature or create an extension to do so (assuming that's possible).

19:57 Reply: Better download file naming (artifact: af25b97685 user: RandomCoder)

Would something like this not work (python code here, but I'd imagine it's straightforward enough)?

# Data is https://sqlite.org/download.html
m = re.search("PRODUCT,(.*sqlite-dll-win32.*zip),([0-9.]+),", data);
url = "https://sqlite.org/" + m.group(1)
ver = m.group(2)
2021-05-28
14:56 Reply: partial file load? (artifact: 50f4edcdc7 user: RandomCoder)

I suspect there must be more going on than is present in your description.

If I run this query on a instrumented build of SQLite that logs all reads/writes and point it at a 16709362688 byte SQLite database, the process reads only 4712 bytes from the file. Indeed it finished very quickly, suggesting not all of the 16gb file was read.

2021-04-07
05:04 Reply: deploying 1_000_000 sqlitedb on AWS? (artifact: 87bd3ea0b2 user: RandomCoder)

I can't speak for the best practice question, but you might consider some questions first:

Are you ok with losing data if the local db isn't ever copied back to S3? It's rare, but machines can die with no notice. A user might apply a change, see it work, and then see it vanish later.

Have you taken into account the S3 API costs? If each of your 1_000_000 users causes 10 updates per day, that's something like $50 in PUT requests per day, not to mention other API calls. Maybe that's an impossible figure for your use case, maybe not.

Do you need a snapshot of the entire state of all of the users? There really isn't a way to get a snapshot of your system as described, so if you need a snapshot of all of the users in a point in time, you'll need quite a bit of extra logic.

Is there ever a scenario where someone might try to get a large database from S3 while it's being updated? S3 is strongly consistent (now), but that doesn't mean it's not possible for some edge cases with multi-part download to grab different parts of a file as it's being updated.

Also, the comment about enumeration reminds me: Your naming strategy for new files will be important. You can't assume that a file that doesn't exist on S3 won't exist by the time you try to upload it.

I do in fact store tens of thousands of SQLite databases in S3. Though, they're treated as immutable in my case.

2021-02-24
04:38 Reply: Out of Memory Errors - Possible Enhancement (artifact: f3f6b903d3 user: RandomCoder)

I suspect you're right to call out the version of SQLite.

I was curious, so I dusted off a Windows 7 machine I have (with 4gb of RAM). The query works. However, if I use SQLite 3.30 the following happens on both a machine running Windows 10 with plenty of RAM, and the machine with only 4GB:

SQLite version 3.30.0 2019-10-04 15:03:17
....
sqlite> select * from tripsummary;
Memory Used:                         24935480 (max 1600678816) bytes
....
Run Time: real 17.453 user 15.843750 sys 1.593750
Error: out of memory
sqlite>

SQLite 3.31 still uses a lot more memory than the latest version of SQLite, but just barely manages to work. I suspect it would fail in some scenarios since it's probably getting close to the 2gb user space limit of Windows on x86.

2021-02-19
23:07 Reply: SQLite database in space? (artifact: 039eddfd3d user: RandomCoder)

Don't know a real answer to the question, but I have seen some video of an ISS astronaut using an iPad, so in a very literal sense, there is a SQLite database on the ISS, on that iPad if nothing else.

2021-02-10
17:06 Reply: Can parts of a database be protected for distribution? (artifact: 03b1f427a1 user: RandomCoder)

If someone can edit the database, what stops them from turning off the triggers, should they exist, making the edits, then turning them back on?

It strikes me that you could compile your own version of the SQLite library with the SQLITE_FILE_HEADER value changed.

Then only your application can open or modify the database, so you could simply have flags in your database to protect content from being edited in your application. Well, of course, it's still trivial for someone in the know to modify the database binary using a hex editor, then change the file using the tool of their choice, and revert the header so your application will read it.

The truth is much more nuanced than this. "The clever jackass" is often perfectly capable of opening a file, and changing all occurrences of "should" to "won't " and leaving something that isn't changed in size, but conveys different meanings. Sometimes they'll also go to surprising lengths to just break the protection for no real gain. You're at the bottom rung of a game of cat and mouse that others have played for various reasons, on there are no simple solutions that will handle all attack vectors.

2021-01-25
21:39 Reply: SQLite3 v3.34 ANOMALY - Precompiled Binaries for Windows (artifact: 83e1e639ac user: RandomCoder)

You're not specifying the calling convention type for the callback method. This will tend to be fatal for x86 DLLs that use the cdecl calling convention, like the SQLite dll.

In other words, if you change your callback definition to something like this:

[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate int Callback(IntPtr p, int n, [In][MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStr, SizeParamIndex = 1)] string[] names, [In][MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPStr, SizeParamIndex = 1)] string[] values);

It'll work with the x86 without corrupting the stack.

2020-12-30
00:16 Reply: Suggestion: Use strong hashes on the download page (artifact: abcf754b52 user: RandomCoder)

Any user that can download and run executables can download Fossil, OpenSSL, RHash, Python, Perl, or any number of other tools to verify the hash.

And since a common user of the SQLite downloads will have access to a compiler, they could just compile their own version of sha3sum.

Between that, and my assumption that only a small minority of users bother to verify the any hash or CRC beyond whatever verification their zip program does on its own, I'm not sure that means any Windows users are stuck.

2020-12-04
01:34 Reply: Can I get the file name of a temporary on-disk database? (artifact: eba1fb87fa user: RandomCoder)

While I feel that this is out of band for SQLite, that's up to the SQLite devs to make that call.

Could you not open a temp file using mktemp, write in an empty SQLite file you provide as part of your applications assets (and perhaps even have that file prepopulated with your basic schema if that makes sense), then use it as a normal db file using SQLite's normal interface?

2020-12-02
18:10 Reply: V 3.34.0 (artifact: cab14d24be user: RandomCoder)

The options need to come before the file:

SQLite version 3.34.0 2020-12-01 16:14:00
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
sqlite> .open dbname.db --readonly
sqlite> .databases
main: c:\test\dbname.db r/w
sqlite> .open --readonly dbname.db
sqlite> .databases
main: c:\test\dbname.db r/o
2020-11-17
23:08 Reply: Serious Sqlite command line Problems after Windows 10 update (artifact: d9cbe3c5e7 user: RandomCoder)

Unfortunately, it's probably not a Powershell issue. It lacks the redirect-in-from operator, but it provides a very big and fairly obvious error if you try.

    PS> sqlite3 < this_doesnt_matter.txt
    At line:1 char:9
    + sqlite3 < this_doesnt_matter.txt
    +         ~
    The '<' operator is reserved for future use.
        + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
        + FullyQualifiedErrorId : RedirectionNotSupported
23:05 Reply: Serious Sqlite command line Problems after Windows 10 update (artifact: 04985c2280 user: RandomCoder)

I created a simple text file test.sql with just one sqlite command .Help

and at the command prompt typed

sqlite3 <test.txt

This command should have resulted in a locale correct version of "The system cannot find the file specified.". If it didn't, either something is really broken with your system, or, more likely, you're not being exact in your problem description.

Can you create a text file, called test.txt containing at least 100 lines of text, and try running something like:

more < test.txt

If that command fails, you have some basic failure of the shell that will probably necessitate someone familiar with issues on Windows looking at the machine. I suspect debugging will be a fruitless endeavor, as we're probably missing something that to a subject matter expert would be obvious, but you're ignoring it because its something of unknown importance to you.

2020-10-02
21:41 Reply: .mode box does not seem to like UTF-8 (artifact: f65542debf user: RandomCoder)

This list of characters that will be double-width is known. For instance, some Python based projects use wcwidth to know when a character will take two spaces in the output.

I may take a stab at patching the shell to use this information for my own use at least. I'm not sure if the SQLite team wants to add such a feature to the shell.

2020-09-06
17:29 Reply: sqlite3 column truncation problem (artifact: cd40942bdd user: RandomCoder)

Your question seems to be:

Why is sqlite3's shell limiting output to 333 characters in some display modes that justify the output?

It turns out most of the output for these modes goes through this function:

static void utf8_width_print(FILE *pOut, int w, const char *zUtf){ int i; int n; int aw = w<0 ? -w : w; char zBuf[1000]; if( aw>(int)sizeof(zBuf)/3 ) aw = (int)sizeof(zBuf)/3;

This final safety check has the effect of limiting all output to 333 characters (aw>(int)sizeof(zBuf)/3). I know of no way around this limitation other than building your own version of the shell with the size of zBuf increased.

16:42 Reply: extension-functions.c - pre-compiled Windows Binary (artifact: 10d587707c user: RandomCoder)

For those that are trying to follow these directions to build their own copy of extension-functions.dll on a Windows machine, a few things to keep in mind:

You'll need a copy of the sqlite3 sources available. Generally, decompressing the sqlite3 amalgamation and copying the files from the zip file to a working directory alongside extension-functions.c is enough.

Also, speaking of working directories, you'll want to make a working folder to perform your work in. The example above suggests working in the root directory, but that will not work on most modern Windows installations, so make a directory to build in.

The command itself should be:

gcc -shared -o extension-functions.dll extension-functions.c

Note the correct filename extension-functions.c. This is the file you want to build, the extension-functions.dll name is a free form output filename of your choosing. You will use .load on this filename later in the sqlite shell.

And, the original post in this thread mentioned a request for a 32-bit DLL. That's likely the version you want as well, since the version of sqlite3.exe that's available on the SQLite website itself is 32-bit, so I think this is the command you'll want to run:

gcc -m32 -shared -o extension-functions.dll extension-functions.c

(I don't have a Windows machine to test this on to verify it works)

Good luck.

2020-08-31
21:01 Reply: System.Data.SQLite (artifact: 531323b237 user: RandomCoder)

What problem are you trying to solve replacing DLLs for programs you have on your hard drive?

As Larry suggests, it's probably going to cause grief, and I don't see any positive impacts.

2020-08-16
19:03 Reply: Difference between MATCH('x') and MATCH('x*') (artifact: f00f4c91e2 user: RandomCoder)

I think the key you're missing from the documentation is that FTS generally operates on tokens:

    sqlite> create virtual table example using fts5(content);
    sqlite> insert into example(content) values('x');
    sqlite> insert into example(content) values('xother');
    sqlite> select * from example where content match 'x';
    x
    sqlite> select * from example where content match 'x*';
    x
    xother
    sqlite>

The first select query only finds 'x' because that's the only entry with just that token, the other entry doesn't have the token 'x', rather it has the token 'xother'.

The second select query asks for all entries with any token that starts with 'x', so it finds both entries since they both have a token that starts with 'x'.

2020-07-17
00:52 Reply: SQLITE_HAS_CODE is gone? (artifact: 7d7f6633f1 user: RandomCoder)

And if it helps, I have a build from my build system available for download from here

Of course, you would be better off to follow the directions to build it yourself, if for no other reason than to have trust in the final binaries.