kristapsdz / openradtool Goto Github PK
View Code? Open in Web Editor NEWapplication source generator
Home Page: https://kristaps.bsd.lv/openradtool
License: ISC License
application source generator
Home Page: https://kristaps.bsd.lv/openradtool
License: ISC License
Maybe I am just missing something, but I figured I would ask to be on the safe side: Next to the function prototype for db_update
functions, ort
generates documentation as follows (header.c:265):
print_commentt(0, COMMENT_C_FRAG_CLOSE,
"Returns zero on failure, non-zero on "
"constraint errors.");
This leaves me wondering: What is the return value if the update is successful?
Looking at the generated code for the update functions did not help clarify things either as it appears to work exactly as documented: return(KSQL_CONSTRAINT != c);
Maybe there should be a check for KSQL_DONE
?
Thank you very much for providing these (kcgi, openradtool, etc) tools! I've noticed that the valid-checks generated by ort-source
seem to mark unix times from before 1970 as invalid (as they are non-negative). I'm not sure what the implications of doing so are, but deleting the case
s for FTYPE_DATE
and FTYPE_EPOCH
in the function linked below ought to fix this.
Line 1771 in ede695b
Looks like it has been missing since 0.4.0'ish:
cc -o kwebapp audit.o comments.o compats.o header.o linker.o javascript.o main.o parser.o printer.o protos.o source.o sql.o
cc: error: no such file or directory: 'audit.o'
*** Error 1 in /build/kwebapp-0.4.6/kwebapp-0.4.6 (Makefile:85 'kwebapp')
This test case currently fails with musl libc, I was not able to find the reason:
ort-diff: regress/diff/search-mod-distinct.{old,new}.ort... fail (output check)
--- /tmp/tmp.nSwyhQCqrW 2021-05-09 00:59:23.739320124 +0000
+++ regress/diff/search-mod-distinct.result 2021-05-06 13:38:39.000000000 +0000
@@ -1,8 +1,8 @@
--- regress/diff/search-mod-distinct.old.ort
+++ regress/diff/search-mod-distinct.new.ort
@@ strcts @@
- strct regress/diff/search-mod-distinct.old.ort:1:10 -> regress/diff/search-mod-distinct.new.ort:1:10
strct regress/diff/search-mod-distinct.old.ort:5:10 -> regress/diff/search-mod-distinct.new.ort:5:10
+ strct regress/diff/search-mod-distinct.old.ort:1:10 -> regress/diff/search-mod-distinct.new.ort:1:10
@@ strct regress/diff/search-mod-distinct.old.ort:9:10 -> regress/diff/search-mod-distinct.new.ort:9:10 @@
@@ search regress/diff/search-mod-distinct.old.ort:17:8 -> regress/diff/search-mod-distinct.new.ort:17:8 @@
! search distinct regress/diff/search-mod-distinct.old.ort:17:8 -> regress/diff/search-mod-distinct.new.ort:17:8
Hi,
The generated db.h did not include the TAILQ import when my config included a list entry.
#include <sys/queue.h>
First of all: Thank you for this software! You have just allowed me to use my favorite programming language for web development.
I did encounter a bug in kwebapp though:
If there are two ordered iterate
statements in a struct
, the order
of the first statement is ignored when creating the SQL query.
Example
DB file:
struct test {
field id int;
field time epoch;
field somedata int;
iterate: order time desc;
iterate somedata: order time desc;
};
kwebapp-c-source
outputs
static const char *const stmts[STMT__MAX] = {
/* STMT_TEST_BY_SEARCH_0 */
"SELECT " DB_SCHEMA_TEST(test) " FROM test",
/* STMT_TEST_BY_SEARCH_1 */
"SELECT " DB_SCHEMA_TEST(test) " FROM test WHERE test.somedata = ? ORDER BY test.time DESC",
/* STMT_TEST_INSERT */
"INSERT INTO test (id,time,somedata) VALUES (?,?,?)",
};
STMT_TEST_BY_SEARCH_0
should also include ORDER BY test.time DESC
.
This bug also occurs when the requested ordering of the two statements is different (one of them is asc
, the other is desc
).
My C is a bit rusty, but I think this may be an issue. If I generate c header and code with the -j option, the generated db.c does not include kcgi.h. The compile fails with errors like this:
enum kcgi_err kjson_open(struct kjsonreq *, struct kreq *);
^
db.c:168:2: error: calling 'kjson_putintp' with incomplete return type 'enum kcgi_err'
kjson_putintp(r, "id", p->id);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/include/kcgijson.h:61:15: note: 'kjson_putintp' declared here
Applying this patch to the generated db.c makes the compile succeed:
--- db.c.orig Mon Mar 26 16:10:55 2018
+++ db.c Mon Mar 26 16:12:00 2018
@@ -10,6 +10,7 @@
#include <string.h>
#include <unistd.h>
+#include <kcgi.h>
#include <ksql.h>
#include <kcgijson.h>
Hi Kristaps,
This config fails to build:
struct gig {
field gig_id int;
};
with the error:
$ kwebapp-c-header <t.conf
kwebapp-c-header: <stdin>:2:12: unknown input token
kwebapp-c-header: <stdin>:2:12: expected field type
$
If I remove the underscore, it works fine. Are underscores allowed in field names?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.