Sha256: 14de1a1e88dd2f7a171f2906a8de0da2aca364a9f5a9bbc44429fb5f900d0b4d
Contents?: true
Size: 1.03 KB
Versions: 4
Compression:
Stored size: 1.03 KB
Contents
module RunLoop # @!visibility private class Sqlite # @!visibility private # MacOS ships with sqlite3 SQLITE3 = "/usr/bin/sqlite3" # @!visibility private def self.exec(file, sql) if !File.exist?(file) raise ArgumentError, %Q{sqlite database must exist at path: #{file} } end if sql.nil? || sql == "" raise ArgumentError, "Sql argument must not be nil or the empty string" end args = [SQLITE3, file, sql] hash = self.xcrun.exec(args, {:log_cmd => true}) out = hash[:out] exit_status = hash[:exit_status] if exit_status.nil? || exit_status != 0 raise RuntimeError, %Q{ Could not complete sqlite operation: file: #{file} sql: #{sql} out: #{out} Exited with status: '#{exit_status}' } end out end # @!visibilty private def self.parse(string, delimiter="|") if string == nil [] else string.split(delimiter) end end private def self.xcrun RunLoop::Xcrun.new end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
run_loop_tcc-2.1.6 | lib/run_loop/sqlite.rb |
run_loop_tcc-2.1.5 | lib/run_loop/sqlite.rb |
run_loop_tcc-2.1.4 | lib/run_loop/sqlite.rb |
run_loop_tcc-2.1.3 | lib/run_loop/sqlite.rb |