Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

orm: init or implementation #14989

Merged
merged 19 commits into from
Aug 31, 2022
Merged

orm: init or implementation #14989

merged 19 commits into from
Aug 31, 2022

Conversation

LouisSchmieder
Copy link
Member

@LouisSchmieder LouisSchmieder commented Jul 7, 2022

This PR adds or to the orm:

import sqlite

struct Foo {
	id int [primary; sql: serial]
}

fn main() {
	db := sqlite.connect(':memory:') ?

	mut foo := Foo{}

	sql db {
		insert foo into Foo
	} or {
		eprintln(err)
	}

	res := sql db {
		select from Foo
	} or {
		[]Foo{}
	}


	eprintln(res)
}

TODO:

  • Add checker tests
  • Add general tests for or expr

@medvednikov
Copy link
Member

 FAIL  [ 155/1035]   454.691 ms vlib/orm/orm_test.v
================ V panic ================
   module: builtin
 function: slice()
  message: array.slice: invalid slice index (0 > -1)
     file: /home/runner/work/v/v/vlib/builtin/array.v:485
   v hash: f468883

@LouisSchmieder
Copy link
Member Author

I'll convert it do a draft anyways

@LouisSchmieder
Copy link
Member Author

Thanks @spytheman didn't knew exactly the or things

@LouisSchmieder LouisSchmieder marked this pull request as ready for review July 10, 2022 01:46
@medvednikov
Copy link
Member

FAIL  [ 156/1038]  6280.150 ms vlib/orm/orm_sql_or_blocks_test.v
[/home/runner/work/v/v/vlib/v/gen/c/sql.v:782] g.inside_call: false
[/home/runner/work/v/v/vlib/v/gen/c/sql.v:782] g.inside_call: false
[/home/runner/work/v/v/vlib/v/gen/c/sql.v:782] g.inside_call: false
Uninitialized bytes in __interceptor_strlen at offset 31 inside [0x703000000578, 32)
==17656==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x7f41c9905c3a  (/lib/x86_64-linux-gnu/libsqlite3.so.0+0x44c3a)
    #1 0x7f41c993de4b  (/lib/x86_64-linux-gnu/libsqlite3.so.0+0x7ce4b)
    #2 0x7f41c99aa10b  (/lib/x86_64-linux-gnu/libsqlite3.so.0+0xe910b)
    #3 0x7aaee4 in sqlite__connect (/tmp/v/test_session_124359337987/orm_sql_or_blocks_test+0x7aaee4)
    #4 0x7b0630 in main__test_ensure_db_exists_and_user_table_is_ok (/tmp/v/test_session_124359337987/orm_sql_or_blocks_test+0x7b0630)
    #5 0x7c35ac in main (/tmp/v/test_session_124359337987/orm_sql_or_blocks_test+0x7c35ac)
    #6 0x7f41c9554082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:[308](https://github.com/vlang/v/runs/7267602782?check_suite_focus=true#step:7:309):16
    #7 0x41d64d in _start (/tmp/v/test_session_124359337987/orm_sql_or_blocks_test+0x41d64d)

@LouisSchmieder
Copy link
Member Author

Will continue this pr after the 1th August probably, bc of holidays

@enghitalo
Copy link
Contributor

Friendly Ping?

@spytheman spytheman merged commit 6110373 into vlang:master Aug 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants