#
# Copyright (C)2022 @BABOLO http://www.babolo.ru/
# pkg = cipalite
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $Id: README,v 1.5 2022/12/31 18:26:37 babolo Exp $
#
DB _ sqlite2 #############################################################
TABLE pnode     --      --  
 int  p      P --          --  
 text h        --          -- 
 text b        --          --  
 text m     |  --          --  
 text v     |U --          --    

TABLE pset      --      --  
 int  l      P --          --   
 int  t        --          --  
          0 --   
          1 --   
          2 --   
          3 --   
 text         --          --  
 text m     |  --          --  
 text w     |U --          --    

TABLE pcoll     --      --  
 int  x      P --          --  
 text m     |  --          --  
 text u     |U --          --  

TABLE pregi     --      -- 
 int  x -> pcoll.x         --  
 int  r -> pnode.p         --    
 int  o        --          --     (      XXXX)
 text s        --          --   

TABLE pleaf     --      --  
 int  p -> pnode.p         --  
 int  r -> pnode.p,pcoll.x --     
 int  l -> pset.l          -- NULL - <a href=[r -> pnode.p]>
                           -- 0 r -> pcoll.x  
                           -- >0 r IS NULL   
 int  o        --          --    
 text s        --          --   

TABLE pbook     --      --          #   -  p n IS NULL,
 text n        --          --   #     
 int  p -> pnode.p         --           #   

TABLE pnow      --      --     cred
 int  cred   U --          --   
         -1 --   QUERY_STRING
          0 --   
 int  p -> pnode.p         --  

TABLE param
 text m        --          --  
 text v      P --          --    
 int  lvl      --          --  .  - .
                               cipalite 0,    cipalite - 1,  - .
TABLE x         --      -- page parameters
 int   cred    --          --  
 text  cipa    --          --  
 int   sess    --          --  
 text  login   --          --  
 text  pass    --          --  
 int   tosess  --          --  
 int   p       --          --  
 int   t       --          -- tableoid
 int   o       --          -- oid 
 text  c       --          -- ctid 
 int   m       --          --     - 
 text  n       --          --     - 
 int   l       --          --    
 text  z       --          -- 
 char  e       --          --   (char)
 float b       --          --  
 int   u       --          -- http  https - 0  1
 text  h       --          -- HTTP_HOST
                               
 int   x       --          -- pleaf.r:   pnode  pcoll
 text  s       --          -- pleaf.s:     

DB 2 sqlite3 #############################################################
TABLE x            --      -- page parameters
 int   cred       --          --  
 text  cipa       --          --  
 int   sess       --          --  
 text  login      --          --  
 text  pass       --          --  
 int   p          --          --  
 int   t          --          -- tableoid
 int   o          --          -- oid 
 text  c          --          -- ctid 
 int   m          --          --     - 
 text  n          --          --     - 
 int   l          --          --    
 text  z          --          -- 
 text  e          --          --   (char)
 real  b          --          --  
 int   u          --          -- http  https - 0  1
 text  h          --          -- HTTP_HOST
 text  srcip      --          -- IP 

PRAGMA foreign_keys = 1;
PRAGMA temp_store = 2;
PRAGMA journal_mode = WAL;
PRAGMA application_id = 0x43495041;

TABLE ciparam      --      --  
 text m        |  --          --   
 text v        |P --          --  
 text param       --          --  

TABLE version      --      --   
 text pkg    u |  --          --  
 text protover |U --          --  
 int  major       --          --  
 text minor       --          --  
 int  comconf     --          --  

TABLE srcs         --      --   
 text pkg      |  --          --  
 int  major    |P --          --  
 text minor       --          --  

VIEW babolover     --      --  
 text pkg         --          --  
 text protover    --          --  
 int  major       --          --   
 text minor       --          --   
 int  major       --          --   
 text minor       --          --   
 int  comconf     --          --  

TABLE pass         --      -- AAA
 int  cred      P --          --  
 text context  |  --          -- 
 text login    |U --          -- 
 text passwd      --          -- 
 text srcip       --          -- IP,      cred
 int  flags       --          -- 
                  --                       --   1   sess
                  --                       --   2   sess
                  --                       --   4   sess
                  --                       --   8   sess
                  -- PassClaimPass         --  16   
                  -- PassAuthName          --  32    AuthName
                  -- CredReadPost          --  64   
                  -- CredAdmin             -- 128 
 int  ttl         --          --   
 int  hzone       --          --  tz, 
 int  mzone       --          --  tz, 
 text remark      --          -- 
 text nickname    --          --  

TABLE sess         --      --  
 int  sess      P --          --  
 int  cred -> pass.cred       --   pass
 int  cnt         --          --  
 text srcip       --          -- IP,   
 int  flags       --          -- 
                  -- SessClaimPass         -- 1   
                  -- SessAuthName          -- 2    AuthName
 text login       --          --  
 text pass        --          --  
 real ttl         --          --   
 int  hzone       --          --  tz, 
 int  mzone       --          --  tz, 
 real created     --          --   
 real updated     --          --   

TABLE sessb        --      --  
 int  sess      P --          --  
 int  cred -> pass.cred       --   pass
 int  cnt         --          --  
 text srcip       --          -- IP,   
 int  flags       --          -- 
 text login       --          --  
 text pass        --          --  
 real ttl         --          --   
 int  hzone       --          --  tz, 
 int  mzone       --          --  tz, 
 real created     --          --   
 real updated     --          --   
 real removed     --          --   

TABLE post         --      -- 
 int  post      P --          --  
 int  sess -> sess.sess       --  
 int  refs -> post.post       --    
 real created     --          --   
 int  flags       --          -- 
                  -- PostToRede            -- 1   
 text mess        --          --  

TABLE pkey         --      --   
 int  pkey      P --          --  
 int  sess -> sess.sess       --  
 real created) real           --   
 real ttl)     real           --   

TABLE cipaconf     --      --  ,  
 int  a1          --          --  
 int  a2          --          --  
 int  a3          --          --  
 real ttl         --          --     
 real log         --          --  

TABLE gifs         --      --  
 int  symb      P --          -- 
 text bgif        --          -- 
