1. Rob: database.e update for v2.5

I don't like database.e crashing my Win32Lib apps. Its very messy, and
I'm sure quite alarming for a user who doesn't expect a crash and a
DOS box to popup. My biggest issue was with db_rename_table() crashing
when a table didn't exist. I've updated it and turned it into a
function. Please consider this for Euphoria Database v2.5. I'd like if
database.e returns an error for all issues, rather than crashing with
fatal().

global function db_rename_table(sequence name, sequence new_name)
-- rename an existing table
-- written by Jordah Ferguson
-- updated by Greg Haberek
    atom table,table_ptr 
    
    table = table_find(name)
    if table = -1 then 
        return DB_OPEN_FAIL
    end if
    
    if table_find(new_name) != -1 then
        return DB_EXISTS_ALREADY
    end if
    
    safe_seek(table)
    db_free(get4())
    
    table_ptr = db_allocate(length(new_name)+1)
    putn(new_name & 0)
    
    safe_seek(table)
    put4(table_ptr)
    return DB_OK
end function


new topic     » topic index » view message » categorize

2. Re: Rob: database.e update for v2.5

I somewhat agree with your idea to have database.e commands return a booleen
value from a function. But I must point out that if your program is crashing
because db_rename_table() tries to rename a table that does'nt exist then
the problem is with the programes code, not database.e

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

3. Re: Rob: database.e update for v2.5

Hayden McKay wrote:
> 
> I somewhat agree with your idea to have database.e commands return a booleen
> value from a function. But I must point out that if your program is crashing
> because db_rename_table() tries to rename a table that does'nt exist then
> the problem is with the programes code, not database.e

Exactly! That's why the program should handle the error and not database.e
 
-- 
Derek Parnell
Melbourne, Australia

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

Search



Quick Links

User menu

Not signed in.

Misc Menu