Giter VIP home page Giter VIP logo

openradtool's People

Contributors

dependabot[bot] avatar kristapsdz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

openradtool's Issues

Unclear update function return value

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?

Dates before unix epoch not considered valid

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 cases for FTYPE_DATE and FTYPE_EPOCH in the function linked below ought to fix this.

gen_func_valid_types(const struct field *f, const struct fvalid *v)

audit.c missing from DOTAR

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')

musl: ort-diff: regress/diff/search-mod-distinct.{old,new}.ort... fail (output check)

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

Ordering does not work with more than two iterate statements in one struct

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).

Generated db.c is missing kcgi include

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>

database field names with underscores

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.