Class: SiSU_Db_Op::DbOp

Inherits:
SiSU_Info_Db::InfoDb show all
Defined in:
lib/sisu/se_db.rb

Direct Known Subclasses

SiSU_Env::DbOp

Instance Attribute Summary

Attributes inherited from SiSU_Info_Env::InfoEnv

#base_markup_dir_stub, #env, #etc, #filename, #flv, #fnb, #fnn, #fnt, #home, #hostname, #processing, #processing_git, #rc, #stub_pwd, #stub_src, #sys, #user, #webserv_host_cgi, #webserv_path, #webserv_port_cgi, #www, #yamlrc_dir

Attributes inherited from SiSU_Env_Call::EnvCall

#ad, #fnb, #fnn, #fnt, #fnv, #fnz, #rc

Instance Method Summary collapse

Methods inherited from SiSU_Info_Db::InfoDb

#conn_pg, #db_discrete, #dbi_, #default, #engine, #host, #password, #port, #psql, #share_source?, #sqlite, #user

Methods inherited from SiSU_Info_Env::InfoEnv

#ao, #arch, #asciidoc_ocn?, #bin, #build, #cgi, #cgi_sample_search_form_name, #cjk, #cjk_ja, #cjk_ko, #cjk_zh, #composite_file, #concord_max, #console_web_browser, #console_www_browser, #current_document, #defaults, #digest, #digest_conf?, #dir_url, #docbook_viewer, #encoding, #epub, #epub_bld, #epub_cp_images, #epub_viewer, #feed, #feed_home, #fictionbook_viewer, #file_encoding, #font, #git, #host, #html, #html_minitoc?, #html_navigation?, #html_navigation_bar?, #html_quick_ref?, #html_right_pane?, #html_scroll_1, #html_scroll_2, #html_search_form?, #html_seg_1, #html_seg_2, #html_seg_title_banner?, #html_top_band?, #i18n, #image_external, #image_source, #image_source_include, #image_source_include_local, #image_source_include_remote, #image_source_sisu_includes, #images, #images_epub, #images_external, #images_local, #landscape, #lang_filename, #language, #language_default_set, #length, #links_to_manifest?, #listed?, #local, #locale, #localhost, #lout, #main, #make, #man, #manifest?, #manifest_minitoc?, #manpage, #manpage_generator, #manpage_viewer, #markdown_ocn?, #markup_emphasis, #metadata?, #minitoc?, #mono, #ocn?, #odf, #odf_pth, #odf_viewer, #odt, #odt_bld, #odt_ocn?, #omit_list, #orgmode_ocn?, #output, #output_tell, #papersize, #path, #path_rel_links, #paths, #pattern, #pdf, #pdf_viewer, #pdflatex, #php, #plaintext_ocn?, #plaintext_wrap, #po, #port, #portrait, #postgresql, #pot, #processing_base_tmp, #processing_path, #processing_sisupod, #program, #promo?, #pwd, #rbver, #read_source_file, #read_source_file_array, #read_source_file_string, #remote, #rexml, #rmagick, #root, #root_dir, #rst_ocn?, #sample_data, #sample_search_form_title, #sans, #scripts, #search?, #search_action, #search_fixed?, #search_form, #search_form?, #search_form_static, #segsubtoc?, #serif, #share, #sisupod_gen, #sisupod_gen_v2, #sisupod_gen_v3, #sisupod_v2, #sisupod_v3, #sisupod_v4, #sisurc_path, #sitearch, #size, #source_file_path, #source_file_processing_array, #source_file_with_path, #sql, #sqlite, #src_pod, #src_txt, #stub_dir, #stub_dir_orig, #stub_epub, #stub_md_harvest, #stub_pod, #style, #tex, #texi, #texinfo, #texpdf, #texpdf_hyperlinks, #text_editor, #textile_ocn?, #tidy, #tmp_root_dir, #toc?, #tune, #txt, #type, #url, #usr_dir?, #wc, #web_browser, #webrick, #webrick_port, #webserv, #webserv_base, #webserv_base_cgi, #webserv_cgi, #webserv_dir, #webserv_files_from_db, #webserv_host_base, #webserv_image, #webserv_map_pwd, #webserv_stub_ensure, #widget, #widget_static, #www_browser, #xml_docbook_ocn?, #xml_editor, #xml_fictionbook_ocn?, #xml_scaffold_ocn?, #xml_viewer, #yamlrc

Methods inherited from SiSU_Env_Call::EnvCall

#by?, #by_filename?, #by_filetype?, #by_language_code?, #default_language?, #document_language_versions_found, #dump?, #filename, #lang, #mono_multi_lingual?, #multilingual?, #output_dir_structure, #published_manifests?, #redirect?

Constructor Details

#initialize(md) ⇒ DbOp

Returns a new instance of DbOp.



172
173
174
175
176
177
178
179
180
181
# File 'lib/sisu/se_db.rb', line 172

def initialize(md)
  begin
    @md=md
  rescue
    SiSU_Screen::Ansi.new(md.opt.selections.str,$!,$@).rescue do
      __LINE__.to_s + ':' + __FILE__
    end
  ensure
  end
end

Instance Method Details

#conn_dbiObject



194
195
196
# File 'lib/sisu/se_db.rb', line 194

def conn_dbi
  DBI.connect(sqlite_discrete.dbi)
end

#conn_sqlite3Object



197
198
199
200
201
202
203
204
205
206
207
# File 'lib/sisu/se_db.rb', line 197

def conn_sqlite3
  begin
    $sqlite3=:yes
    require 'sqlite3'
    SQLite3::Database.new(sqlite_discrete.sqlite3)
  rescue LoadError
    $sqlite3=:no
    SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
      error('sqlite3 NOT FOUND (LoadError)')
  end
end

#dbObject



183
184
185
186
187
# File 'lib/sisu/se_db.rb', line 183

def db
  @md.file.output_path.sqlite_discrete.dir \
  + '/' \
  + @md.file.base_filename.sqlite_discrete
end

#dbiObject



188
189
190
# File 'lib/sisu/se_db.rb', line 188

def dbi
  "DBI:SQLite3:#{sqlite_discrete.db}"
end

#sqlite3Object



191
192
193
# File 'lib/sisu/se_db.rb', line 191

def sqlite3
  sqlite_discrete.db
end

#sqlite_discreteObject



182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/sisu/se_db.rb', line 182

def sqlite_discrete
  def db
    @md.file.output_path.sqlite_discrete.dir \
    + '/' \
    + @md.file.base_filename.sqlite_discrete
  end
  def dbi
    "DBI:SQLite3:#{sqlite_discrete.db}"
  end
  def sqlite3
    sqlite_discrete.db
  end
  def conn_dbi
    DBI.connect(sqlite_discrete.dbi)
  end
  def conn_sqlite3
    begin
      $sqlite3=:yes
      require 'sqlite3'
      SQLite3::Database.new(sqlite_discrete.sqlite3)
    rescue LoadError
      $sqlite3=:no
      SiSU_Utils::CodeMarker.new(__LINE__,__FILE__,:fuchsia).
        error('sqlite3 NOT FOUND (LoadError)')
    end
  end
  self
end