System.Data.SQLite
Artifact Content
Not logged in

Artifact dbd8aa2c6803e8067c328964d2bbabf87e011582:


###############################################################################
#
# common.eagle --
#
# Written by Joe Mistachkin.
# Released to the public domain, use at your own risk!
#
###############################################################################

if {[isEagle]} then {
  proc loadAssembly { fileName } {
    set fileName [file join [file dirname $::path] bin \
        [expr {[haveConstraint imageRuntime40] ? "2010" : "2008"}] \
        $::test_configuration bin $fileName]

    if {[catch {set assembly \
        [object load -loadtype File $fileName]}] == 0} then {
      #
      # NOTE: Now, add the necessary test constraint.
      #
      addConstraint [file rootname [file tail $fileName]]
    }
  }

  proc setupDb {fileName {varName db}} {
    set fileName [file join [getTemporaryPath] $fileName]
    catch {file delete $fileName}
    upvar 1 $varName db
    set db [sql open -type SQLite [subst {Data Source=${fileName}}]]
  }

  proc cleanupDb {fileName {varName db}} {
    upvar 1 $varName db
    catch {sql close $db}
    catch {file delete $fileName}
  }
}