About

this module is a sqlite3 interface

Using

See the source for aardwolf.statdb for an example of using sqldb

Wrap the class creation in a function

    def dbcreate(sqldb, plugin, **kwargs):
      """
      create the mydb class, this is needed because the Sqldb baseclass
      can be reloaded since it is a plugin
      """
      class mydb(sqldb):
        """
        a class to manage a sqlite database
        """
        def __init__(self, plugin, **kwargs):
          """
          initialize the class
          """
          sqldb.__init__(self, plugin, **kwargs)

          # postinit will need to be run at the end of the subclass __init__
          self.postinit()

      return mydb(plugin, **kwargs)

call the function in load

    mydb = dbcreate(self.api('sqldb.baseclass')(), self,
                           dbname='mydb')

Commands

Base

api


usage: #bp.sqldb.api [-h] [api]

list functions in the api

positional arguments:
  api         api to get details of

optional arguments:
  -h, --help  show help (default: False)

help


usage: #bp.sqldb.help [-a] [-c] [-h]

show help info for this plugin

optional arguments:
  -a, --api       show functions this plugin has in the api (default: False)
  -c, --commands  show commands in this plugin (default: False)
  -h, --help      show help (default: False)

inspect


usage: #bp.sqldb.inspect [-m METHOD] [-o OBJECT] [-s] [-h]

inspect a plugin

optional arguments:
  -m METHOD, --method METHOD
                        get code for a method
  -o OBJECT, --object OBJECT
                        show an object of the plugin, can be method or
                        variable
  -s, --simple          show a simple output (default: False)
  -h, --help            show help (default: False)

reset


usage: #bp.sqldb.reset [-h]

reset the plugin

optional arguments:
  -h, --help  show help (default: False)

save


usage: #bp.sqldb.save [-h]

save the plugin state

optional arguments:
  -h, --help  show help (default: False)

set


usage: #bp.sqldb.set [-h] [name] [value]

change a setting in the plugin

if there are no arguments or 'list' is the first argument then
it will list the settings for the plugin

positional arguments:
  name        the setting name (default: list)
  value       the new value of the setting

optional arguments:
  -h, --help  show help (default: False)

stats


usage: #bp.sqldb.stats [-h]

show plugin stats

optional arguments:
  -h, --help  show help (default: False)

API

baseclass


sqldb.baseclass()

    return the sql baseclass


original defined in plugins/core/sqldb.py