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

db.sqlite.SQLError on Windows 11 by download from releases #20744

Open
sanrentai opened this issue Feb 7, 2024 · 7 comments
Open

db.sqlite.SQLError on Windows 11 by download from releases #20744

sanrentai opened this issue Feb 7, 2024 · 7 comments
Labels
Bug This tag is applied to issues which reports bugs. OS: Windows Bugs/feature requests, that are specific to Windows OS.

Comments

@sanrentai
Copy link

sanrentai commented Feb 7, 2024

Describe the bug

copy codes from tutorials/building_a_simple_web_blog_with_vweb/README.md

v run .

SQLError

Reproduction Steps

study by read this https://github.com/vlang/v/blob/master/tutorials/building_a_simple_web_blog_with_vweb/README.md

// blog.v

import db.sqlite
import vweb

struct App {
	vweb.Context
pub mut:
	db sqlite.DB
}

fn main() {
	mut app := App{
		db: sqlite.connect(':memory:')!
	}
	sql app.db {
		create table Article
	}!

	first_article := Article{
		title: 'Hello, world!'
		text: 'V is great.'
	}

	second_article := Article{
		title: 'Second post.'
		text: 'Hm... what should I write about?'
	}

	sql app.db {
		insert first_article into Article
		insert second_article into Article
	}!
	vweb.run(app, 8080)
}

pub fn (app &App) index() vweb.Result {
	articles := app.find_all_articles()
	return $vweb.html()
}
// article.v
module main

struct Article {
	id    int    @[primary; sql: serial]
	title string
	text  string
}

pub fn (app &App) find_all_articles() []Article {
	return sql app.db {
		select from Article
	} or { panic(err) }
}
<html>
  <head>
    <title>V Blog</title>
  </head>
  <body>
    @for article in articles
    <div>
      <b>@article.title</b> <br />
      @article.text
    </div>
    @end
  </body>
</html>

Expected Behavior

no panic

Current Behavior

V panic: db.sqlite.SQLError: near "FROM": syntax error (1) (SELECT FROM Article;); code: 1
v hash: a374d25
D:/AppData/Local/Temp/v_0/blog.01HP11QX23SP6K5M8YZ3QN00NF.tmp.c:14501: at _v_panic: Backtrace
D:/AppData/Local/Temp/v_0/blog.01HP11QX23SP6K5M8YZ3QN00NF.tmp.c:41298: by main__App_find_all_articles
D:/AppData/Local/Temp/v_0/blog.01HP11QX23SP6K5M8YZ3QN00NF.tmp.c:41443: by main__App_index
D:/AppData/Local/Temp/v_0/blog.01HP11QX23SP6K5M8YZ3QN00NF.tmp.c:40841: by vweb__handle_route_T_main__App
D:/AppData/Local/Temp/v_0/blog.01HP11QX23SP6K5M8YZ3QN00NF.tmp.c:40721: by vweb__handle_conn_T_main__App
D:/AppData/Local/Temp/v_0/blog.01HP11QX23SP6K5M8YZ3QN00NF.tmp.c:41252: by vweb__Worker_T_main__App_process_incoming_requests_T_main__App
D:/AppData/Local/Temp/v_0/blog.01HP11QX23SP6K5M8YZ3QN00NF.tmp.c:8423: by vweb__Worker_T_main__App_process_incoming_requests_T_main__App_thread_wrapper
0092b3c : by ???
009275fe : by ???
0092b408 : by ???
7ff8a3df53e0 : by ???

Possible Solution

orm.SelectConfig{
table: 'Article'
is_count: false
has_where: false
has_order: false
order: ''
order_type: asc
has_limit: false
primary: ''
has_offset: false
fields: []
types: []
}

I found the fields is empty.
I do not know how to resolve this bug?
pub fn (db DB) @select(config orm.SelectConfig, data orm.QueryData, where orm.QueryData) ![][]orm.Primitive
how the config come here?

Additional Information/Context

I compile v.exe from source code.
It is ok now!
weekly.2024.06 cannot work on windows 11

V version

V 0.4.4 a374d25

Environment details (OS name and version, etc.)

V full version: V 0.4.4 a374d25
OS: windows, Microsoft Windows 11

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

@sanrentai sanrentai added the Bug This tag is applied to issues which reports bugs. label Feb 7, 2024
@felipensp
Copy link
Member

It runs fine on Linux.

@viniciusfdasilva
Copy link
Contributor

In Windows 10, it's also running normally.

@sanrentai
Copy link
Author

In Windows 10, it's also running normally.

I use sqlite C source code as an amalgamation, version 3.45.1.
What version are you useing?

@viniciusfdasilva
Copy link
Contributor

@sanrentai I use the same version copying source code to v/thirdparty/sqlite/

@sanrentai sanrentai changed the title db.sqlite.SQLError db.sqlite.SQLError on Windows 11 Feb 8, 2024
@sanrentai
Copy link
Author

sanrentai commented Feb 8, 2024

@viniciusfdasilva

Your v.exe is download from releases or compiled by yourself?

@sanrentai sanrentai changed the title db.sqlite.SQLError on Windows 11 db.sqlite.SQLError on Windows 11 by download from releases Feb 8, 2024
@viniciusfdasilva
Copy link
Contributor

@sanrentai I cloned the repository and executed v.bat

@felipensp felipensp added the OS: Windows Bugs/feature requests, that are specific to Windows OS. label Feb 9, 2024
@lightcax
Copy link

lightcax commented Feb 26, 2024

I get same error when I use the select in win10, but update insert is ok
message: near "FROM": syntax error (1) (SELECT FROM User;); code: 1

module main
import db.sqlite

@[table: 'User']
struct User {
	id   int @[primary; sql: serial]
	name string
	age  int
}
fn main() {
	mut db := sqlite.connect('user.db') or { panic(err) }
	// sql db {
	// 	create table User
	// }!
	// mut user := User{
	// 	name: 'xxx'
	// 	age: 10
	// }
	// sql db {
	// 	insert user into User
	// }!
	mut tuser:= sql db {
	        select from User
	} or {
	 	println(err)
	 	[]User{}
	}
	println(tuser)

}

Looks like the same problem.
Compile v.exe from source code, is ok. Download from releases exe is error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs. OS: Windows Bugs/feature requests, that are specific to Windows OS.
Projects
None yet
Development

No branches or pull requests

4 participants