1. EuMVC-SQlite3:Weird Unassigned Variable Issue

Am I going crazy?

include std/console.e 
include sqlite3.e 
 
-- prepare the sqlite3 db 
atom sqlitedb = 0 
integer sqliteResult = 0 
 
puts(1,"\nOpening the SQLite3 database: test.sqlite") 
-- {sqliteResult,sqlitedb} = sqlite3_open("test.sqlite") 
puts(1,"\n\tDone!") 
 
?sqliteResult 
?sqlitedb 
 
wait_key() 
 
-- sqlite3_close(sqlitedb) 

Result:

Opening the SQLite3 database: test.sqlite 
    Done!0 
 
C:\Users\FOADDEV\Programs\HTF License Server Tools\codes_viewer\sqlite_test.exw:13 
variable sqlitedb has not been assigned a value 
 
--> See ex.err 

Why does it claim sqlitedb has not been assigned a value?

If I comment out the "include sqlite3.e" line, it works fine!

new topic     » topic index » view message » categorize

2. Re: EuMVC-SQlite3:Weird Unassigned Variable Issue

euphoric said...

Why does it claim sqlitedb has not been assigned a value?

If I comment out the "include sqlite3.e" line, it works fine!

Are you using the MVC wrapper or do you have another "sqlite3.e" somewhere else?

You should have your Euphoria include paths pointing to the MVC include/ directory and reference things from there.

I typically do this in eu.cfg:

[all] 
-i ../euphoria-mvc/include 

So you should use include db/sqlite3.e or include mvc/app.e, etc. But you have include sqlite3.e.

-Greg

new topic     » goto parent     » topic index » view message » categorize

3. Re: EuMVC-SQlite3:Weird Unassigned Variable Issue

ghaberek said...
euphoric said...

Why does it claim sqlitedb has not been assigned a value?

If I comment out the "include sqlite3.e" line, it works fine!

Are you using the MVC wrapper or do you have another "sqlite3.e" somewhere else?

The MVC/Sqlite3 wrapper

ghaberek said...

You should have your Euphoria include paths pointing to the MVC include/ directory and reference things from there.

I just moved it from the repo into the app directory. It's sitting right there with the source.

Oh, this is not an MVC app!

I had to comment references to the logging library.

Is that not a good way to use it?

new topic     » goto parent     » topic index » view message » categorize

4. Re: EuMVC-SQlite3:Weird Unassigned Variable Issue

euphoric said...
ghaberek said...
euphoric said...

Why does it claim sqlitedb has not been assigned a value?

If I comment out the "include sqlite3.e" line, it works fine!

Are you using the MVC wrapper or do you have another "sqlite3.e" somewhere else?

The MVC/Sqlite3 wrapper

ghaberek said...

You should have your Euphoria include paths pointing to the MVC include/ directory and reference things from there.

I just moved it from the repo into the app directory. It's sitting right there with the source.

Oh, this is not an MVC app!

I had to comment references to the logging library.

Is that not a good way to use it?

Oh. Well, aside from the logger references it should be fine. Eventually I'd like to move this to Euphoria along with a bunch of other MVC stuff.

But sqlite3_open() in the MVC wrapper should always to return a sequence of two values, and the result you're getting indicates that it's only returning one (an atom).

Either that or something weird is going on with multiple assignment. (You are using Euphoria 4.1, right?)

What happens when you run this:

include sqlite3.e 
? sqlite3_open( "test.db" ) 

You should see a sequence like {0,12345...} which is the result code (SQLITE_OK) and the database handle (a memory address).

If you're including the wrong file, you can try to locate it like this:

include std/filesys.e 
include std/pretty.e 
 
pretty_print( 1, locate_file("sqlite3.e",include_paths(0)), {2} ) 

-Greg

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu