Rob: database.e update for v2.5

new topic     » topic index » view thread      » older message » newer message

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 thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu