proposal EDS functions

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

Hello,

I regularly use EDS in my projects for quite a few years now. 
Whenever I start a new project I found myself rewritting these 
functions. I suggest to include them in the standard database.e 
file. 

Any comment, support, improvment is welcome. I suppose all of us
developed some similar rountines...

global function db_startup(sequence dbf)
	integer err,lock
	lock=DB_LOCK_NO
	err=db_open(dbf,lock)
	if err=DB_OK then
		return DB_OK
	elsif err=DB_OPEN_FAIL then
		return db_create(dbf,lock)
	elsif err=DB_LOCK_FAIL then
		for i=1 to 10 by 1 do
			if db_open(dbf,lock)=DB_OK then
				return DB_OK
			else
				sleep(2)
			end if
		end for
		return DB_LOCK_FAIL
	else
		return DB_OPEN_FAIL
	end if
end function

global function db_startup_table(sequence t)
	integer err
	if db_select_table(t)=DB_OK 
	or db_create_table(t)=DB_OK 
	then 
		return DB_OK 
	end if
       	return DB_OPEN_FAIL
end function


Regards,

Salix

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

Search



Quick Links

User menu

Not signed in.

Misc Menu