⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 error.so

📁 berkeley db 4.6.21的源码。berkeley db是一个简单的数据库管理系统
💻 SO
字号:
m4_comment([$Id: error.so,v 11.17 2001/06/19 19:45:47 bostic Exp $])m4_ref_title(Tcl API, Tcl error handling,, tcl/program, tcl/faq)m4_p([dnlThe Tcl interfaces to m4_db generally return TCL_OK on success and throwa Tcl error on failure, using the appropriate Tcl interfaces to providethe user with an informative error message.  There are some "expected"failures, however, for which no Tcl error will be thrown and for whichTcl commands will return TCL_OK.  These failures include times when asearched-for key is not found, a requested key/data pair was previouslydeleted, or a key/data pair cannot be written because the key alreadyexists.])m4_p([dnlThese failures can be detected by searching the m4_db error message thatis returned.  For example, use the following to detect that an attemptto put a record into the database failed because the key alreadyexisted:])m4_indent([dnl% berkdb open -create -btree a.dbdb0% db0 put dog cat0% set ret __LB__db0 put -nooverwrite dog newcat__RB__DB_KEYEXIST: Key/data pair already exists% if { __LB__string first DB_KEYEXIST $ret__RB__ != -1 } {	puts "This was an error; the key existed"}This was an error; the key existed% db0 close0% exit])m4_p([dnlTo simplify parsing, it is recommended that the initial m4_db error namebe checked; for example, m4_ref(DB_KEYEXIST) in the previous example.To ensure that Tcl scripts are not broken by upgrading to new releasesof m4_db, these values will not change in future releases of m4_db.There are currently only three such "expected" error returns:])m4_indent([dnlDB_NOTFOUND: No matching key/data pair foundDB_KEYEMPTY: Nonexistent key/data pairDB_KEYEXIST: Key/data pair already exists])m4_p([dnlFinally, sometimes m4_db will output additional error information whena m4_db error occurs.  By default, all m4_db error messages will beprefixed with the created command in whose context the error occurred(for example, "env0", "db2", and so on).  There are several ways tocapture and access this information.])m4_p([dnlFirst, if m4_db invokes the error callback function, the additionalinformation will be placed in the error result returned from the commandand in the errorInfo backtrace variable in Tcl.])m4_p([dnlAlso, the two calls to open an environment and open a database take anoption, m4_arg(-errfile filename), which sets an output file to whichthese additional error messages should be written.])m4_p([dnlAdditionally, the two calls to open an environment and open a databasetake an option, m4_arg(-errpfx string), which sets the error prefix tothe given string.  This option may be useful in circumstances where amore descriptive prefix is desired or where a constant prefix indicatingan error is desired.])m4_page_footer

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -