1. EDS Issue
- Posted by Icy_Viking Nov 03, 2021
- 565 views
Hello,
So I was trying to make a simple database using EDS, but I got the error the database was not created.
include std/eds.e if db_create("GameData",DB_LOCK_NO) != DB_OK then puts(1,"Failed to create database!\n") --this shows up in the console window abort(1) end if
2. Re: EDS Issue
- Posted by ghaberek (admin) Nov 03, 2021
- 559 views
Hello,
So I was trying to make a simple database using EDS, but I got the error the database was not created.
include std/eds.e if db_create("GameData",DB_LOCK_NO) != DB_OK then puts(1,"Failed to create database!\n") --this shows up in the console window abort(1) end if
Does the already database file exist?
If the database already exists, it will not be overwritten. db_create will return DB_EXISTS_ALREADY.
The value returned from db_create can be any of DB_OK, DB_EXISTS_ALREADY, DB_OPEN_FAIL, or DB_LOCK_FAIL.
I typically use this all-in-one approach. I also recommend using DB_LOCK_EXCLUSIVE by default to ensure your application has full access to the file.
public function db_load( sequence path, integer lock_method=DB_LOCK_EXCLUSIVE ) if db_select( path ) = DB_OK then return DB_OK end if if db_open( path, lock_method ) = DB_OK then return DB_OK end if return db_create( path, lock_method ) end function
-Greg
3. Re: EDS Issue
- Posted by Icy_Viking Nov 04, 2021
- 555 views
Hello,
So I was trying to make a simple database using EDS, but I got the error the database was not created.
include std/eds.e if db_create("GameData",DB_LOCK_NO) != DB_OK then puts(1,"Failed to create database!\n") --this shows up in the console window abort(1) end if
Does the already database file exist?
If the database already exists, it will not be overwritten. db_create will return DB_EXISTS_ALREADY.
The value returned from db_create can be any of DB_OK, DB_EXISTS_ALREADY, DB_OPEN_FAIL, or DB_LOCK_FAIL.
I typically use this all-in-one approach. I also recommend using DB_LOCK_EXCLUSIVE by default to ensure your application has full access to the file.
public function db_load( sequence path, integer lock_method=DB_LOCK_EXCLUSIVE ) if db_select( path ) = DB_OK then return DB_OK end if if db_open( path, lock_method ) = DB_OK then return DB_OK end if return db_create( path, lock_method ) end function
-Greg
Thanks Greg, it must have already existed.