<?xml version="1.0" encoding="utf-8"?>
<!-- Created by Leo: http://leoeditor.com/leo_toc.html -->
<leo_file xmlns:leo="http://leoeditor.com/namespaces/leo-python-editor/1.1" >
<leo_header file_format="2" tnodes="0" max_tnode_index="0" clone_windows="0"/>
<globals body_outline_ratio="0.5" body_secondary_ratio="0.5">
	<global_window_position top="50" left="50" height="500" width="700"/>
	<global_log_window_position top="0" left="0" height="0" width="0"/>
</globals>
<preferences/>
<find_panel_settings/>
<vnodes>
<v t="tscv11.20180117163238.3"><vh>&lt;&lt; docstring &gt;&gt;</vh></v>
</vnodes>
<tnodes>
<t tx="tscv11.20180117163238.3">''' **leo4sqlite** - by *tscv11*
 
*Introduction:*

| The script 'leo4sqlite.py' is a Leo-specific python script that provides basic import/export
| functionality between Leo outlines and sqlite3 tables, as well as blob support  (insert, extract,
| search for a blob by any value in any column, view the blob in the render pane or open it
| with external tools). The blobs are arranged one per row with the other columns in that row
| containing information about them.

| Imported tables are stored internally as part of the outline, while exported tables (and blobs)
| are stored in sqlite3 database files.

| Imported tables appear as children of the "data" node (the last top-level node). To clear this
| node of accumulated imports, use the command 'sqlite-clear-data'.

| I am considering database level import/export functions to round things out if  there's
| enough interest.

| *Development Status:*


| *This script is functional but still needs plenty of bug-fixing and fine-tuning.*
|

**How to import a table:**

1. Select "import table" as the sqlite3 action to perform.
2. Choose an external database file
3. Pick a table
4. Select a layout

| *Your imported table should now appear. You're welcome.*
|

**How to export a table:**

1. Select "export table" as the sqlite3 action to perform.
2. Choose an internal database from those found under the "data" node.
3. Pick a table.
4. Select a layout - only the layout used to import the table is supported when exporting it.

| *Your exported table should now be written to the sqlite3 db file.*
|

**How to insert a blob**

1. Select "insert blob" as the sqlite3 action to perform.
2. Choose the target external database file.
3. Pick a 'blob table' where the blob will be stored.
4. Enter information for each column in that blob's row.

| *The blob should now be written to the database file.*
|

**How to extract a blob**

1. Select "extract blob" as the sqlite3 action to perform.
2. Choose the external database file containing the blob.
3. Pick the table containing the blob.
4. Enter a search column and search term.

|  *The matching blob should now be extracted to the*
|  *output folder you've specified in the @settings tree.*
|

**How to view a blob**

1. Select "view blob" as the sqlite3 action to perform.
2. Choose the external database containing the blob you wish to view.
3. Pick the table containing the blob.
4. Specify a search column and search term.

| *The matching blob should now be extracted to the temp folder you've*
| *chosen (in the @settings tree). An @image node is then created for the*
| *blob and the render pane is opened to view it.*
|

**How to open a blob**

1. Select "open blob" as the sqlite3 action to perform.
2. Choose the external database containing the blob you wish to view.
3. Pick the table containing the blob.
4. Specify a search column and search term.
5. Choose an external tool to use when opening the file.

| *The matching blob should now be extracted to the temp folder you've*
| *chosen (in the @settings tree). The file is then opened with the selected*
| *external tool.*
|

contact: tsc.v1.1@gmail.com

</t>
</tnodes>
</leo_file>
