%PDF- %PDF-
| Direktori : /proc/thread-self/root/proc/3522530/root/lib/python2.7/site-packages/salt/sdb/ |
| Current File : //proc/thread-self/root/proc/3522530/root/lib/python2.7/site-packages/salt/sdb/sqlite3.pyo |
�
���^c @@ s� d Z d d l m Z m Z m Z d d l Z d d l Z y d d l Z e Z Wn e
k
ri e Z n Xd d l m
Z
d d l Z d Z e j e � Z i d d 6Z d � Z d d
� Z d � Z d d � Z d d
� Z d S( u�
SQLite sdb Module
:maintainer: SaltStack
:maturity: New
:platform: all
This module allows access to sqlite3 using an ``sdb://`` URI
Like all sdb modules, the sqlite3 module requires a configuration profile to
be configured in either the minion or master configuration file. This profile
requires very little. For example:
.. code-block:: yaml
mysqlite:
driver: sqlite3
database: /tmp/sdb.sqlite
table: sdb
create_table: True
The ``driver`` refers to the sqlite3 module, ``database`` refers to the sqlite3
database file. ``table`` is the table within the db that will hold keys and
values (defaults to ``sdb``). The database and table will be created if they
do not exist.
Advanced Usage:
===============
Instead of a table name, it is possible to provide custom SQL statements to
create the table(s) and get and set values.
.. code-block: yaml
myadvanced
driver: sqlite3
database: /tmp/sdb-advanced.sqlite
create_statements:
- "CREATE TABLE advanced (a text, b text, c blob, d blob)"
- "CREATE INDEX myidx ON advanced (a)"
get_query: "SELECT d FROM advanced WHERE a=:key"
set_query: "INSERT OR REPLACE INTO advanced (a, d) VALUES (:key, :value)"
i ( t absolute_importt print_functiont unicode_literalsN( t sixu sdbu setu set_c C@ s t s
t St S( u,
Only load if sqlite3 is available.
( t HAS_SQLITE3t Falset True( ( ( s4 /usr/lib/python2.7/site-packages/salt/sdb/sqlite3.pyt __virtual__H s u strictc C@ s� | j d | � j d � } | j d � } | d k r� t d | | | d d � } t j | � } | | � \ } } | j d | � } n d | j d d � d S( Nu utf-8u i u NUL-terminated utf-8i u NUL not allowedu "u ""( t encodet decodet findt UnicodeEncodeErrort codecst lookup_errort replace( t st errorst encodablet nul_indext errort
error_handlert replacementt _( ( s4 /usr/lib/python2.7/site-packages/salt/sdb/sqlite3.pyt _quoteQ s c C@ s� | d } d } t j | � } | j � } | j d � } | j d t � } t | d � } t | � } yo | r� xb | D] } | j | � qx WnD | j d t � r� | j d j | � � | j d j | | � � n Wn t j
k
r� n X| | | f S( Nu databaseu create_statementsu tableu _idxu create_tableu'