[BACK]Return to mandocdb.c CVS log [TXT][DIR] Up to [cvsweb.bsd.lv] / mandoc

Diff for /mandoc/mandocdb.c between version 1.169 and 1.175

version 1.169, 2014/11/19 20:40:51 version 1.175, 2014/12/04 21:48:48
Line 104  struct mpage {
Line 104  struct mpage {
         char            *desc;    /* description from file content */          char            *desc;    /* description from file content */
         struct mlink    *mlinks;  /* singly linked list */          struct mlink    *mlinks;  /* singly linked list */
         int              form;    /* format from file content */          int              form;    /* format from file content */
           int              name_head_done;
 };  };
   
 struct  mlink {  struct  mlink {
Line 124  enum stmt {
Line 125  enum stmt {
         STMT_INSERT_PAGE,       /* insert mpage */          STMT_INSERT_PAGE,       /* insert mpage */
         STMT_INSERT_LINK,       /* insert mlink */          STMT_INSERT_LINK,       /* insert mlink */
         STMT_INSERT_NAME,       /* insert name */          STMT_INSERT_NAME,       /* insert name */
           STMT_SELECT_NAME,       /* retrieve existing name flags */
         STMT_INSERT_KEY,        /* insert parsed key */          STMT_INSERT_KEY,        /* insert parsed key */
         STMT__MAX          STMT__MAX
 };  };
   
 typedef int (*mdoc_fp)(struct mpage *, const struct mdoc_node *);  typedef int (*mdoc_fp)(struct mpage *, const struct mdoc_meta *,
                           const struct mdoc_node *);
   
 struct  mdoc_handler {  struct  mdoc_handler {
         mdoc_fp          fp; /* optional handler */          mdoc_fp          fp; /* optional handler */
Line 153  static void  mpages_free(void);
Line 156  static void  mpages_free(void);
 static  void     mpages_merge(struct mchars *, struct mparse *);  static  void     mpages_merge(struct mchars *, struct mparse *);
 static  void     names_check(void);  static  void     names_check(void);
 static  void     parse_cat(struct mpage *, int);  static  void     parse_cat(struct mpage *, int);
 static  void     parse_man(struct mpage *, const struct man_node *);  static  void     parse_man(struct mpage *, const struct man_meta *,
 static  void     parse_mdoc(struct mpage *, const struct mdoc_node *);                          const struct man_node *);
 static  int      parse_mdoc_body(struct mpage *, const struct mdoc_node *);  static  void     parse_mdoc(struct mpage *, const struct mdoc_meta *,
 static  int      parse_mdoc_head(struct mpage *, const struct mdoc_node *);                          const struct mdoc_node *);
 static  int      parse_mdoc_Fd(struct mpage *, const struct mdoc_node *);  static  int      parse_mdoc_body(struct mpage *, const struct mdoc_meta *,
 static  int      parse_mdoc_Fn(struct mpage *, const struct mdoc_node *);                          const struct mdoc_node *);
 static  int      parse_mdoc_Nd(struct mpage *, const struct mdoc_node *);  static  int      parse_mdoc_head(struct mpage *, const struct mdoc_meta *,
 static  int      parse_mdoc_Nm(struct mpage *, const struct mdoc_node *);                          const struct mdoc_node *);
 static  int      parse_mdoc_Sh(struct mpage *, const struct mdoc_node *);  static  int      parse_mdoc_Fd(struct mpage *, const struct mdoc_meta *,
 static  int      parse_mdoc_Xr(struct mpage *, const struct mdoc_node *);                          const struct mdoc_node *);
   static  int      parse_mdoc_Fn(struct mpage *, const struct mdoc_meta *,
                           const struct mdoc_node *);
   static  int      parse_mdoc_Fo(struct mpage *, const struct mdoc_meta *,
                           const struct mdoc_node *);
   static  int      parse_mdoc_Nd(struct mpage *, const struct mdoc_meta *,
                           const struct mdoc_node *);
   static  int      parse_mdoc_Nm(struct mpage *, const struct mdoc_meta *,
                           const struct mdoc_node *);
   static  int      parse_mdoc_Sh(struct mpage *, const struct mdoc_meta *,
                           const struct mdoc_node *);
   static  int      parse_mdoc_Xr(struct mpage *, const struct mdoc_meta *,
                           const struct mdoc_node *);
 static  void     putkey(const struct mpage *, char *, uint64_t);  static  void     putkey(const struct mpage *, char *, uint64_t);
 static  void     putkeys(const struct mpage *,  static  void     putkeys(const struct mpage *,
                         const char *, size_t, uint64_t);                          const char *, size_t, uint64_t);
Line 290  static const struct mdoc_handler mdocs[MDOC_MAX] = {
Line 305  static const struct mdoc_handler mdocs[MDOC_MAX] = {
         { NULL, 0 },  /* Ux */          { NULL, 0 },  /* Ux */
         { NULL, 0 },  /* Xc */          { NULL, 0 },  /* Xc */
         { NULL, 0 },  /* Xo */          { NULL, 0 },  /* Xo */
         { parse_mdoc_head, 0 },  /* Fo */          { parse_mdoc_Fo, 0 },  /* Fo */
         { NULL, 0 },  /* Fc */          { NULL, 0 },  /* Fc */
         { NULL, 0 },  /* Oo */          { NULL, 0 },  /* Oo */
         { NULL, 0 },  /* Oc */          { NULL, 0 },  /* Oc */
Line 1084  mpages_merge(struct mchars *mc, struct mparse *mp)
Line 1099  mpages_merge(struct mchars *mc, struct mparse *mp)
         struct man              *man;          struct man              *man;
         char                    *sodest;          char                    *sodest;
         char                    *cp;          char                    *cp;
         pid_t                    child_pid;  
         int                      fd;          int                      fd;
         unsigned int             pslot;          unsigned int             pslot;
         enum mandoclevel         lvl;          enum mandoclevel         lvl;
Line 1094  mpages_merge(struct mchars *mc, struct mparse *mp)
Line 1108  mpages_merge(struct mchars *mc, struct mparse *mp)
         str_info.free = hash_free;          str_info.free = hash_free;
         str_info.key_offset = offsetof(struct str, key);          str_info.key_offset = offsetof(struct str, key);
   
         if (0 == nodb)          if ( ! nodb)
                 SQL_EXEC("BEGIN TRANSACTION");                  SQL_EXEC("BEGIN TRANSACTION");
   
         mpage = ohash_first(&mpages, &pslot);          mpage = ohash_first(&mpages, &pslot);
         while (NULL != mpage) {          while (mpage != NULL) {
                 mlinks_undupe(mpage);                  mlinks_undupe(mpage);
                 if (NULL == mpage->mlinks) {                  if (mpage->mlinks == NULL) {
                         mpage = ohash_next(&mpages, &pslot);                          mpage = ohash_next(&mpages, &pslot);
                         continue;                          continue;
                 }                  }
Line 1112  mpages_merge(struct mchars *mc, struct mparse *mp)
Line 1126  mpages_merge(struct mchars *mc, struct mparse *mp)
                 mdoc = NULL;                  mdoc = NULL;
                 man = NULL;                  man = NULL;
                 sodest = NULL;                  sodest = NULL;
                 child_pid = 0;  
   
                 mparse_open(mp, &fd, mpage->mlinks->file, &child_pid);                  mparse_open(mp, &fd, mpage->mlinks->file);
                 if (fd == -1) {                  if (fd == -1) {
                         say(mpage->mlinks->file, "&open");                          say(mpage->mlinks->file, "&open");
                         goto nextpage;                          goto nextpage;
Line 1125  mpages_merge(struct mchars *mc, struct mparse *mp)
Line 1138  mpages_merge(struct mchars *mc, struct mparse *mp)
                  * source code, unless it is already known to be                   * source code, unless it is already known to be
                  * formatted.  Fall back to formatted mode.                   * formatted.  Fall back to formatted mode.
                  */                   */
                 if (FORM_CAT != mpage->mlinks->dform ||                  if (mpage->mlinks->dform != FORM_CAT ||
                     FORM_CAT != mpage->mlinks->fform) {                      mpage->mlinks->fform != FORM_CAT) {
                         lvl = mparse_readfd(mp, fd, mpage->mlinks->file);                          lvl = mparse_readfd(mp, fd, mpage->mlinks->file);
                         if (lvl < MANDOCLEVEL_FATAL)                          if (lvl < MANDOCLEVEL_FATAL)
                                 mparse_result(mp, &mdoc, &man, &sodest);                                  mparse_result(mp, &mdoc, &man, &sodest);
                 }                  }
   
                 if (NULL != sodest) {                  if (sodest != NULL) {
                         mlink_dest = ohash_find(&mlinks,                          mlink_dest = ohash_find(&mlinks,
                             ohash_qlookup(&mlinks, sodest));                              ohash_qlookup(&mlinks, sodest));
                         if (NULL != mlink_dest) {                          if (mlink_dest == NULL) {
                                   mandoc_asprintf(&cp, "%s.gz", sodest);
                                   mlink_dest = ohash_find(&mlinks,
                                       ohash_qlookup(&mlinks, cp));
                                   free(cp);
                           }
                           if (mlink_dest != NULL) {
   
                                 /* The .so target exists. */                                  /* The .so target exists. */
   
Line 1156  mpages_merge(struct mchars *mc, struct mparse *mp)
Line 1175  mpages_merge(struct mchars *mc, struct mparse *mp)
                                         if (mpage_dest->pageid)                                          if (mpage_dest->pageid)
                                                 dbadd_mlink_name(mlink);                                                  dbadd_mlink_name(mlink);
   
                                         if (NULL == mlink->next)                                          if (mlink->next == NULL)
                                                 break;                                                  break;
                                         mlink = mlink->next;                                          mlink = mlink->next;
                                 }                                  }
Line 1168  mpages_merge(struct mchars *mc, struct mparse *mp)
Line 1187  mpages_merge(struct mchars *mc, struct mparse *mp)
                                 mpage->mlinks = NULL;                                  mpage->mlinks = NULL;
                         }                          }
                         goto nextpage;                          goto nextpage;
                 } else if (NULL != mdoc) {                  } else if (mdoc != NULL) {
                         mpage->form = FORM_SRC;                          mpage->form = FORM_SRC;
                         mpage->sec = mdoc_meta(mdoc)->msec;                          mpage->sec = mdoc_meta(mdoc)->msec;
                         mpage->sec = mandoc_strdup(                          mpage->sec = mandoc_strdup(
                             NULL == mpage->sec ? "" : mpage->sec);                              mpage->sec == NULL ? "" : mpage->sec);
                         mpage->arch = mdoc_meta(mdoc)->arch;                          mpage->arch = mdoc_meta(mdoc)->arch;
                         mpage->arch = mandoc_strdup(                          mpage->arch = mandoc_strdup(
                             NULL == mpage->arch ? "" : mpage->arch);                              mpage->arch == NULL ? "" : mpage->arch);
                         mpage->title =                          mpage->title =
                             mandoc_strdup(mdoc_meta(mdoc)->title);                              mandoc_strdup(mdoc_meta(mdoc)->title);
                 } else if (NULL != man) {                  } else if (man != NULL) {
                         mpage->form = FORM_SRC;                          mpage->form = FORM_SRC;
                         mpage->sec =                          mpage->sec =
                             mandoc_strdup(man_meta(man)->msec);                              mandoc_strdup(man_meta(man)->msec);
Line 1195  mpages_merge(struct mchars *mc, struct mparse *mp)
Line 1214  mpages_merge(struct mchars *mc, struct mparse *mp)
                         mpage->title =                          mpage->title =
                             mandoc_strdup(mpage->mlinks->name);                              mandoc_strdup(mpage->mlinks->name);
                 }                  }
                 if (mpage->mlinks->gzip)  
                         mpage->form |= FORM_GZ;  
                 putkey(mpage, mpage->sec, TYPE_sec);                  putkey(mpage, mpage->sec, TYPE_sec);
                 if (*mpage->arch != '\0')                  if (*mpage->arch != '\0')
                         putkey(mpage, mpage->arch, TYPE_arch);                          putkey(mpage, mpage->arch, TYPE_arch);
Line 1211  mpages_merge(struct mchars *mc, struct mparse *mp)
Line 1228  mpages_merge(struct mchars *mc, struct mparse *mp)
                         putkey(mpage, mlink->name, NAME_FILE);                          putkey(mpage, mlink->name, NAME_FILE);
                 }                  }
   
                 assert(NULL == mpage->desc);                  assert(mpage->desc == NULL);
                 if (NULL != mdoc) {                  if (mdoc != NULL)
                         if (NULL != (cp = mdoc_meta(mdoc)->name))                          parse_mdoc(mpage, mdoc_meta(mdoc), mdoc_node(mdoc));
                                 putkey(mpage, cp, NAME_HEAD);                  else if (man != NULL)
                         parse_mdoc(mpage, mdoc_node(mdoc));                          parse_man(mpage, man_meta(man), man_node(man));
                 } else if (NULL != man)  
                         parse_man(mpage, man_node(man));  
                 else                  else
                         parse_cat(mpage, fd);                          parse_cat(mpage, fd);
                 if (NULL == mpage->desc)                  if (mpage->desc == NULL)
                         mpage->desc = mandoc_strdup(mpage->mlinks->name);                          mpage->desc = mandoc_strdup(mpage->mlinks->name);
   
                 if (warnings && !use_all)                  if (warnings && !use_all)
Line 1231  mpages_merge(struct mchars *mc, struct mparse *mp)
Line 1246  mpages_merge(struct mchars *mc, struct mparse *mp)
                 dbadd(mpage, mc);                  dbadd(mpage, mc);
   
 nextpage:  nextpage:
                 if (child_pid &&                  if (mparse_wait(mp) != MANDOCLEVEL_OK) {
                     mparse_wait(mp, child_pid) != MANDOCLEVEL_OK) {  
                         exitcode = (int)MANDOCLEVEL_SYSERR;                          exitcode = (int)MANDOCLEVEL_SYSERR;
                         say(mpage->mlinks->file, "&wait gunzip");                          say(mpage->mlinks->file, "&wait gunzip");
                 }                  }
Line 1426  putmdockey(const struct mpage *mpage,
Line 1440  putmdockey(const struct mpage *mpage,
 }  }
   
 static void  static void
 parse_man(struct mpage *mpage, const struct man_node *n)  parse_man(struct mpage *mpage, const struct man_meta *meta,
           const struct man_node *n)
 {  {
         const struct man_node *head, *body;          const struct man_node *head, *body;
         char            *start, *title;          char            *start, *title;
Line 1492  parse_man(struct mpage *mpage, const struct man_node *
Line 1507  parse_man(struct mpage *mpage, const struct man_node *
                                         break;                                          break;
   
                                 putkey(mpage, start, NAME_TITLE);                                  putkey(mpage, start, NAME_TITLE);
                                   if ( ! (mpage->name_head_done ||
                                       strcasecmp(start, meta->title))) {
                                           putkey(mpage, start, NAME_HEAD);
                                           mpage->name_head_done = 1;
                                   }
   
                                 if (' ' == byte) {                                  if (' ' == byte) {
                                         start += sz + 1;                                          start += sz + 1;
Line 1506  parse_man(struct mpage *mpage, const struct man_node *
Line 1526  parse_man(struct mpage *mpage, const struct man_node *
   
                         if (start == title) {                          if (start == title) {
                                 putkey(mpage, start, NAME_TITLE);                                  putkey(mpage, start, NAME_TITLE);
                                   if ( ! (mpage->name_head_done ||
                                       strcasecmp(start, meta->title))) {
                                           putkey(mpage, start, NAME_HEAD);
                                           mpage->name_head_done = 1;
                                   }
                                 free(title);                                  free(title);
                                 return;                                  return;
                         }                          }
Line 1536  parse_man(struct mpage *mpage, const struct man_node *
Line 1561  parse_man(struct mpage *mpage, const struct man_node *
         for (n = n->child; n; n = n->next) {          for (n = n->child; n; n = n->next) {
                 if (NULL != mpage->desc)                  if (NULL != mpage->desc)
                         break;                          break;
                 parse_man(mpage, n);                  parse_man(mpage, meta, n);
         }          }
 }  }
   
 static void  static void
 parse_mdoc(struct mpage *mpage, const struct mdoc_node *n)  parse_mdoc(struct mpage *mpage, const struct mdoc_meta *meta,
           const struct mdoc_node *n)
 {  {
   
         assert(NULL != n);          assert(NULL != n);
Line 1557  parse_mdoc(struct mpage *mpage, const struct mdoc_node
Line 1583  parse_mdoc(struct mpage *mpage, const struct mdoc_node
                         /* FALLTHROUGH */                          /* FALLTHROUGH */
                 case MDOC_TAIL:                  case MDOC_TAIL:
                         if (NULL != mdocs[n->tok].fp)                          if (NULL != mdocs[n->tok].fp)
                                if (0 == (*mdocs[n->tok].fp)(mpage, n))                                 if (0 == (*mdocs[n->tok].fp)(mpage, meta, n))
                                        break;                                         break;
                         if (mdocs[n->tok].mask)                          if (mdocs[n->tok].mask)
                                 putmdockey(mpage, n->child,                                  putmdockey(mpage, n->child,
Line 1568  parse_mdoc(struct mpage *mpage, const struct mdoc_node
Line 1594  parse_mdoc(struct mpage *mpage, const struct mdoc_node
                         continue;                          continue;
                 }                  }
                 if (NULL != n->child)                  if (NULL != n->child)
                         parse_mdoc(mpage, n);                          parse_mdoc(mpage, meta, n);
         }          }
 }  }
   
 static int  static int
 parse_mdoc_Fd(struct mpage *mpage, const struct mdoc_node *n)  parse_mdoc_Fd(struct mpage *mpage, const struct mdoc_meta *meta,
           const struct mdoc_node *n)
 {  {
         const char      *start, *end;          const char      *start, *end;
         size_t           sz;          size_t           sz;
Line 1616  parse_mdoc_Fd(struct mpage *mpage, const struct mdoc_n
Line 1643  parse_mdoc_Fd(struct mpage *mpage, const struct mdoc_n
 }  }
   
 static int  static int
 parse_mdoc_Fn(struct mpage *mpage, const struct mdoc_node *n)  parse_mdoc_Fn(struct mpage *mpage, const struct mdoc_meta *meta,
           const struct mdoc_node *n)
 {  {
         char    *cp;          char    *cp;
   
Line 1637  parse_mdoc_Fn(struct mpage *mpage, const struct mdoc_n
Line 1665  parse_mdoc_Fn(struct mpage *mpage, const struct mdoc_n
                 cp++;                  cp++;
   
         putkey(mpage, cp, TYPE_Fn);          putkey(mpage, cp, TYPE_Fn);
           if (n->sec == SEC_SYNOPSIS)
                   putkey(mpage, cp, NAME_SYN);
   
         if (n->string < cp)          if (n->string < cp)
                 putkeys(mpage, n->string, cp - n->string, TYPE_Ft);                  putkeys(mpage, n->string, cp - n->string, TYPE_Ft);
Line 1649  parse_mdoc_Fn(struct mpage *mpage, const struct mdoc_n
Line 1679  parse_mdoc_Fn(struct mpage *mpage, const struct mdoc_n
 }  }
   
 static int  static int
 parse_mdoc_Xr(struct mpage *mpage, const struct mdoc_node *n)  parse_mdoc_Fo(struct mpage *mpage, const struct mdoc_meta *meta,
           const struct mdoc_node *n)
 {  {
   
           putmdockey(mpage, n->child, TYPE_Fn);
           if (n->sec == SEC_SYNOPSIS)
                   putmdockey(mpage, n->child, NAME_SYN);
           return(0);
   }
   
   static int
   parse_mdoc_Xr(struct mpage *mpage, const struct mdoc_meta *meta,
           const struct mdoc_node *n)
   {
         char    *cp;          char    *cp;
   
         if (NULL == (n = n->child))          if (NULL == (n = n->child))
Line 1668  parse_mdoc_Xr(struct mpage *mpage, const struct mdoc_n
Line 1710  parse_mdoc_Xr(struct mpage *mpage, const struct mdoc_n
 }  }
   
 static int  static int
 parse_mdoc_Nd(struct mpage *mpage, const struct mdoc_node *n)  parse_mdoc_Nd(struct mpage *mpage, const struct mdoc_meta *meta,
           const struct mdoc_node *n)
 {  {
   
         if (MDOC_BODY == n->type)          if (MDOC_BODY == n->type)
Line 1677  parse_mdoc_Nd(struct mpage *mpage, const struct mdoc_n
Line 1720  parse_mdoc_Nd(struct mpage *mpage, const struct mdoc_n
 }  }
   
 static int  static int
 parse_mdoc_Nm(struct mpage *mpage, const struct mdoc_node *n)  parse_mdoc_Nm(struct mpage *mpage, const struct mdoc_meta *meta,
           const struct mdoc_node *n)
 {  {
   
         if (SEC_NAME == n->sec)          if (SEC_NAME == n->sec)
                 putmdockey(mpage, n->child, NAME_TITLE);                  putmdockey(mpage, n->child, NAME_TITLE);
         else if (SEC_SYNOPSIS == n->sec && MDOC_HEAD == n->type)          else if (SEC_SYNOPSIS == n->sec && MDOC_HEAD == n->type) {
                 putmdockey(mpage, n->child, NAME_SYN);                  if (n->child == NULL)
                           putkey(mpage, meta->name, NAME_SYN);
                   else
                           putmdockey(mpage, n->child, NAME_SYN);
           }
           if ( ! (mpage->name_head_done ||
               n->child == NULL || n->child->string == NULL ||
               strcasecmp(n->child->string, meta->title))) {
                   putkey(mpage, n->child->string, NAME_HEAD);
                   mpage->name_head_done = 1;
           }
         return(0);          return(0);
 }  }
   
 static int  static int
 parse_mdoc_Sh(struct mpage *mpage, const struct mdoc_node *n)  parse_mdoc_Sh(struct mpage *mpage, const struct mdoc_meta *meta,
           const struct mdoc_node *n)
 {  {
   
         return(SEC_CUSTOM == n->sec && MDOC_HEAD == n->type);          return(SEC_CUSTOM == n->sec && MDOC_HEAD == n->type);
 }  }
   
 static int  static int
 parse_mdoc_head(struct mpage *mpage, const struct mdoc_node *n)  parse_mdoc_head(struct mpage *mpage, const struct mdoc_meta *meta,
           const struct mdoc_node *n)
 {  {
   
         return(MDOC_HEAD == n->type);          return(MDOC_HEAD == n->type);
 }  }
   
 static int  static int
 parse_mdoc_body(struct mpage *mpage, const struct mdoc_node *n)  parse_mdoc_body(struct mpage *mpage, const struct mdoc_meta *meta,
           const struct mdoc_node *n)
 {  {
   
         return(MDOC_BODY == n->type);          return(MDOC_BODY == n->type);
Line 1733  putkeys(const struct mpage *mpage,
Line 1790  putkeys(const struct mpage *mpage,
                         name_mask &= ~NAME_FIRST;                          name_mask &= ~NAME_FIRST;
                 if (debug > 1)                  if (debug > 1)
                         say(mpage->mlinks->file,                          say(mpage->mlinks->file,
                             "Adding name %*s", sz, cp);                              "Adding name %*s, bits=%d", sz, cp, v);
         } else {          } else {
                 htab = &strings;                  htab = &strings;
                 if (debug > 1)                  if (debug > 1)
Line 1950  dbadd_mlink(const struct mlink *mlink)
Line 2007  dbadd_mlink(const struct mlink *mlink)
 static void  static void
 dbadd_mlink_name(const struct mlink *mlink)  dbadd_mlink_name(const struct mlink *mlink)
 {  {
           uint64_t         bits;
         size_t           i;          size_t           i;
   
         dbadd_mlink(mlink);          dbadd_mlink(mlink);
   
         i = 1;          i = 1;
         SQL_BIND_INT64(stmts[STMT_INSERT_NAME], i, NAME_FILE & NAME_MASK);          SQL_BIND_INT64(stmts[STMT_SELECT_NAME], i, mlink->mpage->pageid);
           bits = NAME_FILE & NAME_MASK;
           if (sqlite3_step(stmts[STMT_SELECT_NAME]) == SQLITE_ROW) {
                   bits |= sqlite3_column_int64(stmts[STMT_SELECT_NAME], 0);
                   sqlite3_reset(stmts[STMT_SELECT_NAME]);
           }
   
           i = 1;
           SQL_BIND_INT64(stmts[STMT_INSERT_NAME], i, bits);
         SQL_BIND_TEXT(stmts[STMT_INSERT_NAME], i, mlink->name);          SQL_BIND_TEXT(stmts[STMT_INSERT_NAME], i, mlink->name);
         SQL_BIND_INT64(stmts[STMT_INSERT_NAME], i, mlink->mpage->pageid);          SQL_BIND_INT64(stmts[STMT_INSERT_NAME], i, mlink->mpage->pageid);
         SQL_STEP(stmts[STMT_INSERT_NAME]);          SQL_STEP(stmts[STMT_INSERT_NAME]);
Line 2268  create_tables:
Line 2334  create_tables:
               " \"bits\" INTEGER NOT NULL,\n"                " \"bits\" INTEGER NOT NULL,\n"
               " \"name\" TEXT NOT NULL,\n"                " \"name\" TEXT NOT NULL,\n"
               " \"pageid\" INTEGER NOT NULL REFERENCES mpages(pageid) "                " \"pageid\" INTEGER NOT NULL REFERENCES mpages(pageid) "
                 "ON DELETE CASCADE\n"                  "ON DELETE CASCADE,\n"
                 " UNIQUE (\"name\", \"pageid\") ON CONFLICT REPLACE\n"
               ");\n"                ");\n"
               "\n"                "\n"
               "CREATE TABLE \"keys\" (\n"                "CREATE TABLE \"keys\" (\n"
Line 2306  prepare_statements:
Line 2373  prepare_statements:
         sql = "INSERT INTO mlinks "          sql = "INSERT INTO mlinks "
                 "(sec,arch,name,pageid) VALUES (?,?,?,?)";                  "(sec,arch,name,pageid) VALUES (?,?,?,?)";
         sqlite3_prepare_v2(db, sql, -1, &stmts[STMT_INSERT_LINK], NULL);          sqlite3_prepare_v2(db, sql, -1, &stmts[STMT_INSERT_LINK], NULL);
           sql = "SELECT bits FROM names where pageid = ?";
           sqlite3_prepare_v2(db, sql, -1, &stmts[STMT_SELECT_NAME], NULL);
         sql = "INSERT INTO names "          sql = "INSERT INTO names "
                 "(bits,name,pageid) VALUES (?,?,?)";                  "(bits,name,pageid) VALUES (?,?,?)";
         sqlite3_prepare_v2(db, sql, -1, &stmts[STMT_INSERT_NAME], NULL);          sqlite3_prepare_v2(db, sql, -1, &stmts[STMT_INSERT_NAME], NULL);

Legend:
Removed from v.1.169  
changed lines
  Added in v.1.175

CVSweb