I'm still looking at why fossil-scm compiled by tcc do not work properly and found that now the problem is with the sqlite3 sources compiled with tcc, in a place where we have a fossil repository database I run this:
#include <stdio.h>
#include <stdarg.h>
#include "src/sqlite3.h"
static int mydb_exists(sqlite3 *db, const char *zSql, ...){
va_list ap;
int rc;
va_start(ap, zSql);
sqlite3_stmt *pStmt;
rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0);
va_end(ap);
printf("%s:%d -> %d %s\n", __FILE__, __LINE__, rc, zSql);
rc = sqlite3_step(pStmt);
printf("%s:%d -> %d %s\n", __FILE__, __LINE__, rc, zSql);
if( rc !=SQLITE_ROW ) {
rc = 0;
}else{
rc = 1;
}
sqlite3_finalize(pStmt);
return rc;
}
static const char *sql = "SELECT "
" blob.rid AS blobRid, "
" uuid AS uuid, "
" datetime(event.mtime) AS timestamp, "
" coalesce(ecomment, comment) AS comment, "
" coalesce(euser, user) AS user, "
" blob.rid IN leaf AS leaf, "
" bgcolor AS bgColor, "
" event.type AS eventType, "
" (SELECT group_concat(substr(tagname,5), ', ') FROM tag, tagxref "
" WHERE tagname GLOB 'sym-*' AND tag.tagid=tagxref.tagid "
" AND tagxref.rid=blob.rid AND tagxref.tagtype>0) AS tags, "
" tagid AS tagid, "
" brief AS brief, "
" event.mtime AS mtime "
" FROM event CROSS JOIN blob "
"WHERE blob.rid=event.objid "
" AND NOT EXISTS(SELECT 1 FROM tagxref WHERE tagid=5 AND tagtype>0 AND rid=blob.rid) ORDER BY event.mtime DESC LIMIT 20";
int main() {
sqlite3 *db;
int rc = sqlite3_open_v2(
"fossil.fossil", &db,
SQLITE_OPEN_READWRITE, NULL);
printf("%d Exists %d\n", rc, mydb_exists(db, sql));
sqlite3_close(db);
return 0;
}
And get results from the test-query-gcc but no results from test-query-tcc, now I'll try to get more close to the problem.