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

fetch data from sqllite module give me 'ERR_SQLITE_ERROR', #55577

Closed
sharafabacery opened this issue Oct 28, 2024 · 12 comments
Closed

fetch data from sqllite module give me 'ERR_SQLITE_ERROR', #55577

sharafabacery opened this issue Oct 28, 2024 · 12 comments
Labels
confirmed-bug Issues with confirmed bugs. sqlite Issues and PRs related to the SQLite subsystem. windows Issues and PRs related to the Windows platform.

Comments

@sharafabacery
Copy link

Version

v22.10.0

Platform

windows 10 x64

Subsystem

No response

What steps will reproduce the bug?

`import path from 'node:path';

import {DatabaseSync} from 'node:sqlite'

export class Connectdb{

dbConnectionString:string;

database:any

constructor(dbConnectionString:string){

    this.dbConnectionString=dbConnectionString

}

Connect(){

    this.database=new DatabaseSync(this.dbConnectionString);

}

RetriveData() {

    const query = this.database.prepare('SELECT * FROM "titles" ');  

    console.log(query.all())

}

}

let obj=new Connectdb('../database.db')

obj.Connect()

obj.RetriveData()

`

How often does it reproduce? Is there a required condition?

always it produce

What is the expected behavior? Why is that the expected behavior?

get data I need

What do you see instead?

`const query = this.database.prepare('SELECT * FROM "titles" ');
^

Error: no such table: titles
{
code: 'ERR_SQLITE_ERROR',
errcode: 1,
errstr: 'SQL logic error'
}

`
and titles found in the database

Additional information

No response

@cjihrig
Copy link
Contributor

cjihrig commented Oct 28, 2024

Error: no such table: titles

That seems to be the problem?

@sharafabacery
Copy link
Author

The table in database is exsiten

@cjihrig
Copy link
Contributor

cjihrig commented Oct 28, 2024

Not according to SQLite 😄

@sharafabacery
Copy link
Author

@cjihrig nice😀

@sharafabacery
Copy link
Author

@cjihrig could problem because of windows os?

@RedYetiDev
Copy link
Member

If you load the database in a seperate client, is the "titles" table existent?

@sharafabacery
Copy link
Author

yes I load in "DB Browser (SQLite)" and it show correctly
Capture3

@cjihrig
Copy link
Contributor

cjihrig commented Oct 28, 2024

could problem because of windows os?

Windows is supported and tested, but it's possible. What if you update Connectdb('../database.db') to use backslashes?

@sharafabacery
Copy link
Author

it solves the problem thanks

@cjihrig cjihrig added confirmed-bug Issues with confirmed bugs. windows Issues and PRs related to the Windows platform. sqlite Issues and PRs related to the SQLite subsystem. labels Oct 28, 2024
@huseyinacacak-janea
Copy link
Contributor

Hi @sharafabacery, I wanted to look into this issue but couldn't reproduce it (I tried Node 22.10.0, and 23.1.0). I used the code you've provided in the description and the attached database. Could you please try to run the code with the attached db?
database.zip

@sharafabacery
Copy link
Author

when I get back to code last week I change the path to basedir/databasefile.db it works fine could be problem happen when compile ts to js ,but if need to explore the code here the repo https://github.com/sharafabacery/hisnmuslimTs

@StefanStojanovic
Copy link
Contributor

Since this seems to be working now, I'll close the issue. Feel free to reopen if needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug Issues with confirmed bugs. sqlite Issues and PRs related to the SQLite subsystem. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

No branches or pull requests

5 participants