ns::stats::SQLiteHistory method historyConnect (protected)
<instance of ns::stats::SQLiteHistory> historyConnect config
Defined in /usr/local/ns/lib/nsf2.5.0/lib/nx-traits.tcl
- Parameters:
- config (required)
- Testcases:
- No testcase defined.
Source code: set db [ns_db gethandle -timeout 1 [dict get $config pool]] if {$db eq ""} { error "history pool checkout timed out" } try { if {[ns_db dbtype $db] ne "sqlite"} { error "history requires an nsdbsqlite pool" } set path [ns_db datasource $db] if {$path eq "" || $path eq ":memory:" || [string match file:* $path]} { error "history requires a persistent file datasource" } file attributes $path -permissions 0600 # A dedicated database avoids altering another application's budget. if {[:scalar $db { SELECT count(*) FROM sqlite_master WHERE type='table' AND name NOT GLOB 'ns_stats_*' AND name NOT GLOB 'sqlite_*'}] } { error "history requires a dedicated database" } foreach query { {PRAGMA busy_timeout=1000} {PRAGMA journal_mode=DELETE} {PRAGMA synchronous=FULL} {PRAGMA temp_store=MEMORY} } { :sql $db $query } set page [:scalar $db {PRAGMA page_size}] set maximum [expr {int([dict get $config maxBytes]*0.45)/$page}] if {[:scalar $db {PRAGMA page_count}] > $maximum} { error "existing history database exceeds byte budget" } :sql $db "PRAGMA max_page_count=$maximum" return $db } on error {message options} { ns_db releasehandle $db return -options $options $message }XQL Not present: Generic, PostgreSQL, Oracle
![[i]](/resources/acs-subsite/ZoomIn16.gif)