Commit graph

140 commits

Author SHA1 Message Date
syrmel
6a4f2937ef
vtest,pref: add ability to have platform specific _test.v files (#20810) 2024-02-13 12:06:47 +02:00
Delyan Angelov
5269c02faf
ast: make Scope.find methods more robust, when called on default initialised scope &Scope = unsafe { nil } fields (#20774) 2024-02-10 19:53:10 +02:00
Casper Küthe
3bd99309dd
x.vweb: add new sessions module (#20642) 2024-02-07 19:00:48 +02:00
Casper Küthe
d88ca11a4c
picoev, x.vweb: small fixes and backport changes from vweb (#20584) 2024-01-23 18:34:22 +02:00
gym603
bc37c85cae
tests: make 'test-self' pass under msys2/MINGW32 (#20614) 2024-01-22 01:20:53 +02:00
gym603
9f95ab7c5e
tests: make v test-self run _test.c.v files too (#20612) 2024-01-21 21:11:23 +02:00
Delyan Angelov
6107e0d154
tests: show compile time and runtime for each _test.v file in separate columns (#20520) 2024-01-20 17:38:46 +02:00
Felipe Pena
1303c244e2
orm.pg: fix f32 and f64 endianness (#20412) 2024-01-06 22:27:10 +02:00
Anton
18954afa73
cgen: escape table names (fix #20313) (#20322) 2024-01-01 15:23:25 +02:00
jacksonmowry
06a536eff2
db.pg: fix invalid memory access in res_to_rows (#20248) 2023-12-22 02:02:31 +02:00
jacksonmowry
d86a11c257
db.mysql: add ability to prepare and execute statements separately (#20146) 2023-12-11 13:34:20 +02:00
Casper Küthe
08189d649c
vweb2 (#19997) 2023-12-09 08:07:51 +03:00
Felipe Pena
dfab24b936
orm: fix code generated for fields of ?[]Type (#20032) 2023-11-30 23:36:50 +02:00
Delyan Angelov
0c4abf0c19
ci: skip the cmd/tools/vpm/ tests on the fsanitize_memory jobs, because of the handshake code in net.mbedtls, which uses assembly, that is known to sporadically fail the sanitizer 2023-11-30 23:16:49 +02:00
Felipe Pena
00b1ce5760
orm: fix code generation for an option time.Time field (#20031) 2023-11-29 19:30:34 +02:00
gym603
46086c046f
tests: make 'v test-self' pass under msys2/MINGW64 (#20010) 2023-11-28 15:03:30 +02:00
Alexander Medvednikov
f09826e928 all: unwrap const() blocks 2023-11-25 10:02:51 +03:00
JalonSolov
0da00cc457
v: prepare for making -W impure-v the default (#19940) 2023-11-20 09:17:59 +02:00
Delyan Angelov
c8382264a4
ci,tools: remove skips for the wasm backend, since binaryen is not required anymore (#19883) 2023-11-15 20:30:14 +02:00
JalonSolov
c494b63d75
os,picohttpparser,sokol,strconv: prepare for making -W impure-v the default (#19846) 2023-11-12 09:52:14 +02:00
Casper Küthe
c0eeb85eab
net.unix: update the module to make it compatible with windows and coroutines (#19831) 2023-11-11 10:07:56 +02:00
JalonSolov
01022e918e
flag,json,net: handle C calls in .v files (part of enabling -W impure-v as default) (#19779) 2023-11-06 14:27:00 +02:00
JalonSolov
f1ba664e92
builtin: move builtin_test.v to builtin_test.c.v (part of making -W impure-V the default) (#19757) 2023-11-04 10:14:50 +02:00
Turiiya
3e50ba0856
ci: update and cleanup the ci related code (#19541) 2023-10-10 21:39:00 +03:00
Tim Marston
756075380b
orm: add null handling and option fields (#19379)
* orm: added is none and !is none handling

* orm: added NullType, support option fields and deprecate [nonull]

Nullable DB fields are now determined by corresponding option struct field.  The
[nonull] attribute is deprecated and fields are all NOT NULL now, unless they
are option fields. New orm primitive, NullType, added to support passing none
values to db backends, which have been updated to support it.  Also, empty
string and 0 numberic values are no longer skipped during insert (since they may
be valid values).

* orm: fix [nonull] deprecation warning

* orm: add null handling to update and select

also, improved formatting for orm cgen, and removed optimised operand handling
of orm `is` and `!is` operators

* sqlite: read/report NULLs using new orm NullType

* postgres: returning data primitives now returns new orm.NullType

* orm: initialise NullType Primitives properly

* orm: do not smart cast operands inside sql

* orm: fix bad setting of option value

* orm: improve orm_null_test.v, adding/fixing selects

* orm: cleanup: rename NullType->Null, use serial const, cgen output

* orm: handle automatically generated fields more explicitly

During insert, fields which are
* [sql: serial]
* [default: whatever]
and where the data is a default value (e.g., 0, ""), those fields are not sent
to the db, so that the db can generate auto-increment or default values.  (This
was previously done only for [primary] fields, and not in all circumstances, but
that is not correct -- primary and serial/auto-increment fields are differnet.)

* orm: udpated README

* orm: select cgen fixes: read from uninit res; fail to init res

* orm: udpated tests

* orm: fix option sub-struct fields

* orm: fixed joins to option structs

Changed orm.write_orm_select() so that you pass to it the name of a resut
variable which it populates with the result (or not) and changed use of it in
sql_select_expr() and calls in write_orm_select() to populate substructs.

* orm: fix pg driver handling of NULL results

* orm: move runtime checks to comptime checker; cache checked tables

* orm: vfmt :(

* orm: markdown formatting

* orm: renamed orm.time_ and orm.enum_; updated db drivers

* checker: updated orm tests

* orm: fix issue setting up ast option values as orm primitives

* checker: ORM use of none/options and operations (added tests)

* orm: fixed tests

* db: clean code

* examples: remove orm nonull attributes

* orm: skip test memory santisation for orm_null_test.v

* orm: make the type-to-primitive converstion fns not public

* orm: mv object var c-code from checker->cgen; fix memory corruption

Code in checker/orm.v used the SqlStmtLine object field name to store c-specific
referenecs to option and array fields (for arrays of children).  I moved this
logic to cgen.  And fixed an issue introduced with option fields, where an array
of children was unpacked into a non-array result which could corrupt memory.

* orm: fixed vast error

* orm: skip 2 tests on ubuntu-musl which require sqlite3.h

* cgen: prevent casting a struct (string)

* v fmt orm_fkey_attribute.vv, orm_multidim_array.vv, orm_table_attributes.vv; run `VAUTOFIX=1 ./v vlib/v/compiler_errors_test.v`
2023-10-05 19:09:03 +03:00
yuyi
74997fd824
ast, cgen: fix as cast with call expr (fix #19453) (#19462) 2023-09-29 11:59:14 +03:00
Casper Küthe
74d80a5120
orm: add support for V enum struct fields (#19374) 2023-09-18 16:06:26 +03:00
asvln
2cce907dcb
orm: add references attribute to allow foreign key declarations on fields (#19349) 2023-09-16 12:04:32 +03:00
Casper Küthe
e8d133d548
orm: fix cgen inserting wrong array index (#19324) 2023-09-12 14:50:13 +03:00
yuyi
18e60e77de
fmt: remove inline comments (#19263) 2023-09-03 23:51:56 +03:00
Delyan Angelov
58b6ba81d1
builtin: implement array.sorted() and array.sorted_with_compare() methods, that do not modify their receivers (#19251) 2023-09-01 09:12:00 +03:00
jacksonmowry
d285ff08f0
db.mysql: add the exec family of methods (#19132) 2023-08-14 16:18:01 +03:00
Etienne Girondel
492e918fdb
builder,pref: allow thirdparty objects compilation with CPP compiler (#19124) 2023-08-13 20:30:28 +03:00
Delyan Angelov
e3ade704cb
tools: remove remaining references to vlib/sqlite, vlib/mysql, vlib/pg (and make v test-cleancode fail *loudly*, when a folder is missing, regression after a421e485f). 2023-08-03 23:10:02 +03:00
Ulises Jeremias Cornejo Fandos
02ea6028af
vlib: improvements to the context module (#18318) 2023-06-04 18:12:52 +02:00
Mark aka walkingdevel
3fb32a866c
all: like operator/keyword for V ORM (#18020) 2023-04-23 03:40:54 +03:00
yuyi
95d1beb008
cgen: fix c struct with reserved field name (fix #17993) (#17996) 2023-04-21 19:41:13 +03:00
walking devel
8452644ec3
orm: enforce that queries always return a Result, a query-resulting array can be used as a V array in place. (#17871) 2023-04-04 08:23:06 +03:00
Felipe Pena
9e7aeec215
sql: fix wrong field name on generated code (#17684) 2023-03-17 21:45:52 +01:00
walking devel
3682a9cf88
orm: allow use of mut db orm.Connection (#17439) 2023-03-01 00:49:30 +02:00
l-m
0625caad56
wasm: add a webassembly compiler backend, based on using binaryen (#17368) 2023-02-28 23:58:53 +02:00
walking devel
b7b6c2368e
orm: allow using connections, that were explicitly casted to orm.Connection too (#17427) 2023-02-27 23:54:03 +02:00
Delyan Angelov
9c511e03f6
tools: remove import v.pref, just for pref.vexe_path(), to compile tools faster (#17411) 2023-02-26 07:56:14 +02:00
yuyi
b5b1efbb7b
cgen: fix sumtype as cast with calling twice (#17196) 2023-02-02 13:57:37 +02:00
Delyan Angelov
6572d597f9
Revert "cgen: fix sumtype as cast with calling twice (fix #17156) (#17183)"
This reverts commit 90ae3c82c9.
2023-02-02 10:49:15 +02:00
yuyi
90ae3c82c9
cgen: fix sumtype as cast with calling twice (fix #17156) (#17183) 2023-02-02 09:31:11 +02:00
walking devel
4747e70d9d
orm: make last_id() return int, instead of orm.Primitive (fix #12110) (#17151) 2023-01-29 16:00:23 +02:00
walking devel
9a86456365
cgen: support string interpolation in ORM queries (#17141) 2023-01-29 01:27:34 +02:00
walking devel
a9a04bba55
orm: support fn calls in where (#17127) 2023-01-26 22:36:30 +02:00
walking devel
2fb9bdce9a
cgen, checker: add panic in ORM for invalid queries, when there are no or {} blocks, add type checking for the fkey attribute, add tests (#16977) 2023-01-17 20:21:10 +02:00