DynSQLite Library - SQLite support library

Started by Michele, November 09, 2026, 12:12:02 AM

Previous topic - Next topic

Vortex

Hi Timo,

Thanks for the GitHub link. I managed to compile the asprint function with Microsoft Visual C++ Compiler for Python 2.7

This addition was required to compile the code :

#ifndef EOTHER
#define EOTHER 131
#endif
Code it... That's all...

Michele

Hello all, I'm proud to announce the version V00.73.18.00 of DynSQLite.
Apart a lot of bugs that I found and removed, I have added many more features:
  • On opening the code checks for the consistency of input files. It is required because SQLite is very lazy on opening files, doesn't check them and return an handle also for wrong files.
  • The browser now shows the referenced data of foreign keys columns when mouse hover over it.
  • The record editor has been enriched:
    • Now the blobs that contain text are displayed as such and can be edited as text (should make happy John Z).
    • The editing of foreign keys permit to select which column of the referenced data to show for better understandability.
    • Now for blob columns is possible to view pictures or dump an hex display of contents.
    • The blobs can be saved to files from editor.
    • The blobs can be changed specifying a file to replace contents, but the update is effective only when the user selects Save. If the editor is cancelled the new file is dropped and the blob remains unchanged.
Implemented in many modules the WIN32_LEAN_AND_MEAN symbol.

The new package is available for download here.
I will appreciate feedbacks and bug reports.

Michele

Quote from: TimoVJL on <strong>Yesterday</strong> at 06:02:27 PMAs ucrt don't have function asprintf , it should suplied with optional code or just not use it.

An asprintf is a posix function.

https://github.com/eiszapfen2000/asprintf

The page isn't available, probably MS problems or blasts of american cyberstorm.
Anyway I'm implementing this:
#if defined(_MSC_VER) || defined(_WIN32)

/* Check if asprintf isn't already defined by another library or header */
#ifndef HAVE_ASPRINTF
#define HAVE_ASPRINTF

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>

/* Inline or static helper to avoid linker collisions if included in multiple translation units */
inline int asprintf(char **strp, const char *fmt, ...)
{
    if (!strp || !fmt)
        return -1;

    va_list args;
    va_start(args, fmt);
    int len = _vscprintf(fmt, args);
    if (len < 0)
    {
        va_end(args);
        *strp = NULL;
        return -1;
    }

    char *buf = (char *)malloc((size_t)len + 1);
    if (!buf)
    {
        va_end(args);
        *strp = NULL;
        return -1;
    }

    int written = vsnprintf(buf, (size_t)len + 1, fmt, args);
    va_end(args);

    if (written < 0)
    {
        free(buf);
        *strp = NULL;
        return -1;
    }

    *strp = buf;
    return written;
}

#endif /* HAVE_ASPRINTF */

#endif /* _MSC_VER || _WIN32 */