Full Code of diegomacario/Poor-Fox for AI

master d7e66aab2a46 cached
11 files
7.4 MB
1.9M tokens
4475 symbols
1 requests
Download .txt
Showing preview only (7,712K chars total). Download the full file or copy to clipboard to get everything.
Repository: diegomacario/Poor-Fox
Branch: master
Commit: d7e66aab2a46
Files: 11
Total size: 7.4 MB

Directory structure:
gitextract_x8w7ov8e/

├── LICENSE
├── README.md
├── code/
│   ├── CmdLineParser.h
│   ├── Makefile
│   ├── TablePrinter.h
│   ├── main.cpp
│   ├── shell.c
│   ├── sqlite3.c
│   ├── sqlite3.h
│   └── sqlite3ext.h
└── installer/
    └── unix_installer.sh

================================================
FILE CONTENTS
================================================

================================================
FILE: LICENSE
================================================
MIT License

Copyright (c) 2017 Diego Macario

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


================================================
FILE: README.md
================================================
<p align="center">
  <img src="https://github.com/diegomacario/Poor-Fox/blob/master/readme_images/poor_fox_ascii_logo.png"/>
</p>

# Poor Fox

A beautiful command-line application designed to help you keep track of your expenses.

<p align="center">
  <img src="https://github.com/diegomacario/Poor-Fox/blob/master/readme_images/introductory_gif.gif"/>
</p>

## Features 

- Create your own expense categories.
- Log your expenses using the 3-letter codes generated by the application.
- Visualize the total you spend on each category through monthly reports.
- Add new expense categories to an existing database.

## Technical details

- Supported on macOS, Linux and Windows.
- Data is stored locally using [SQLite](https://www.sqlite.org/index.html).
- Terminal string styling is done using [Chalk](https://github.com/chalk/chalk).

## Installation

### Requirements 

Have Node.js, npm and Chalk installed in your system. 

- To install Node.js and npm in __macOS__ you can follow these [instructions](http://blog.teamtreehouse.com/install-node-js-npm-mac).
- To install Node.js and npm in __Linux__ you can execute the following commands:
```sh
 $ sudo apt-get update
 $ sudo apt-get install nodejs
 $ sudo apt-get install npm
```
- To install Node.js and npm in __Windows__ you can follow these [instructions](http://blog.teamtreehouse.com/install-node-js-npm-windows).

To install Chalk you can then execute the following command:
```sh
 $ npm install --save chalk
```
 
### macOS

To install the application globally, execute the command below.
 ```sh
 $ curl -s -L https://github.com/diegomacario/Poor-Fox/raw/master/installer/unix_installer.sh | sudo bash -s macos
 ```
This command downloads the binary _pfox_macOS_ included in release [1.0.0](https://github.com/diegomacario/Poor-Fox/releases) and places it in your _/usr/local/bin/_ folder.

### Linux

To install the application globally, execute the command below.
 ```sh
 $ curl -s -L https://github.com/diegomacario/Poor-Fox/raw/master/installer/unix_installer.sh | sudo bash -s linux
 ```
This command downloads the binary _pfox_linux_ included in release [1.0.0](https://github.com/diegomacario/Poor-Fox/releases) and places it in your _/usr/local/bin/_ folder. If you do not have Curl installed, execute the following command first:
 ```sh
 $ sudo apt-get install curl
 ```

### Windows

To install the application globally, download the executable named _pfox_windows.exe_ included in release [1.0.0](https://github.com/diegomacario/Poor-Fox/releases), rename it as _pfox.exe_ and place it in a folder that's on the PATH environment variable.

## Usage

__Note__: The application features clear error messages that will guide you when you make mistakes.

__1.__ Create your own expense categories:
 ```sh
 $ pfox new -Groceries -Restaurants -Movies -Shows -Clothes -Books -Photography -Climbing
 ```
 - The application automatically generates codes that you can use to log expenses into each category. 
 - Codes normally consist of the first 3 letters of each category.
 - Don't worry if 2 or more categories start with the same 3 letters (e.g. -Transportation -Travelling), the application will always generate unique codes.  

__2.__ Log the money you spent on a particular day by specifying its date in the format _day/month/year_:
 ```sh
 $ pfox log -d=1/12/2016 -gro=64.32 -boo=36.22 -mov=12.25
 
 $ pfox log -d=16/12/2016 -mov=12.25 -cli=21.34
 ```
 <p align="center">
  <img src="https://github.com/diegomacario/Poor-Fox/blob/master/readme_images/expense_report.png"/>
</p>
 
 - The application automatically displays an expense report for the month you specified.
    - The table at the top displays the expenses that have been logged into each category separated by day.
    - The second table and the bar graph display the total spent in each category.
    - The global value at the bottom is the sum of all the totals.
 - If you do not specify a date, today's date is selected by default.
 - You can log expenses using the same date more than once. The expenses you enter will be added to the existing ones.
 - You can log negative values to make corrections when you enter incorrect amounts.
 - Dates are sorted automatically.
 
__3.__ Add new expense categories to an existing database:
 ```sh
 $ pfox add -Skydiving -Dancing
 ```
  - Useful for when you pick up new hobbies and activities!
  
__4.__ Display the expense report of a particular month by specifying its date in the format _month/year_:
 ```sh
 $ pfox tab -d=12/2016
 ```

__5.__ Display the months in which you have logged expenses:
 ```sh
 $ pfox dat
 ```

__6.__ Display the expense categories included in your database and their codes:
 ```sh
 $ pfox cat
 ```
 
__7.__ Delete your database so that you can create a new one:
 ```sh
 $ pfox reset
 ```
 
 __8.__ See examples of how to use the application:
 ```sh
 $ pfox help
 ```
 
  __9.__ See what version of the application you are using:
 ```sh
 $ pfox version
 ```

## Why should you use it?

Just like this application, your bank generates monthly reports of your expenses. The big difference between the two is that your bank generates those reports without any effort from you, while this application requires you to enter your expenses manually. That might seem like a lot of work, but I consider it to be a benefit because it will help you be more conscious about your spending, which is something that a report that you look at once a month will never do. 

Log your expenses for a couple of months and you'll find all the categories in which you can improve. You will be surprised! Then use the money you save to learn or experience something new.

<p align="center">
  <img src="https://github.com/diegomacario/Poor-Fox/blob/master/readme_images/captain_crocodile.png"/>
  <em>You planning all the fun things you are going to do.</em>
</p>

## Why is it called Poor Fox?

<p align="center">
  <img src="https://github.com/diegomacario/Poor-Fox/blob/master/readme_images/fantastic_mr_fox.PNG"/>
</p>
<p align="center">
  <strong><em>Mr. Fox</strong>: I don't want to live in a hole anymore. It makes me feel poor.</em><br />
  <strong><em>Mrs. Fox</strong>: We are poor -- but we're happy.</em>
</p>

If you haven't watched _Fantastic Mr. Fox_ yet, make time in your schedule to watch it with your loved ones. You will feel elated!


================================================
FILE: code/CmdLineParser.h
================================================
#include <string>
#include <vector>
#include <iostream>
#include <fstream>
#include <algorithm>
#include <cctype>
#include <stdexcept>

#include <sys/types.h> 
#include <sys/stat.h>

#include <time.h>

class CParser
{

public:

   CParser(int argc, char * argv[], std::string strDataFieldPath, std::string strTableCategoriesPath);
   ~CParser();

   std::string strTableCategoriesPath;

   bool CheckInstructions();
   void WriteFieldsToFile();
   std::vector<std::string> ReadFieldsFromFile();
   std::vector<std::string> GetNewFields();
   bool DataFieldExists(std::string sCmd);
   double GetDataFieldValue(std::string sCmd);
   std::string GetDate();
   std::vector<std::string> GetShortDataFields();
   bool CheckEachFieldHasEqualSign();
   bool CheckEachFieldHasQuantity();
   bool CheckQuantitiesAreNumbers();
   bool CheckUserEnteredProperDate(bool bPrintSpecificTable);
   bool CheckCreationFieldsAreValid();
   bool CheckIfFileExists(std::string filePath  );
   bool CheckIfUserEnteredValidFields();
   bool CheckCreationFieldsAreUnique();
   bool CheckFieldsBeingAddedAreUnique();
   bool CheckFieldsAreUnique();
   bool CheckUserOnlyEnteredXFields(int iNumOfFields);

   bool bNew, bAdd;
   bool bPrintFields;
   bool bPrintDates;
   bool bPrintSpecific;
   bool bLog;
   bool bMadeBy;
   bool bReset;
   bool bHelp;
   bool bVersion;

   std::string strHomeDirectoryPath;

private:

   void parse(int argc, char * argv[]);

   int m_iNumInstructions;
   int m_iNumDataFields;

   typedef std::vector<std::string> vectorOfString;
   typedef vectorOfString::iterator vectorOfStringIT;

   vectorOfString m_vecInstructions;
   vectorOfString m_vecDataFields;
   vectorOfString m_vecLongDataFields;
   vectorOfString m_vecShortDataFields;

};

// Constructor: Resets the counters and parses the user input
CParser::CParser(int argc, char * argv[], std::string strHomeDirectoryPath, std::string strTableCategoriesPath)
{
   this->strTableCategoriesPath = strTableCategoriesPath;
   m_iNumInstructions = 0;
   m_iNumDataFields = 0;

   bNew = false;
   bAdd = false;
   bPrintFields = false;
   bPrintDates = false;
   bPrintSpecific = false;
   bLog = false;
   bMadeBy = false;
   bReset = false;
   bHelp = false;
   bVersion = false;

   strHomeDirectoryPath = strHomeDirectoryPath;

   parse(argc, argv);
}

// Destructor
CParser::~CParser()
{
   // Do nothing
}

// Parser: Separates the instructions from the data fields
void CParser::parse(int argc, char * argv[])
{
   for (int i = 1; i < argc; i++)                            // Skip the name of the .exe file by starting at 1
   {
      std::string sUserInput = argv[i];

      if (sUserInput[0] != '/' && sUserInput[0] != '-')      // Instructions do not start with '/' or '-'
      {
         m_iNumInstructions++;
         m_vecInstructions.push_back(sUserInput);
      }
      else                                                  // Data fields start with '/' or '-'
      {
         m_iNumDataFields++;
         m_vecDataFields.push_back(sUserInput.substr(1));   // Remove '/' or '-'
      }
   }
}

// Checks if the user entered any instructions
bool CParser::CheckInstructions()
{
   vectorOfStringIT it = m_vecInstructions.begin();

   for (; it != m_vecInstructions.end(); it++)
   {
      if ((*it).compare("new") == 0)
      {
         bNew = true;
      }
      else if ((*it).compare("add") == 0)
      {
         bAdd = true;
      }
      else if ((*it).compare("cat") == 0)
      {
         bPrintFields = true;
      }
      else if ((*it).compare("dat") == 0)
      {
         bPrintDates = true;
      }
      else if ((*it).compare("tab") == 0)
      {
         bPrintSpecific = true;
      }
      else if ((*it).compare("log") == 0)
      {
         bLog = true;
      }
      else if ((*it).compare("reset") == 0)
      {
         bReset = true;
      }
      else if ((*it).compare("help") == 0)
      {
         bHelp = true;
      }
      else if ((*it).compare("by") == 0)
      {
         bMadeBy = true;
      }
      else if ((*it).compare("version") == 0)
      {
         bVersion = true;
      }
   }

   if (!bNew && !bAdd && !bPrintFields && !bPrintDates && !bPrintSpecific && !bLog && !bMadeBy && !bReset && !bHelp && !bVersion)
   {
      // The user did not enter a command or she/he did not enter a valid one, so we should terminate the execution

      std::cout << '\n';
      std::cout << "   You did not enter a valid command. In order to see which commands are valid use the 'help' command.\n";
      std::cout << '\n';

      return false;
   }

   if (m_iNumInstructions > 1)
   {
      // The user entered more than one instruction
      // Instructions should be entered independently, so we should terminate the execution

      std::cout << '\n';
      std::cout << "   You can only enter 1 command at a time.\n\n";
      std::cout << "   If you only entered 1 command, check that the date or the categories you entered have a '-' in front of them.\n";
      std::cout << '\n';

      return false;
   }

   return true;
}

void CParser::WriteFieldsToFile()
{
   std::ofstream DataFieldsFile(strTableCategoriesPath, std::ofstream::app);

   if (DataFieldsFile.is_open())
   {
      vectorOfStringIT it = m_vecDataFields.begin();
      std::string sCurrentField;

      for (; it != m_vecDataFields.end(); it++)
      {
         sCurrentField = *it;
         DataFieldsFile << sCurrentField << '\n';
      }
      DataFieldsFile.close();
   }
}

std::vector<std::string> CParser::ReadFieldsFromFile()
{
   std::vector<std::string> Fields;

   std::string line;
   std::ifstream DataFieldsFile(strTableCategoriesPath);
   if (DataFieldsFile.is_open())
   {
      while (std::getline(DataFieldsFile, line))
      {
         Fields.push_back(line);
      }
      DataFieldsFile.close();
   }

   return Fields;
}

std::vector<std::string> CParser::GetNewFields()
{
   return m_vecDataFields;
}

// Checks if a given data field exists
bool CParser::DataFieldExists(std::string sCmd)
{
   vectorOfStringIT it = m_vecDataFields.begin();

   size_t iIndex;
   for (; it != m_vecDataFields.end(); it++)
   {
      iIndex = (*it).find('=');

      if ((*it).substr(0, iIndex).compare(sCmd) == 0)   // If the data field entered by the user exists, the database is updated with the value entered by the user
      {
         return true;
      }
   }
   return false;
}

// Returns the date entered by the user as a string in the format xx/yy/zzzz
std::string CParser::GetDate()
{
   vectorOfStringIT it = m_vecDataFields.begin();
   time_t time_raw;
   char buf[12];

   size_t iIndex;
   for (; it != m_vecDataFields.end(); it++)
   {
      iIndex = (*it).find('=');

      if ((*it).substr(0, iIndex).compare("d") == 0)
      {
         return (*it).substr(iIndex + 1);
      }
   }
   time(&time_raw);
   strftime(buf, 12, "%d/%m/%Y", localtime(&time_raw));
   return buf;
}

// Extracts the value associated with a data field
double CParser::GetDataFieldValue(std::string sCmd)
{
   vectorOfStringIT it = m_vecDataFields.begin();

   size_t iIndex;
   for (; it != m_vecDataFields.end(); it++)
   {
      iIndex = (*it).find('=');

      if ((*it).substr(0, iIndex).compare(sCmd) == 0)
      {
         return std::stod((*it).substr(iIndex + 1));
      }
   }
   return 0;
}

std::vector<std::string> CParser::GetShortDataFields()
{
   vectorOfString vecLongExpenseFields;
   vectorOfString vecShortExpenseFields;

   vecLongExpenseFields = ReadFieldsFromFile();

   std::string sCurrentField;
   std::string sCurrentShortFieldVersion;
   int iExtraLetterCount;
   for (size_t i = 0; i < vecLongExpenseFields.size(); i++)
   {
      sCurrentField = vecLongExpenseFields.at(i);

      // First field
      // Its initial short version is final since there are no other short fields to compare it to.
      if (i == 0)
      {
         if (sCurrentField.length() < 3)
         {
            vecShortExpenseFields.push_back(sCurrentField);              // Long name is less than 3 characters = take the entire field.
         }
         else
         {
            vecShortExpenseFields.push_back(sCurrentField.substr(0, 3)); // Long name is more than 3 characters = take the first 3 characters.
         }
      }
      // All the other fields
      else
      {
         if (sCurrentField.length() < 3)
         {
            vecShortExpenseFields.push_back(sCurrentField);         // It is impossible to have fields of 1 or 2 characters that are repeated.
            // For this reason they are included without comparing them to the other short fields.
         }
         else
         {
            iExtraLetterCount = 0;
            sCurrentShortFieldVersion = sCurrentField.substr(0, 3);

            // Comparison loop
            for (size_t j = 0; j < vecShortExpenseFields.size(); j++)
            {
               if (sCurrentShortFieldVersion == vecShortExpenseFields.at(j))
               {
                  // Do I have an extra letter?
                  if (sCurrentField.length() > sCurrentShortFieldVersion.length())
                  {
                     // Yes
                     // Add existing letter at the end
                     iExtraLetterCount++;
                     sCurrentShortFieldVersion = sCurrentField.substr(0, 3 + iExtraLetterCount);
                  }
                  else
                  {
                     // No
                     // Add '+' at the end
                     sCurrentShortFieldVersion = sCurrentShortFieldVersion + '+';
                     break;
                  }
               }
            }

            vecShortExpenseFields.push_back(sCurrentShortFieldVersion);

         }
      }
   }

   // Force the short fields to be lowercase
   vectorOfStringIT it = vecShortExpenseFields.begin();
   std::string sTempField;
   vectorOfString vecLowercaseShortExpenseFields;

   for (; it != vecShortExpenseFields.end(); it++)
   {
      sTempField = *it;
      std::transform(sTempField.begin(), sTempField.end(), sTempField.begin(), tolower);
      vecLowercaseShortExpenseFields.push_back(sTempField);
   }

   return vecLowercaseShortExpenseFields;
}

bool CParser::CheckEachFieldHasEqualSign()
{
   vectorOfStringIT it = m_vecDataFields.begin();

   size_t iIndex;
   for (; it != m_vecDataFields.end(); it++)
   {
      iIndex = (*it).find('=');

      if (iIndex == std::string::npos)
      {
         return false;
      }
   }

   return true;
}

bool CParser::CheckEachFieldHasQuantity()
{
   vectorOfStringIT it = m_vecDataFields.begin();

   size_t iIndex;
   for (; it != m_vecDataFields.end(); it++)
   {
      iIndex = (*it).find('=');
      if (iIndex + 2 > (*it).length())
      {
         return false;
      }
   }

   return true;
}

bool CParser::CheckQuantitiesAreNumbers()
{
   vectorOfStringIT it = m_vecDataFields.begin();
   std::string::size_type sz;

   size_t iIndex;
   for (; it != m_vecDataFields.end(); it++)
   {
      iIndex = (*it).find('=');
      if ((*it).substr(0, iIndex).compare("d") != 0)
      {
         try
         {
            std::stod((*it).substr(iIndex + 1), &sz);
         }
         catch (const std::invalid_argument&)
         {
            return false;
         }

         if ((*it).substr(iIndex + 1).length() != sz)
         {
            return false;
         }
      }
   }

   return true;
}

bool CParser::CheckUserEnteredProperDate(bool bPrintSpecificTable)
{
   vectorOfStringIT it = m_vecDataFields.begin();
   bool bDateAvailable = false;
   std::string sDate;

   size_t iIndex;
   for (; it != m_vecDataFields.end(); it++)
   {
      iIndex = (*it).find('=');

      if ((*it).substr(0, iIndex).compare("d") == 0)
      {
         bDateAvailable = true;
         sDate = (*it).substr(iIndex + 1);
      }
   }

   if (!bDateAvailable && bLog)
   {
      /*
       * Return true here if no date option was entered on the commandline,
       * since we will use today's date later on
       */
      return true;
   }

   if (bPrintSpecificTable)
   {
      sDate = "01/" + sDate;
   }

   int iSlashIndices[2];

   iSlashIndices[0] = sDate.find("/");

   if (iSlashIndices[0] == std::string::npos || (iSlashIndices[0] != 1 && iSlashIndices[0] != 2))
   {
      return false;
   }

   iSlashIndices[1] = sDate.find("/", iSlashIndices[0] + 1);

   if (iSlashIndices[1] == std::string::npos || (iSlashIndices[1] != 3 && iSlashIndices[1] != 4 && iSlashIndices[1] != 5))
   {
      return false;
   }

   int iInputDay, iInputMonth, iInputYear;
   std::string::size_type sz;

   try
   {
      iInputDay = std::stoi(sDate.substr(0, iSlashIndices[0]), &sz);
   }
   catch (const std::invalid_argument&)
   {
      return false;
   }
   if (sDate.substr(0, iSlashIndices[0]).length() != sz)
   {
      return false;
   }

   try
   {
      iInputMonth = std::stoi(sDate.substr(iSlashIndices[0] + 1, iSlashIndices[1] - iSlashIndices[0] - 1), &sz);
      if (iInputMonth < 1 || iInputMonth > 12)
      {
         return false;
      }
   }
   catch (const std::invalid_argument&)
   {
      return false;
   }
   if (sDate.substr(iSlashIndices[0] + 1, iSlashIndices[1] - iSlashIndices[0] - 1).length() != sz)
   {
      return false;
   }

   try
   {
      iInputYear = std::stoi(sDate.substr(iSlashIndices[1] + 1, std::string::npos), &sz);
      if (iInputYear < 1000 || iInputYear >9999)
      {
         return false;
      }
   }
   catch (const std::invalid_argument&)
   {
      return false;
   }
   if (sDate.substr(iSlashIndices[1] + 1, std::string::npos).length() != sz)
   {
      return false;
   }

   int DaysInEachMonth[] = { 31,28,31,30,31,30,31,31,30,31,30,31 };

   if ((!(iInputYear % 4) && (iInputYear % 100) || !(iInputYear % 400)))
   {
      DaysInEachMonth[1] = 29;
   }

   if (iInputDay > DaysInEachMonth[iInputMonth - 1] || iInputDay == 0)
   {
      return false;
   }

   return true;

}

bool CParser::CheckCreationFieldsAreValid()
{
   vectorOfStringIT it = m_vecDataFields.begin();

   if (m_iNumDataFields == 0)
   {
      std::cout << '\n';
      std::cout << "   You did not enter any categories. Please specify each category as '-Category' and separate each one by one or more spaces.\n";
      std::cout << '\n';
      return false;
   }

   for (; it != m_vecDataFields.end(); it++)
   {
      if ((std::string::npos != (*it).find_first_not_of("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ")))
      {
         std::cout << '\n';
         std::cout << "   Categories cannot contain numbers or symbols.\n";
         std::cout << '\n';
         return false;
      }
   }
   return true;
}

bool CParser::CheckIfFileExists(std::string filePath)
{
   struct stat buffer;

   if ((stat(filePath.c_str(), &buffer) == 0))
   {
      return false;
   }

   return true;
}

bool CParser::CheckIfUserEnteredValidFields()
{
   vectorOfStringIT it = m_vecDataFields.begin();

   int iNumOfCategories = 0;

   size_t iIndex;
   for (; it != m_vecDataFields.end(); it++)
   {
      iIndex = (*it).find('=');

      if ((*it).substr(0, iIndex).compare("d") != 0)
      {
         iNumOfCategories++;
      }
   }

   if (iNumOfCategories == 0)
   {
      std::cout << '\n';
      std::cout << "   You did not enter any categories to log. Please enter categories in the format '-code=quantity'.\n";
      std::cout << '\n';

      return false;
   }

   vectorOfString vecShortFields = GetShortDataFields();
   vectorOfString vecInputShortFields;

   it = m_vecDataFields.begin();
   for (; it != m_vecDataFields.end(); it++)
   {
      iIndex = (*it).find('=');

      if ((*it).substr(0, iIndex).compare("d") != 0)
      {
         vecInputShortFields.push_back((*it).substr(0, iIndex));
      }
   }

   bool bFieldIsValid;
   bool bInvalidFieldPresent = false;
   for (size_t i = 0; i < vecInputShortFields.size(); i++)
   {
      bFieldIsValid = false;
      for (size_t j = 0; j < vecShortFields.size(); j++)
      {
         if ((vecInputShortFields.at(i) == vecShortFields.at(j)))
         {
            bFieldIsValid = true;
            break;
         }
      }

      if (!bFieldIsValid)
      {
         bInvalidFieldPresent = true;
         break;
      }
   }

   if (bInvalidFieldPresent)
   {
      std::cout << '\n';
      std::cout << "   You entered invalid categories to log. Use the 'cat' command to see the categories that are valid and their codes.\n";
      std::cout << '\n';
      return false;
   }
   else
   {
      return true;
   }
}

bool CParser::CheckCreationFieldsAreUnique()
{
   vectorOfString vecCategories = m_vecDataFields;
   std::string sTempString;

   vecCategories.push_back("new");
   vecCategories.push_back("add");
   vecCategories.push_back("log");
   vecCategories.push_back("dat");
   vecCategories.push_back("cat");
   vecCategories.push_back("tab");
   vecCategories.push_back("reset");
   vecCategories.push_back("by");
   vecCategories.push_back("d");
   vecCategories.push_back("help");
   vecCategories.push_back("version");

   for (size_t i = 0; i < vecCategories.size(); i++)
   {
      sTempString = vecCategories.at(i);
      std::transform(sTempString.begin(), sTempString.end(), sTempString.begin(), tolower);
      vecCategories.at(i) = sTempString;
   }

   for (size_t i = 0; i < vecCategories.size(); i++)
   {
      for (size_t j = 0; j < vecCategories.size(); j++)
      {
         if ((vecCategories.at(i) == vecCategories.at(j)) && (i != j))
         {
            std::cout << '\n';
            std::cout << "   You entered categories that are repeated or that match existing commands. Please ensure that the categories you enter are unique.\n";
            std::cout << '\n';
            return false;
         }
      }
   }
   return true;
}

bool CParser::CheckFieldsBeingAddedAreUnique()
{
   vectorOfString vecNewCategories = m_vecDataFields;
   vectorOfString vecCategories = ReadFieldsFromFile();
   std::string sTempString;

   vecCategories.push_back("new");
   vecCategories.push_back("add");
   vecCategories.push_back("log");
   vecCategories.push_back("dat");
   vecCategories.push_back("cat");
   vecCategories.push_back("tab");
   vecCategories.push_back("reset");
   vecCategories.push_back("by");
   vecCategories.push_back("d");
   vecCategories.push_back("help");
   vecCategories.push_back("version");

   for (size_t i = 0; i < vecNewCategories.size(); i++)
   {
      vecCategories.push_back(vecNewCategories.at(i));
   }

   for (size_t i = 0; i < vecCategories.size(); i++)
   {
      sTempString = vecCategories.at(i);
      std::transform(sTempString.begin(), sTempString.end(), sTempString.begin(), tolower);
      vecCategories.at(i) = sTempString;
   }

   for (size_t i = 0; i < vecCategories.size(); i++)
   {
      for (size_t j = 0; j < vecCategories.size(); j++)
      {
         if ((vecCategories.at(i) == vecCategories.at(j)) && (i != j))
         {
            std::cout << '\n';
            std::cout << "   You entered categories that are repeated or that match existing commands. Please ensure that the categories you enter are unique.\n\n";
            std::cout << "   You can see the categories that are already in the database using the 'cat' command.\n";
            std::cout << '\n';
            return false;
         }
      }
   }
   return true;
}

bool CParser::CheckFieldsAreUnique()
{
   vectorOfStringIT it = m_vecDataFields.begin();
   vectorOfString vecCategories;

   size_t iIndex;
   for (; it != m_vecDataFields.end(); it++)
   {
      iIndex = (*it).find('=');
      vecCategories.push_back((*it).substr(0, iIndex));
   }

   for (size_t i = 0; i < vecCategories.size(); i++)
   {
      for (size_t j = 0; j < vecCategories.size(); j++)
      {
         if ((vecCategories.at(i) == vecCategories.at(j)) && (i != j))
         {
            return false;
         }
      }
   }
   return true;
}

bool CParser::CheckUserOnlyEnteredXFields(int iNumOfFields)
{
   if (m_iNumDataFields != iNumOfFields)
   {
      return false;
   }
   return true;
}


================================================
FILE: code/Makefile
================================================
CXX = g++ -std=c++11
cc = gcc

LIB = -lpthread -ldl
BIN = sqlite pfox

all : $(BIN)
sqlite : sqlite3.c shell.c
	$(cc) -o $@ $^ $(LIB)
pfox : main.cpp sqlite3.o
	$(CXX) -o $@ $^ $(LIB)
sqlite3.o : sqlite3.c
	$(cc) -o $@ -c $^

clean :
	rm -f $(BIN)

.PHONY: all, clean


================================================
FILE: code/TablePrinter.h
================================================
#include <string>
#include <vector>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <math.h>

#ifdef __APPLE__
#include <cmath>
#endif

class CTablePrinter
{

public:

   CTablePrinter(std::ofstream &outFile, std::string strPrintOutPath);
   ~CTablePrinter();

   std::ofstream *outFile;
   std::string strPrintOutPath;

   std::vector<std::string> MyTitles; // Data fields
   std::vector<std::string> MyValues; // Values entered by the user
   std::vector<std::string> MyTotals; // Total associated with each data field for the month entered by the user

   int iNumOfFields;                  // Number of fields (currently harcoded inside the constructor)
   int iNumOfRows;                    // Number of days logged in the month entered by the user

   std::string sDate;                 // Date in the format xx/yy/zzzz
   int iDateSpace;                    // Length of the sDate string

   double dFinalTotal;                // Sumation of all the totals - all the money spent in the month entered by the user

   bool bBoldColor;                   // Used to swap the colors of the bars on the graph
   bool bPrintTotals;                 // Used to print the table containing all the totals after the main table

   int i;
   int j;
   int iBlankSpaceLength;
   std::vector<int> vecMaxValCharSize;
   std::vector<int> vecFieldLengths;
   std::string sCol, sVal;
   int iColLen, iValLen;

   void CalculateSpaceOccupiedByEachField();
   void CalculateTotals(int iInputDay, int iInputMonth, int iInputYear);
   void PrintTopBar();
   void PrintMiddleBar();
   void PrintBottomBar();
   void PrintFields();
   void PrintValues(int iRowOffset);
   bool PrintTotalsAndGraph();
   void PrintFieldsAndCommands(std::vector<std::string> MyFields, std::vector<std::string> MyShortFields);
   void PrintDates();
   void MadeBy();

   std::string HorizontalBar_Thick;
   std::string HorizontalBar_ConnectorDown;
   std::string HorizontalBar_ConnectorUp;

   std::string VerticalBar_Thick;
   std::string VerticalBar_ConnectorRight;
   std::string VerticalBar_ConnectorLeft;

   std::string TopLeftCorner;
   std::string TopRightCorner;
   std::string BottomLeftCorner;
   std::string BottomRightCorner;

   std::string HorizontalBar_Thin;
   std::string VerticalBar_Thin;
   std::string Intersection;

   std::string Cube;

private:

};

// Constructor: Reset the counters and parse the user input.
CTablePrinter::CTablePrinter(std::ofstream &outFile, std::string strPrintOutPath)
{
   
   this->outFile = &outFile;
   this->strPrintOutPath = strPrintOutPath;

   iNumOfRows = 0;
   bBoldColor = false;
   bPrintTotals = false;

   HorizontalBar_Thick = "\xE2\x95\x90"; //  ═
   HorizontalBar_ConnectorDown = "\xE2\x95\xA4"; //  ╤
   HorizontalBar_ConnectorUp = "\xE2\x95\xA7"; //  ╧

   VerticalBar_Thick = "\xE2\x95\x91"; //  ║
   VerticalBar_ConnectorRight = "\xE2\x95\x9F"; //  ╟
   VerticalBar_ConnectorLeft = "\xE2\x95\xA2"; //  ╢

   TopLeftCorner = "\xE2\x95\x94"; //  ╔
   TopRightCorner = "\xE2\x95\x97"; //  ╗
   BottomLeftCorner = "\xE2\x95\x9A"; //  ╚
   BottomRightCorner = "\xE2\x95\x9D"; //  ╝

   HorizontalBar_Thin = "\xE2\x94\x80"; //  ─
   VerticalBar_Thin = "\x7C"; //  |
   Intersection = "\xE2\x94\xBC"; //  ┼

   Cube = "\xE2\x96\xA0"; //  ■
}

// Destructor
CTablePrinter::~CTablePrinter()
{

}

void CTablePrinter::CalculateSpaceOccupiedByEachField()
{

   iDateSpace = 12;

   // Calculate which of the entries has the most characters
   int iCurrentValLen;

   for (i = 0; i < iNumOfFields; i++)
   {
      vecMaxValCharSize.push_back(MyValues.at(i).length());
   }

   for (i = 0; i < iNumOfFields; i++)
   {
      for (j = 0; j < iNumOfRows; j++)
      {
         iCurrentValLen = MyValues.at(i + (j * iNumOfFields)).length();
         vecMaxValCharSize.at(i) = std::max(vecMaxValCharSize.at(i), iCurrentValLen);
      }
   }

   // Begin by calculating the space occupied by each field
   for (i = 0; i < iNumOfFields; i++)
   {
      sCol = MyTitles.at(i);
      iColLen = sCol.length();
      iValLen = vecMaxValCharSize.at(i);

      if (iColLen < iValLen) // Size of the field must be equal to 12 characters
      {
         iBlankSpaceLength = iValLen - iColLen;
         if (iBlankSpaceLength % 2 != 0) { iBlankSpaceLength++; }
         vecFieldLengths.push_back(iBlankSpaceLength + iColLen + 2);
      }
      else
      {
         vecFieldLengths.push_back(iColLen + 2);
      }
   }

}

void CTablePrinter::CalculateTotals(int iInputDay, int iInputMonth, int iInputYear)
{
   double dTempTotal;
   std::stringstream ssTempTotal;

   dFinalTotal = 0;

   for (j = 3; j < iNumOfFields; j++)
   {
      dTempTotal = 0.0;
      ssTempTotal.str("");
      ssTempTotal.clear();
      for (i = j; i < (iNumOfFields * iNumOfRows); i += iNumOfFields)
      {
         dTempTotal += std::stod(MyValues.at(i));
      }

      dFinalTotal += dTempTotal;

      ssTempTotal << std::setprecision(12) << dTempTotal; // Billion dollar precision

      double intpart;
      if (modf(dTempTotal, &intpart) == 0)
      {
         MyTotals.push_back(ssTempTotal.str() + ".0");
      }
      else
      {
         MyTotals.push_back(ssTempTotal.str());
      }

   }

   MyValues.clear();
   vecMaxValCharSize.clear();
   vecFieldLengths.clear();
   iNumOfRows = 1;

   std::stringstream ssTime;

   ssTime << iInputDay;
   MyValues.push_back(ssTime.str());
   ssTime.str("");
   ssTime.clear();
   ssTime << iInputMonth;
   MyValues.push_back(ssTime.str());
   ssTime.str("");
   ssTime.clear();
   ssTime << iInputYear;
   MyValues.push_back(ssTime.str());

   for (j = 3; j < iNumOfFields; j++)
   {
      MyValues.push_back(MyTotals.at(j - 3));
   }

   bPrintTotals = true;

}

void CTablePrinter::PrintTopBar()
{
   // Print top bar
   for (i = 0; i < iNumOfFields; i++)
   {

      if (i == 0 || i == 1)
      {
         // Do nothing
      }
      else if (i == 2) // First
      {
         if (!bPrintTotals)
         {
            *outFile << "console.log(chalk.gray.bold('   " << TopLeftCorner; // ╔

            for (j = 0; j < iDateSpace; j++)
            {
               *outFile << HorizontalBar_Thick; // ═
            }
         }
         else
         {
            *outFile << "console.log(chalk.gray.bold('    ";

            for (j = 0; j < iDateSpace; j++)
            {
               *outFile << " ";
            }
         }
      }
      else if ((i == iNumOfFields - 1) && (i == 3)) // Special case (applies when the table only has 1 field)
      {
         if (!bPrintTotals)
         {
            *outFile << HorizontalBar_ConnectorDown; // ╤

            for (j = 0; j < vecFieldLengths.at(i); j++)
            {
               *outFile << HorizontalBar_Thick; // ═
            }
            *outFile << TopRightCorner << "'));\n"; // ╗
         }
         else
         {
            *outFile << TopLeftCorner; // ╔

            for (j = 0; j < vecFieldLengths.at(i); j++)
            {
               *outFile << HorizontalBar_Thick; // ═
            }
            *outFile << TopRightCorner << "'));\n"; // ╗
         }
      }
      else if (i == iNumOfFields - 1) // Last
      {
         *outFile << HorizontalBar_ConnectorDown; // ╤

         for (j = 0; j < vecFieldLengths.at(i); j++)
         {
            *outFile << HorizontalBar_Thick; // ═
         }
         *outFile << TopRightCorner << "'));\n"; // ╗
      }
      else // Middle
      {
         if (!bPrintTotals)
         {
            *outFile << HorizontalBar_ConnectorDown; // ╤

            for (j = 0; j < vecFieldLengths.at(i); j++)
            {
               *outFile << HorizontalBar_Thick; // ═
            }
         }
         else
         {
            if (i == 3)
            {
               *outFile << TopLeftCorner; // ╔
            }
            else
            {
               *outFile << HorizontalBar_ConnectorDown; // ╤
            }

            for (j = 0; j < vecFieldLengths.at(i); j++)
            {
               *outFile << HorizontalBar_Thick; // ═
            }
         }
      }
   }
}

void CTablePrinter::PrintMiddleBar()
{
   // Print middle bar
   for (i = 0; i < iNumOfFields; i++)
   {
      if (i == 0 || i == 1)
      {
         // Do nothing
      }
      else if (i == 2)
      {
         if (!bPrintTotals)
         {
            *outFile << "console.log(chalk.gray.bold('   " << VerticalBar_ConnectorRight;

            for (j = 0; j < iDateSpace; j++)
            {
               *outFile << HorizontalBar_Thin;
            }
         }
         else
         {
            *outFile << "console.log(chalk.gray.bold('   " << TopLeftCorner;

            for (j = 0; j < 10; j++)
            {
               *outFile << HorizontalBar_Thick;
            }
         }
      }
      else if ((i == iNumOfFields - 1) && (i == 3))
      {
         if (!bPrintTotals)
         {
            *outFile << Intersection;

            for (j = 0; j < vecFieldLengths.at(i); j++)
            {
               *outFile << HorizontalBar_Thin;
            }
            *outFile << VerticalBar_ConnectorLeft << "'));\n";
         }
         else
         {
            *outFile << TopRightCorner << " " << VerticalBar_ConnectorRight;

            for (j = 0; j < vecFieldLengths.at(i); j++)
            {
               *outFile << HorizontalBar_Thin;
            }
            *outFile << VerticalBar_ConnectorLeft << "'));\n";
         }
      }
      else if (i == iNumOfFields - 1)
      {
         *outFile << Intersection;

         for (j = 0; j < vecFieldLengths.at(i); j++)
         {
            *outFile << HorizontalBar_Thin;
         }
         *outFile << VerticalBar_ConnectorLeft << "'));\n";
      }
      else
      {
         if (!bPrintTotals)
         {
            *outFile << Intersection;

            for (j = 0; j < vecFieldLengths.at(i); j++)
            {
               *outFile << HorizontalBar_Thin;
            }
         }
         else
         {
            if (i == 3)
            {
               *outFile << TopRightCorner << " " << VerticalBar_ConnectorRight;

               for (j = 0; j < vecFieldLengths.at(i); j++)
               {
                  *outFile << HorizontalBar_Thin;
               }
            }
            else
            {
               *outFile << Intersection;

               for (j = 0; j < vecFieldLengths.at(i); j++)
               {
                  *outFile << HorizontalBar_Thin;
               }
            }
         }
      }
   }
}

void CTablePrinter::PrintBottomBar()
{
   // Print bottom bar
   for (i = 0; i < iNumOfFields; i++)
   {
      if (i == 0 || i == 1)
      {
         // Do nothing
      }
      else if (i == 2)
      {
         if (!bPrintTotals)
         {
            *outFile << "console.log(chalk.gray.bold('   " << BottomLeftCorner;
            for (j = 0; j < iDateSpace; j++)
            {
               *outFile << HorizontalBar_Thick;
            }
         }
         else
         {
            *outFile << "console.log(chalk.gray.bold('   " << BottomLeftCorner;
            for (j = 0; j < 10; j++)
            {
               *outFile << HorizontalBar_Thick;
            }
         }
      }
      else if ((i == iNumOfFields - 1) && (i == 3))
      {
         if (!bPrintTotals)
         {
            *outFile << HorizontalBar_ConnectorUp;
            for (j = 0; j < vecFieldLengths.at(i); j++)
            {
               *outFile << HorizontalBar_Thick;
            }
            *outFile << BottomRightCorner << "'));\n";

            PrintTotalsAndGraph();
         }
         else
         {
            *outFile << BottomRightCorner << " " << BottomLeftCorner;

            for (j = 0; j < vecFieldLengths.at(i); j++)
            {
               *outFile << HorizontalBar_Thick;
            }
            *outFile << BottomRightCorner << "'));\n";

            PrintTotalsAndGraph();
         }
      }
      else if (i == iNumOfFields - 1)
      {
         *outFile << HorizontalBar_ConnectorUp;
         for (j = 0; j < vecFieldLengths.at(i); j++)
         {
            *outFile << HorizontalBar_Thick;
         }
         *outFile << BottomRightCorner << "'));\n";

         PrintTotalsAndGraph();

      }
      else
      {
         if (!bPrintTotals)
         {
            *outFile << HorizontalBar_ConnectorUp;

            for (j = 0; j < vecFieldLengths.at(i); j++)
            {
               *outFile << HorizontalBar_Thick;
            }
         }
         else
         {
            if (i == 3)
            {
               *outFile << BottomRightCorner << " " << BottomLeftCorner;

               for (j = 0; j < vecFieldLengths.at(i); j++)
               {
                  *outFile << HorizontalBar_Thick;
               }
            }
            else
            {
               *outFile << HorizontalBar_ConnectorUp;

               for (j = 0; j < vecFieldLengths.at(i); j++)
               {
                  *outFile << HorizontalBar_Thick;
               }
            }
         }
      }
   }
}

void CTablePrinter::PrintFields()
{
   // Print fields
   for (i = 0; i < iNumOfFields; i++)
   {
      sCol = MyTitles.at(i);
      if (i == 0 || i == 1)
      {
         // Do nothing
      }
      else if (i == 2) // First field
      {
         if (!bPrintTotals)
         {
            iBlankSpaceLength = iDateSpace - 4;
            if (iBlankSpaceLength % 2 != 0) { iBlankSpaceLength++; }
            std::string sBlankSpace(iBlankSpaceLength / 2, ' ');

            *outFile << "process.stdout.write(chalk.gray.bold('   " << VerticalBar_Thick << "'));\n";
            *outFile << "process.stdout.write(chalk.yellow.bold('" << sBlankSpace.c_str() << "Date" << sBlankSpace.c_str() << "'));\n";
         }
         else
         {
            iBlankSpaceLength = iDateSpace - 4;
            if (iBlankSpaceLength % 2 != 0) { iBlankSpaceLength++; }
            std::string sBlankSpace(iBlankSpaceLength / 2, ' ');

            *outFile << "process.stdout.write('    ');\n";
            *outFile << "process.stdout.write(chalk.yellow.bold('" << sBlankSpace.c_str() << "    " << sBlankSpace.c_str() << "'));\n";
         }
      }
      else if ((i == iNumOfFields - 1) && (i == 3)) // Special case (applies when the table only has 1 field)
      {
         if (!bPrintTotals)
         {
            iBlankSpaceLength = vecFieldLengths.at(i) - sCol.length();
            if (iBlankSpaceLength % 2 != 0) { iBlankSpaceLength++; }
            std::string sBlankSpace(iBlankSpaceLength / 2, ' ');

            *outFile << "process.stdout.write(chalk.gray.bold('" << VerticalBar_Thin << "'));\n";
            *outFile << "process.stdout.write(chalk.cyan.bold('" << sBlankSpace.c_str() << MyTitles.at(i) << sBlankSpace.c_str() << "'));\n";
            *outFile << "console.log(chalk.gray.bold('" << VerticalBar_Thick << "'));\n";
         }
         else
         {
            iBlankSpaceLength = vecFieldLengths.at(i) - sCol.length();
            if (iBlankSpaceLength % 2 != 0) { iBlankSpaceLength++; }
            std::string sBlankSpace(iBlankSpaceLength / 2, ' ');

            *outFile << "process.stdout.write(chalk.gray.bold('" << VerticalBar_Thick << "'));\n";
            *outFile << "process.stdout.write(chalk.cyan.bold('" << sBlankSpace.c_str() << MyTitles.at(i) << sBlankSpace.c_str() << "'));\n";
            *outFile << "console.log(chalk.gray.bold('" << VerticalBar_Thick << "'));\n";
         }
      }
      else if (i == iNumOfFields - 1) // Last field
      {
         iBlankSpaceLength = vecFieldLengths.at(i) - sCol.length();
         if (iBlankSpaceLength % 2 != 0) { iBlankSpaceLength++; }
         std::string sBlankSpace(iBlankSpaceLength / 2, ' ');

         *outFile << "process.stdout.write(chalk.gray.bold('" << VerticalBar_Thin << "'));\n";
         *outFile << "process.stdout.write(chalk.cyan.bold('" << sBlankSpace.c_str() << MyTitles.at(i) << sBlankSpace.c_str() << "'));\n";
         *outFile << "console.log(chalk.gray.bold('" << VerticalBar_Thick << "'));\n";

      }
      else // Middle field
      {
         if (!bPrintTotals)
         {
            iBlankSpaceLength = vecFieldLengths.at(i) - sCol.length();
            if (iBlankSpaceLength % 2 != 0) { iBlankSpaceLength++; }
            std::string sBlankSpace(iBlankSpaceLength / 2, ' ');

            *outFile << "process.stdout.write(chalk.gray.bold('" << VerticalBar_Thin << "'));\n";
            *outFile << "process.stdout.write(chalk.cyan.bold('" << sBlankSpace.c_str() << MyTitles.at(i) << sBlankSpace.c_str() << "'));\n";
         }
         else
         {
            if (i == 3)
            {
               iBlankSpaceLength = vecFieldLengths.at(i) - sCol.length();
               if (iBlankSpaceLength % 2 != 0) { iBlankSpaceLength++; }
               std::string sBlankSpace(iBlankSpaceLength / 2, ' ');

               *outFile << "process.stdout.write(chalk.gray.bold('" << VerticalBar_Thick << "'));\n";
               *outFile << "process.stdout.write(chalk.cyan.bold('" << sBlankSpace.c_str() << MyTitles.at(i) << sBlankSpace.c_str() << "'));\n";
            }
            else
            {
               iBlankSpaceLength = vecFieldLengths.at(i) - sCol.length();
               if (iBlankSpaceLength % 2 != 0) { iBlankSpaceLength++; }
               std::string sBlankSpace(iBlankSpaceLength / 2, ' ');

               *outFile << "process.stdout.write(chalk.gray.bold('" << VerticalBar_Thin << "'));\n";
               *outFile << "process.stdout.write(chalk.cyan.bold('" << sBlankSpace.c_str() << MyTitles.at(i) << sBlankSpace.c_str() << "'));\n";
            }
         }
      }
   }
}

void CTablePrinter::PrintValues(int iRowOffset)
{
   // Print values
   int iFieldLimit = 0;
   for (i = iRowOffset*iNumOfFields; iFieldLimit < iNumOfFields; i++)
   {

      if (iFieldLimit == 0 || iFieldLimit == 1)
      {
         // Do nothing
      }
      else if (iFieldLimit == 2) // First field
      {
         if (!bPrintTotals)
         {
            std::string sValue = MyValues.at(i);
            *outFile << "process.stdout.write(chalk.gray.bold('   " << VerticalBar_Thick << "'));\n";
            std::string sBlankSpace(iDateSpace - 10 - 1, ' ');

            if (std::stoi(MyValues.at(i - 2)) < 10) { MyValues.at(i - 2) = '0' + MyValues.at(i - 2); }
            if (std::stoi(MyValues.at(i - 1)) < 10) { MyValues.at(i - 1) = '0' + MyValues.at(i - 1); }

            if (bBoldColor) {
               *outFile << "process.stdout.write(chalk.white.bold('" << " " << MyValues.at(i - 2) << '/' << MyValues.at(i - 1) << '/' << MyValues.at(i) << sBlankSpace.c_str() << "'));\n";
               *outFile << "process.stdout.write(chalk.gray.bold('" << VerticalBar_Thin << "'));\n";
            }
            else
            {
               *outFile << "process.stdout.write(chalk.white('" << " " << MyValues.at(i - 2) << '/' << MyValues.at(i - 1) << '/' << MyValues.at(i) << sBlankSpace.c_str() << "'));\n";
               *outFile << "process.stdout.write(chalk.gray.bold('" << VerticalBar_Thin << "'));\n";
            }
         }
         else
         {
            std::string sValue = MyValues.at(i);
            *outFile << "process.stdout.write(chalk.gray.bold('   " << VerticalBar_Thick << "'));\n";
            std::string sBlankSpace(iDateSpace - 10 - 1, ' ');

            if (std::stoi(MyValues.at(i - 2)) < 10) { MyValues.at(i - 2) = '0' + MyValues.at(i - 2); }
            if (std::stoi(MyValues.at(i - 1)) < 10) { MyValues.at(i - 1) = '0' + MyValues.at(i - 1); }

            *outFile << "process.stdout.write(chalk.yellow.bold('" << "  " << "Totals" << "  " << "'));\n";
            *outFile << "process.stdout.write(chalk.gray.bold('" << VerticalBar_Thick << " '));\n";
            *outFile << "process.stdout.write(chalk.gray.bold('" << VerticalBar_Thick << "'));\n";
         }
      }
      else if (iFieldLimit == iNumOfFields - 1) // Last field
      {
         std::string sValue = MyValues.at(i);

         if (std::stod(sValue) == 0.0)
         {
            sValue = "0  ";
            std::string sBlankSpace(vecFieldLengths.at(iFieldLimit) - sValue.length() - 1, ' ');
            *outFile << "process.stdout.write(chalk.green('" << " " << sValue.c_str() << sBlankSpace.c_str() << "'));\n";
            *outFile << "console.log(chalk.gray.bold('" << VerticalBar_Thick << "'));\n";
         }
         else
         {
            std::string sBlankSpace(vecFieldLengths.at(iFieldLimit) - sValue.length() - 1, ' ');
            *outFile << "process.stdout.write(chalk.green.bold('" << " " << sValue.c_str() << sBlankSpace.c_str() << "'));\n";
            *outFile << "console.log(chalk.gray.bold('" << VerticalBar_Thick << "'));\n";
         }
      }
      else
      {
         std::string sValue = MyValues.at(i);

         if (std::stod(sValue) == 0.0)
         {
            sValue = "0  ";
            std::string sBlankSpace(vecFieldLengths.at(iFieldLimit) - sValue.length() - 1, ' ');
            *outFile << "process.stdout.write(chalk.green('" << " " << sValue.c_str() << sBlankSpace.c_str() << "'));\n";
            *outFile << "process.stdout.write(chalk.gray.bold('" << VerticalBar_Thin << "'));\n";
         }
         else
         {
            std::string sBlankSpace(vecFieldLengths.at(iFieldLimit) - sValue.length() - 1, ' ');
            *outFile << "process.stdout.write(chalk.green.bold('" << " " << sValue.c_str() << sBlankSpace.c_str() << "'));\n";
            *outFile << "process.stdout.write(chalk.gray.bold('" << VerticalBar_Thin << "'));\n";
         }
      }
      iFieldLimit++;
   }

   if (bBoldColor)
   {
      bBoldColor = false;
   }
   else
   {
      bBoldColor = true;
   }

}

bool CTablePrinter::PrintTotalsAndGraph()
{
   if (bPrintTotals)
   {
      // Determine the largest total
      double dMyMaxVal, dTempMaxCandidate;
      dMyMaxVal = std::stod(MyTotals.at(0));

      for (size_t k = 1; k < MyTotals.size(); k++)
      {
         dTempMaxCandidate = std::stod(MyTotals.at(k));
         if (dTempMaxCandidate > dMyMaxVal) {
            dMyMaxVal = dTempMaxCandidate;
         }
      }

      // Determine the length of each title
      int MaxLength, TempLength;
      MaxLength = MyTitles.at(3).length();

      std::vector<int> vecTitleLenghts;
      vecTitleLenghts.push_back(MyTitles.at(3).length());

      for (int k = 4; k < iNumOfFields; k++)
      {
         TempLength = MyTitles.at(k).length();
         if (TempLength > MaxLength)
         {
            MaxLength = TempLength;
         }
         vecTitleLenghts.push_back(TempLength);
      }

      if (MaxLength < 14)
      {
         MaxLength = 14;
      }

      std::vector<std::string> vecGraphValues;
      vecGraphValues.push_back("           0.1       0.2       0.3       0.4       0.5       0.6       0.7       0.8       0.9        1");
      vecGraphValues.push_back("            1         2         3         4         5         6         7         8         9         10");
      vecGraphValues.push_back("            10        20        30        40        50        60        70        80        90        100");
      vecGraphValues.push_back("           100       200       300       400       500       600       700       800       900       1000");
      vecGraphValues.push_back("           1000      2000      3000      4000      5000      6000      7000      8000      9000      10000");
      vecGraphValues.push_back("          10000     20000     30000     40000     50000     60000     70000     80000     90000     100000");
      vecGraphValues.push_back("          100000    200000    300000    400000    500000    600000    700000    800000    900000    1000000");
      vecGraphValues.push_back("         1000000   2000000   3000000   4000000   5000000   6000000   7000000   8000000   9000000   10000000");
      vecGraphValues.push_back("         10000000  20000000  30000000  40000000  50000000  60000000  70000000  80000000  90000000  100000000");
      vecGraphValues.push_back("        100000000 200000000 300000000 400000000 500000000 600000000 700000000 800000000 900000000 1000000000");

      int BoxSize, GraphIndex;
      if (dMyMaxVal < 1) { BoxSize = 1;        GraphIndex = 0; }
      else if (dMyMaxVal < 10) { BoxSize = 1;        GraphIndex = 1; }
      else if (dMyMaxVal < 100) { BoxSize = 1;        GraphIndex = 2; }
      else if (dMyMaxVal < 1000) { BoxSize = 10;       GraphIndex = 3; }
      else if (dMyMaxVal < 10000) { BoxSize = 100;      GraphIndex = 4; }
      else if (dMyMaxVal < 100000) { BoxSize = 1000;     GraphIndex = 5; }
      else if (dMyMaxVal < 1000000) { BoxSize = 10000;    GraphIndex = 6; }
      else if (dMyMaxVal < 10000000) { BoxSize = 100000;   GraphIndex = 7; }
      else if (dMyMaxVal < 100000000) { BoxSize = 1000000;  GraphIndex = 8; }
      else if (dMyMaxVal < 1000000000) { BoxSize = 10000000; GraphIndex = 9; }
      else
      {
         // Do not print graph is the maximum value is greater than or equal to 1 billion
         return false;
      }

      double dNumOfBoxes;
      double dMyTempVal;

      bool bBoldOk = true;
      if (dMyMaxVal < 1)
      {
         for (int e = 0; e < iNumOfFields - 3; e++)
         {
            std::string sBlankSpace(MaxLength - vecTitleLenghts.at(e), ' ');

            *outFile << "console.log('');\n";
            *outFile << "process.stdout.write(chalk.cyan.bold('" << " " << sBlankSpace.c_str() << MyTitles.at(e + 3) << " '" << "));\n";
            *outFile << "process.stdout.write(chalk.gray.bold('" << VerticalBar_Thick << " '));\n";

            dMyTempVal = std::stod(MyTotals.at(e)) * 100;
            dMyTempVal /= BoxSize;
            dMyTempVal = std::floor(dMyTempVal + 0.5) * BoxSize;

            dNumOfBoxes = dMyTempVal / BoxSize;

            for (int g = 0; g < dNumOfBoxes; g++)
            {
               if (bBoldOk)
               {
                  if (g == 0 && g == (dNumOfBoxes - 1))
                  {
                     *outFile << "process.stdout.write(chalk.green.bold('" << Cube << "'));\n";
                     bBoldOk = false;
                  }
                  else if (g == 0) // First
                  {
                     *outFile << "process.stdout.write(chalk.green.bold('" << Cube;
                  }
                  else if (g == dNumOfBoxes - 1) // Last
                  {
                     *outFile << Cube << "'));\n";
                     bBoldOk = false;
                  }
                  else
                  {
                     *outFile << Cube;
                  }
               }
               else
               {
                  if (g == 0 && g == (dNumOfBoxes - 1))
                  {
                     *outFile << "process.stdout.write(chalk.green('" << Cube << "'));\n";
                     bBoldOk = true;
                  }
                  else if (g == 0) // First
                  {
                     *outFile << "process.stdout.write(chalk.green('" << Cube;
                  }
                  else if (g == dNumOfBoxes - 1) // Last
                  {
                     *outFile << Cube << "'));\n";
                     bBoldOk = true;
                  }
                  else
                  {
                     *outFile << Cube;
                  }
               }
            }
         }
      }
      else if (dMyMaxVal < 10)
      {
         for (int e = 0; e < iNumOfFields - 3; e++)
         {
            std::string sBlankSpace(MaxLength - vecTitleLenghts.at(e), ' ');

            *outFile << "console.log('');\n";
            *outFile << "process.stdout.write(chalk.cyan.bold('" << " " << sBlankSpace.c_str() << MyTitles.at(e + 3) << " '" << "));\n";
            *outFile << "process.stdout.write(chalk.gray.bold('" << VerticalBar_Thick << " " << "'));\n";

            dMyTempVal = std::stod(MyTotals.at(e)) * 10;
            dMyTempVal /= BoxSize;
            dMyTempVal = std::floor(dMyTempVal + 0.5) * BoxSize;

            dNumOfBoxes = dMyTempVal / BoxSize;

            for (int g = 0; g < dNumOfBoxes; g++)
            {
               if (bBoldOk)
               {
                  if (g == 0 && g == (dNumOfBoxes - 1))
                  {
                     *outFile << "process.stdout.write(chalk.green.bold('" << Cube << "'));\n";
                     bBoldOk = false;
                  }
                  else if (g == 0) // First
                  {
                     *outFile << "process.stdout.write(chalk.green.bold('" << Cube;
                  }
                  else if (g == dNumOfBoxes - 1) // Last
                  {
                     *outFile << Cube << "'));\n";
                     bBoldOk = false;
                  }
                  else
                  {
                     *outFile << Cube;
                  }
               }
               else
               {
                  if (g == 0 && g == (dNumOfBoxes - 1))
                  {
                     *outFile << "process.stdout.write(chalk.green('" << Cube << "'));\n";
                     bBoldOk = true;
                  }
                  else if (g == 0) // First
                  {
                     *outFile << "process.stdout.write(chalk.green('" << Cube;
                  }
                  else if (g == dNumOfBoxes - 1) // Last
                  {
                     *outFile << Cube << "'));\n";
                     bBoldOk = true;
                  }
                  else
                  {
                     *outFile << Cube;
                  }
               }
            }
         }
      }
      else
      {
         for (int e = 0; e < iNumOfFields - 3; e++)
         {

            std::string sBlankSpace(MaxLength - vecTitleLenghts.at(e), ' ');

            *outFile << "console.log('');\n";
            *outFile << "process.stdout.write(chalk.cyan.bold('" << " " << sBlankSpace.c_str() << MyTitles.at(e + 3) << " '" << "));\n";
            *outFile << "process.stdout.write(chalk.gray.bold('" << VerticalBar_Thick << " '));\n";

            dMyTempVal = std::stod(MyTotals.at(e));
            dMyTempVal /= BoxSize;
            dMyTempVal = std::floor(dMyTempVal + 0.5) * BoxSize;

            dNumOfBoxes = dMyTempVal / BoxSize;

            for (int g = 0; g < dNumOfBoxes; g++)
            {
               if (bBoldOk)
               {
                  if (g == 0 && g == (dNumOfBoxes - 1))
                  {
                     *outFile << "process.stdout.write(chalk.green.bold('" << Cube << "'));\n";
                     bBoldOk = false;
                  }
                  else if (g == 0) // First
                  {
                     *outFile << "process.stdout.write(chalk.green.bold('" << Cube;
                  }
                  else if (g == dNumOfBoxes - 1) // Last
                  {
                     *outFile << Cube << "'));\n";
                     bBoldOk = false;
                  }
                  else
                  {
                     *outFile << Cube;
                  }
               }
               else
               {
                  if (g == 0 && g == (dNumOfBoxes - 1))
                  {
                     *outFile << "process.stdout.write(chalk.green('" << Cube << "'));\n";
                     bBoldOk = true;
                  }
                  else if (g == 0) // First
                  {
                     *outFile << "process.stdout.write(chalk.green('" << Cube;
                  }
                  else if (g == dNumOfBoxes - 1) // Last
                  {
                     *outFile << Cube << "'));\n";
                     bBoldOk = true;
                  }
                  else
                  {
                     *outFile << Cube;
                  }
               }
            }
         }
      }

      std::string sBlankSpace(MaxLength + 2, ' ');

      *outFile << "console.log('');\n";

      *outFile << "console.log(chalk.gray.bold('" << sBlankSpace.c_str() << BottomLeftCorner << HorizontalBar_Thick << HorizontalBar_Thick;
      for (int i = 1; i <= 10; i++)
      {
         for (int j = 1; j <= 10; j++)
         {
            if (j <= 9)
            {
               *outFile << HorizontalBar_Thick;
            }
            else
            {
               *outFile << HorizontalBar_ConnectorUp;
            }
         }
      }
      *outFile << "'));\n";

      *outFile << "console.log('" << sBlankSpace << vecGraphValues.at(GraphIndex) << "');\n";

      std::stringstream ssTemporary;
      ssTemporary << std::setprecision(12) << dFinalTotal;

      *outFile << "console.log(chalk.gray.bold('   " << TopLeftCorner;
      for (int i = 1; i <= 10; i++)
      {
         *outFile << HorizontalBar_Thick;
      }
      *outFile << TopRightCorner << "'));\n";

      *outFile << "process.stdout.write(chalk.gray.bold('   " << VerticalBar_Thick << "'));\n";
      *outFile << "process.stdout.write(chalk.yellow.bold('  Global  '));\n";
      *outFile << "process.stdout.write(chalk.gray.bold('" << VerticalBar_Thick << "'));\n";
      *outFile << "console.log(chalk.green.bold('   " << ssTemporary.str() << "'));\n";

      *outFile << "console.log(chalk.gray.bold('   " << BottomLeftCorner;
      for (int i = 1; i <= 10; i++)
      {
         *outFile << HorizontalBar_Thick;
      }
      *outFile << BottomRightCorner << "'));\n";

   }

   // Return true if everything went well.
   return true;
}

void CTablePrinter::PrintFieldsAndCommands(std::vector<std::string> MyFields, std::vector<std::string> MyShortFields)
{
   int iPrevLen = 0;
   int iCurrLen = 0;
   int iMaxLenField = 10;

   for (size_t i = 0; i < MyFields.size(); i++)
   {
      iCurrLen = MyFields.at(i).length();

      if (iCurrLen > iMaxLenField)
      {
         iMaxLenField = iCurrLen;
      }

      iPrevLen = iCurrLen;
   }

   iPrevLen = 0;
   iCurrLen = 0;
   int iMaxLenCommand = 5;

   for (size_t i = 0; i < MyShortFields.size(); i++)
   {
      iCurrLen = MyShortFields.at(i).length();

      if (iCurrLen > iMaxLenCommand)
      {
         iMaxLenCommand = iCurrLen;
      }

      iPrevLen = iCurrLen;
   }

   bool bBold = true;

   *outFile << "const chalk = require('chalk');\n";

   *outFile << "console.log(chalk.gray.bold('   " << TopLeftCorner; // ╔
   for (j = 0; j < iMaxLenField + 2; j++)
   {
      *outFile << HorizontalBar_Thick; // ═
   }
   *outFile << HorizontalBar_ConnectorDown;
   for (j = 0; j < iMaxLenCommand + 2; j++)
   {
      *outFile << HorizontalBar_Thick; // ═
   }
   *outFile << TopRightCorner << "'));\n"; // ╗

   int iFieldSetter;
   int iCommandSetter;

   for (size_t i = 0; i < MyFields.size(); i++)
   {
      if (i == 0)
      {
         if (iMaxLenField - 10 == 0)
         {
            iFieldSetter = 1;
         }
         else
         {
            iFieldSetter = iMaxLenField - 10 + 1;
         }

         if (iMaxLenCommand - 5 == 0)
         {
            iCommandSetter = 1;
         }
         else
         {
            iCommandSetter = iMaxLenCommand - 5 + 1;
         }

         std::string sBlankSpace1(iFieldSetter, ' ');
         std::string sBlankSpace2(iCommandSetter, ' ');

         *outFile << "process.stdout.write(chalk.gray.bold('   " << VerticalBar_Thick << "'));\n";
         *outFile << "process.stdout.write(chalk.cyan.bold(' Categories" << sBlankSpace1 << "'));\n";
         *outFile << "process.stdout.write(chalk.gray.bold('" << VerticalBar_Thin << "'));\n";

         *outFile << "process.stdout.write(chalk.cyan.bold(' Codes" << sBlankSpace2 << "'));\n";
         *outFile << "process.stdout.write(chalk.gray.bold('" << VerticalBar_Thick << "'));\n";
         *outFile << "console.log("");\n";

         *outFile << "console.log(chalk.gray.bold('   " << VerticalBar_ConnectorRight;
         for (j = 0; j < iMaxLenField + 2; j++)
         {
            *outFile << HorizontalBar_Thin; // ═
         }
         *outFile << Intersection;
         for (j = 0; j < iMaxLenCommand + 2; j++)
         {
            *outFile << HorizontalBar_Thin; // ═
         }
         *outFile << VerticalBar_ConnectorLeft << "'));\n";

      }

      iFieldSetter = iMaxLenField - MyFields.at(i).length() + 1;
      iCommandSetter = iMaxLenCommand - MyShortFields.at(i).length() + 1;

      std::string sBlankSpace1(iFieldSetter, ' ');
      std::string sBlankSpace2(iCommandSetter, ' ');

      *outFile << "process.stdout.write(chalk.gray.bold('   " << VerticalBar_Thick << "'));\n";

      if (bBold)
      {
         *outFile << "process.stdout.write(chalk.green.bold(' " << MyFields.at(i) << sBlankSpace1 << "'));\n";
      }
      else
      {
         *outFile << "process.stdout.write(chalk.green(' " << MyFields.at(i) << sBlankSpace1 << "'));\n";
      }

      *outFile << "process.stdout.write(chalk.gray.bold('" << VerticalBar_Thin << "'));\n";

      if (bBold)
      {
         *outFile << "process.stdout.write(chalk.green.bold(' " << MyShortFields.at(i) << sBlankSpace2 << "'));\n";
         bBold = false;
      }
      else
      {
         *outFile << "process.stdout.write(chalk.green(' " << MyShortFields.at(i) << sBlankSpace2 << "'));\n";
         bBold = true;
      }

      *outFile << "process.stdout.write(chalk.gray.bold('" << VerticalBar_Thick << "'));\n";

      if (i != MyFields.size() - 1)
      {
         *outFile << "console.log("");\n";
         *outFile << "console.log(chalk.gray.bold('   " << VerticalBar_ConnectorRight;
         for (j = 0; j < iMaxLenField + 2; j++)
         {
            *outFile << HorizontalBar_Thin; // ═
         }
         *outFile << Intersection;
         for (j = 0; j < iMaxLenCommand + 2; j++)
         {
            *outFile << HorizontalBar_Thin; // ═
         }
         *outFile << VerticalBar_ConnectorLeft << "'));\n";
      }
   }

   *outFile << "console.log("");\n";
   *outFile << "console.log(chalk.gray.bold('   " << BottomLeftCorner;
   for (j = 0; j < iMaxLenField + 2; j++)
   {
      *outFile << HorizontalBar_Thick; // ═
   }
   *outFile << HorizontalBar_ConnectorUp;
   for (j = 0; j < iMaxLenCommand + 2; j++)
   {
      *outFile << HorizontalBar_Thick; // ═
   }
   *outFile << BottomRightCorner << "'));\n";

   (*outFile).close();
   std::string strNodeCommand = "node " + strPrintOutPath;
   system(strNodeCommand.c_str());

   std::cout << '\n';

}

void CTablePrinter::PrintDates()
{

   bool bBold = true;

   *outFile << "const chalk = require('chalk');\n";

   *outFile << "console.log(chalk.gray.bold('   " << TopLeftCorner;
   for (j = 0; j < 9; j++)
   {
      *outFile << HorizontalBar_Thick; // ═
   }
   *outFile << TopRightCorner << "'));\n";

   for (size_t i = 0; i < MyValues.size() - 1; i += 2)
   {
      if (i == 0)
      {
         *outFile << "process.stdout.write(chalk.gray.bold('   " << VerticalBar_Thick << "'));\n";
         *outFile << "process.stdout.write(chalk.cyan.bold('  Dates '));\n";
         *outFile << "process.stdout.write(chalk.gray.bold(' " << VerticalBar_Thick << "'));\n";

         *outFile << "console.log("");\n";
         *outFile << "console.log(chalk.gray.bold('   " << VerticalBar_ConnectorRight;
         for (j = 0; j < 9; j++)
         {
            *outFile << HorizontalBar_Thin; // ═
         }
         *outFile << VerticalBar_ConnectorLeft << "'));\n";

      }

      if (std::stoi(MyValues.at(i)) < 10)
      {
         if (bBold)
         {
            *outFile << "process.stdout.write(chalk.gray.bold('   " << VerticalBar_Thick << "'));\n";
            *outFile << "process.stdout.write(chalk.green.bold(' 0" << MyValues.at(i) << '/' << MyValues.at(i + 1) << "'));\n";
            *outFile << "process.stdout.write(chalk.gray.bold(' " << VerticalBar_Thick << "'));\n";
         }
         else
         {
            *outFile << "process.stdout.write(chalk.gray.bold('   " << VerticalBar_Thick << "'));\n";
            *outFile << "process.stdout.write(chalk.green(' 0" << MyValues.at(i) << '/' << MyValues.at(i + 1) << "'));\n";
            *outFile << "process.stdout.write(chalk.gray.bold(' " << VerticalBar_Thick << "'));\n";
         }
      }
      else
      {
         if (bBold)
         {
            *outFile << "process.stdout.write(chalk.gray.bold('   " << VerticalBar_Thick << "'));\n";
            *outFile << "process.stdout.write(chalk.green.bold(' " << MyValues.at(i) << '/' << MyValues.at(i + 1) << "'));\n";
            *outFile << "process.stdout.write(chalk.gray.bold(' " << VerticalBar_Thick << "'));\n";
         }
         else
         {
            *outFile << "process.stdout.write(chalk.gray.bold('   " << VerticalBar_Thick << "'));\n";
            *outFile << "process.stdout.write(chalk.green(' " << MyValues.at(i) << '/' << MyValues.at(i + 1) << "'));\n";
            *outFile << "process.stdout.write(chalk.gray.bold(' " << VerticalBar_Thick << "'));\n";
         }
      }

      if (i != MyValues.size() - 2)
      {
         *outFile << "console.log("");\n";
         *outFile << "console.log(chalk.gray.bold('   " << VerticalBar_ConnectorRight;
         for (j = 0; j < 9; j++)
         {
            *outFile << HorizontalBar_Thin; // ═
         }
         *outFile << VerticalBar_ConnectorLeft << "'));\n";
      }

      if (bBold)
      {
         bBold = false;
      }
      else
      {
         bBold = true;
      }

   }

   *outFile << "console.log("");\n";
   *outFile << "console.log(chalk.gray.bold('   " << BottomLeftCorner;
   for (j = 0; j < 9; j++)
   {
      *outFile << HorizontalBar_Thick; // ═
   }
   *outFile << BottomRightCorner << "'));\n";

   (*outFile).close();
   std::string strNodeCommand = "node " + strPrintOutPath;
   system(strNodeCommand.c_str());

   std::cout << '\n';
}

void CTablePrinter::MadeBy()
{
   *outFile << "const chalk = require('chalk');\n";

   if ((*outFile).is_open())
   {
      *outFile << "console.log(chalk.yellow.bold('   " << Cube << "'));\n";

      *outFile << "process.stdout.write(chalk.blue.bold('   " << Cube << "'));\n";

      *outFile << "console.log(chalk.white('   Written with pride by Diaggio Enrico Mangianetti Bellafonte.'));\n";

      *outFile << "process.stdout.write(chalk.red.bold('   " << Cube << "'));\n";

      *outFile << "console.log("");\n";
   }

   std::cout << '\n';

   (*outFile).close();
   std::string strNodeCommand = "node " + strPrintOutPath;
   system(strNodeCommand.c_str());

   std::cout << '\n';
}


================================================
FILE: code/main.cpp
================================================
#include "CmdLineParser.h"
#include "TablePrinter.h"
#include "sqlite3.h"
#include <sstream>
#include <fstream>
#include <iomanip>

#ifndef _WIN32
#include <unistd.h>
#include <sys/types.h>
#include <pwd.h>
#include <stdlib.h>
#endif

void EnterDate(std::string sDate);
void EnterDataField(std::string sCmd, double dInputValue, std::string sDate);
static int callback(void *NotUsed, int argc, char * argv[], char **azColName);

void CreateNewDatabase(CParser CommandLineParser);
void AddFieldToDatabase(CParser CommandLineParser);
void PrintFields(CParser CommandLineParser);
bool PrintDates();
bool PrintSpecificTable(std::ofstream &outFile, CParser CommandLineParser);

void DisplayExpenses(std::ofstream &outFile, int iInputDay, int iInputMonth, int iInputYear);

void UpdateExistingRow(CParser CommandLineParser, std::vector<std::string> vecLongFields, std::vector<std::string> vecShortFields, int iInputDay, int iInputMonth, int iInputYear);
void CreateNewRow(CParser CommandLineParser, std::vector<std::string> vecLongFields, std::vector<std::string> vecShortFields);

bool EnterExpenses(std::ofstream &outFile, CParser CommandLineParser);
void ResetDatabase();

bool NewConditionsOk(CParser oMyParser);
bool AddConditionsOk(CParser oMyParser);
bool PrintFieldsConditionsOk(CParser oMyParser);
bool PrintDatesConditionsOk(CParser oMyParser);
bool PrintSpecificConditionsOk(CParser oMyParser);
bool ByConditionsOk(CParser oMyParser);
bool ResetConditionsOk(CParser oMyParser);
bool HelpConditionsOk(CParser oMyParser);
void PrintHelp();
bool VersionConditionsOk(CParser oMyParser);

sqlite3 *Database;
char *zErrMsg = 0;
int  iStatus;
char *SQL_Command;
const char* data = "Callback function called";

CTablePrinter *FinanceTable;
std::string strHomeDirectoryPath = "";

std::string strPrintOutPath = "pfox_console_printout.js";
std::string strDatabasePath = "pfox_expenses.db";
std::string strTableCategoriesPath = "pfox_categories.txt";

const std::string sVersion = "1.1.0";

int main(int argc, char * argv[])
{

#ifndef _WIN32
   const char *homedir;

   if ((homedir = getenv("HOME")) == NULL) {
     homedir = getpwuid(getuid())->pw_dir;
   }

   strHomeDirectoryPath = std::string(homedir) + "/";
   strPrintOutPath =  strHomeDirectoryPath + ".pfox_console_printout.js";
   strDatabasePath = strHomeDirectoryPath + ".pfox_expenses.db";
   strTableCategoriesPath = strHomeDirectoryPath + ".pfox_categories.txt";
#endif

   std::ofstream outFile(strPrintOutPath);

   FinanceTable = new CTablePrinter(outFile, strPrintOutPath);

   // Parse the commands entered by the user
   CParser oMyParser(argc, argv, strHomeDirectoryPath, strTableCategoriesPath);

   // Check if the user entered any instructions
   if (!oMyParser.CheckInstructions())
   {
      return 1;
   }

   if (oMyParser.bNew) // ----------------------------------------------------------------------------------------------------------------------------
   {
      if (!NewConditionsOk(oMyParser))
      {
         return 1;
      }
      else
      {
         CreateNewDatabase(oMyParser);
         return 0;
      }
   }
   else if (oMyParser.bAdd) // -----------------------------------------------------------------------------------------------------------------------
   {
      if (!AddConditionsOk(oMyParser))
      {
         return 1;
      }
      else
      {
         AddFieldToDatabase(oMyParser);
         return 0;
      }
   }
   else if (oMyParser.bPrintFields)   // -------------------------------------------------------------------------------------------------------------
   {
      if (!PrintFieldsConditionsOk(oMyParser))
      {
         return 1;
      }
      else
      {
         PrintFields(oMyParser);
         return 0;
      }
   }
   else if (oMyParser.bPrintDates)    // -------------------------------------------------------------------------------------------------------------
   {
      if (!PrintDatesConditionsOk(oMyParser))
      {
         return 1;
      }
      else if (!PrintDates())
      {
         return 1;
      }
      else
      {
         return 0;
      }
   }
   else if (oMyParser.bPrintSpecific) // -------------------------------------------------------------------------------------------------------------
   {
      if (!PrintSpecificConditionsOk(oMyParser))
      {
         return 1;
      }
      else if (!PrintSpecificTable(outFile, oMyParser))
      {
         return 1;
      }
      else
      {
         return 0;
      }
   }
   else if (oMyParser.bMadeBy) // --------------------------------------------------------------------------------------------------------------------
   {
      if (!ByConditionsOk(oMyParser))
      {
         return 1;
      }
      else
      {
         FinanceTable->MadeBy();
         return 0;
      }
   }
   else if (oMyParser.bReset) // ---------------------------------------------------------------------------------------------------------------------
   {
      if(!ResetConditionsOk(oMyParser))
      {
         return 1;
      }
      else
      {
         ResetDatabase();
         return 0;
      }
   }
   else if (oMyParser.bLog) // -----------------------------------------------------------------------------------------------------------------------
   {
      if (!EnterExpenses(outFile, oMyParser))
      {
         return 1;
      }
      return 0;
   }
   else if (oMyParser.bHelp) // ----------------------------------------------------------------------------------------------------------------------
   {
      if (!HelpConditionsOk(oMyParser))
      {
         return 1;
      }
      else
      {
         PrintHelp();
         return 0;
      }
   }
   else if (oMyParser.bVersion) // --------------------------------------------------------------------------------------------------------------------
   {
       if (!VersionConditionsOk(oMyParser))
       {
           return 1;
       }
       else
       {
           std::cout << '\n';
           std::cout << "   You are using version " << sVersion << " of Poor Fox.\n";
           std::cout << '\n';
           return 0;
       }
   }
}

static int callback(void *NotUsed, int argc, char **argv, char **azColName)
{
   FinanceTable->iNumOfRows++;

   for (int i = 0; i < argc; i++) {
      FinanceTable->MyTitles.push_back(azColName[i]);
      FinanceTable->MyValues.push_back(argv[i]);
   }

   return 0;
}

void EnterDate(std::string sDate)
{
   int iSlashIndices[2];
   int iSlashCtr = 0;

   iSlashIndices[0] = sDate.find("/");
   iSlashIndices[1] = sDate.find("/", iSlashIndices[0] + 1);

   int iDay = std::stoi(sDate.substr(0, 2));
   int iMonth = std::stoi(sDate.substr(iSlashIndices[0] + 1, 2));
   int iYear = std::stoi(sDate.substr(iSlashIndices[1] + 1, 4));

   std::stringstream oss;
   oss << "INSERT INTO Expenses (" << "Day, Month, Year" << ") VALUES (" << iDay << "," << iMonth << "," << iYear << "); ";

   iStatus = sqlite3_exec(Database, oss.str().c_str(), callback, 0, &zErrMsg);
}

void EnterDataField(std::string sCmd, double dInputValue, std::string sDate)
{
   int iSlashIndices[2];
   int iSlashCtr = 0;

   iSlashIndices[0] = sDate.find("/");
   iSlashIndices[1] = sDate.find("/", iSlashIndices[0] + 1);

   int iDay = std::stoi(sDate.substr(0, 2));
   int iMonth = std::stoi(sDate.substr(iSlashIndices[0] + 1, 2));
   int iYear = std::stoi(sDate.substr(iSlashIndices[1] + 1, 4));

   std::stringstream ssInputVal;
   ssInputVal << std::setprecision(12) << dInputValue; // Billion dollar precision

   std::stringstream ss;
   ss << "UPDATE Expenses SET " << sCmd << "=" << ssInputVal.str() << " WHERE Day=" << iDay << " AND Month=" << iMonth << " AND Year=" << iYear;

   iStatus = sqlite3_exec(Database, ss.str().c_str(), callback, 0, &zErrMsg);
}

void CreateNewDatabase(CParser CommandLineParser)
{
   std::vector<std::string> MyFields;

   // Begin by writing the data fields entered by the user to a text file, so that they are remembered
   CommandLineParser.WriteFieldsToFile();

   //Create a database that contains the data fields entered by the user and open it
   iStatus = sqlite3_open(strDatabasePath.c_str(), &Database);

   // Compose the SQL command that is used to create the table
   MyFields = CommandLineParser.ReadFieldsFromFile();

   // Define the number of fields
   FinanceTable->iNumOfFields = MyFields.size() + 3;

   std::stringstream ss;
   ss << "CREATE TABLE Expenses (";
   ss << "Day INTEGER,";
   ss << " Month INTEGER,";
   ss << " Year INTEGER, ";
   for (size_t i = 0; i < MyFields.size() - 1; i++)
   {
      ss << MyFields.at(i) << " REAL, ";
   }
   ss << MyFields.at(MyFields.size() - 1) << " REAL);";

   // Create the table
   iStatus = sqlite3_exec(Database, ss.str().c_str(), callback, 0, &zErrMsg);

   // Let the user know everything went well
   std::vector<std::string> MyShortFields = CommandLineParser.GetShortDataFields();

   std::cout << '\n';
   std::cout << "   Database created successfully! \n \n";
   std::cout << "   The categories currently included in the database and their corresponding codes are: \n \n";

   FinanceTable->PrintFieldsAndCommands(MyFields, MyShortFields);
}

void AddFieldToDatabase(CParser CommandLineParser)
{
   std::vector<std::string> MyFields;

   // Begin by writing the new fields entered by the user to a text file, so that they are remembered
   CommandLineParser.WriteFieldsToFile();

   // Open the existing database
   iStatus = sqlite3_open(strDatabasePath.c_str(), &Database);

   // Add the new fields to the database
   MyFields = CommandLineParser.GetNewFields();

   std::stringstream ss;
   ss << "ALTER TABLE Expenses ADD COLUMN ";
   for (size_t i = 0; i < MyFields.size(); i++)
   {
      ss.str(std::string());
      ss << "ALTER TABLE Expenses ADD COLUMN " << MyFields.at(i) << " REAL";
      iStatus = sqlite3_exec(Database, ss.str().c_str(), callback, 0, &zErrMsg);
   }

   // We need to set all entries to zero before returning
   for (size_t i = 0; i < MyFields.size(); i++)
   {
      ss.str(std::string());
      ss << "Update Expenses SET " << MyFields.at(i) << " = 0";
      iStatus = sqlite3_exec(Database, ss.str().c_str(), callback, 0, &zErrMsg);
   }

   // Let the user know everything went well
   MyFields = CommandLineParser.ReadFieldsFromFile();
   std::vector<std::string> MyShortFields = CommandLineParser.GetShortDataFields();

   std::cout << '\n';
   std::cout << "   New category added successfully! \n \n";
   std::cout << "   The categories currently included in the database and their corresponding codes are: \n \n";

   FinanceTable->PrintFieldsAndCommands(MyFields, MyShortFields);
}

void PrintFields(CParser CommandLineParser)
{
   std::vector<std::string> MyFields;

   // Read the fields that have been entered by the user so far
   MyFields = CommandLineParser.ReadFieldsFromFile();
   std::vector<std::string> MyShortFields = CommandLineParser.GetShortDataFields();

   std::cout << '\n';
   std::cout << "   The categories currently included in the database and their corresponding codes are: \n \n";

   FinanceTable->PrintFieldsAndCommands(MyFields, MyShortFields);
}

bool PrintDates()
{
   // Open the existing database
   iStatus = sqlite3_open(strDatabasePath.c_str(), &Database);

   std::stringstream ss;
   ss << "SELECT DISTINCT Month, Year FROM EXPENSES ORDER BY Year ASC, Month ASC";
   iStatus = sqlite3_exec(Database, ss.str().c_str(), callback, 0, &zErrMsg);

   if (FinanceTable->MyValues.size() == 0)
   {
      std::cout << '\n';
      std::cout << "   You have not logged any expenses. You must log expenses using the 'log' command at least once before using the 'dat' command. \n";
      std::cout << '\n';
      return false;
   }

   std::cout << '\n';
   std::cout << "   Expenses have been logged in the following months: \n \n";

   FinanceTable->PrintDates();

   return true;

}

bool PrintSpecificTable(std::ofstream &outFile, CParser CommandLineParser)
{
   std::vector<std::string> MyFields;

   // Open the existing database
   iStatus = sqlite3_open(strDatabasePath.c_str(), &Database);

   // Read the fields so that they can be compared with the ones entered by the user
   MyFields = CommandLineParser.ReadFieldsFromFile();

   // Define the number of fields
   FinanceTable->iNumOfFields = MyFields.size() + 3;

   // Get the month/year pair that the user wants to print
   std::string sDate = CommandLineParser.GetDate();

   // Separate the date
   int iSlashIndex;
   iSlashIndex = sDate.find("/");
   int iInputMonth = std::stoi(sDate.substr(0, 2));
   int iInputYear = std::stoi(sDate.substr(iSlashIndex + 1, 4));

   // Get the database values that correspond to the month and year entered by the user and close the database
   std::stringstream ss;
   ss << "SELECT * from Expenses" << " WHERE Month=" << iInputMonth << " AND Year=" << iInputYear << " ORDER BY Day ASC";

   iStatus = sqlite3_exec(Database, ss.str().c_str(), callback, (void*)data, &zErrMsg);

   sqlite3_close(Database);

   if (FinanceTable->MyValues.size() == 0)
   {
      std::cout << '\n';
      std::cout << "   You did not log any expenses in that month.\n\n";
      std::cout << "   Use the 'dat' command to see the dates that are valid. \n";
      std::cout << '\n';
      return false;
   }

   DisplayExpenses(outFile, 0, iInputMonth, iInputYear);

   return true;
}

void DisplayExpenses(std::ofstream &outFile, int iInputDay, int iInputMonth, int iInputYear)
{
   // Get the database values that correspond to the month and year entered by the user and close the database
   std::stringstream ss;
   ss << "SELECT * from Expenses" << " WHERE Month=" << iInputMonth << " AND Year=" << iInputYear << " ORDER BY Day ASC";

   iStatus = sqlite3_exec(Database, ss.str().c_str(), callback, (void*)data, &zErrMsg);

   sqlite3_close(Database);

   outFile << "const chalk = require('chalk');\n";

   // Print the main table
   // This table contains the expenses that have been recorded in the month/year entered by the user
   FinanceTable->CalculateSpaceOccupiedByEachField();
   if (outFile.is_open()) {
      FinanceTable->PrintTopBar();
      FinanceTable->PrintFields();
      FinanceTable->PrintMiddleBar();

      for (int i = 0; i < FinanceTable->iNumOfRows; i++)
      {
         FinanceTable->PrintValues(i);
         if (i != FinanceTable->iNumOfRows - 1)
         {
            FinanceTable->PrintMiddleBar();
         }
      }

      FinanceTable->PrintBottomBar();
   }

   // Print the table of totals and the expense graph
   FinanceTable->CalculateTotals(iInputDay, iInputMonth, iInputYear);

   FinanceTable->CalculateSpaceOccupiedByEachField();
   if (outFile.is_open()) {
      FinanceTable->PrintTopBar();
      FinanceTable->PrintFields();
      FinanceTable->PrintMiddleBar();

      for (int i = 0; i < FinanceTable->iNumOfRows; i++)
      {
         FinanceTable->PrintValues(i);
         if (i != FinanceTable->iNumOfRows - 1)
         {
            FinanceTable->PrintMiddleBar();
         }
      }

      FinanceTable->PrintBottomBar();
   }

   std::cout << '\n';

   outFile.close();
   std::string strNodeCommand = "node " + strPrintOutPath;
   system(strNodeCommand.c_str());

   std::cout << '\n';
}

void UpdateExistingRow(CParser CommandLineParser, std::vector<std::string> vecLongFields, std::vector<std::string> vecShortFields, int iInputDay, int iInputMonth, int iInputYear)
{
   std::stringstream ss;
   ss << "SELECT ";
   for (size_t i = 0; i < vecLongFields.size() - 1; i++)
   {
      ss << vecLongFields.at(i) << ", ";
   }

   ss << vecLongFields.at(vecLongFields.size() - 1);
   ss << " from Expenses" << " WHERE Day=" << iInputDay << " AND Month=" << iInputMonth << " AND Year=" << iInputYear;

   iStatus = sqlite3_exec(Database, ss.str().c_str(), callback, (void*)data, &zErrMsg);

   for (size_t j = 0; j < FinanceTable->MyTitles.size(); j++)
   {
      std::stringstream ss;
      double dNewVal = CommandLineParser.GetDataFieldValue(vecShortFields.at(j)) + std::stod(FinanceTable->MyValues.at(j));

      std::stringstream ssInputVal;
      ssInputVal << std::setprecision(12) << dNewVal; // Billion dollar precision

      ss << "UPDATE Expenses SET " << FinanceTable->MyTitles.at(j) << "=" << ssInputVal.str() << " WHERE Day=" << iInputDay << " AND Month=" << iInputMonth << " AND Year=" << iInputYear;

      iStatus = sqlite3_exec(Database, ss.str().c_str(), callback, 0, &zErrMsg);
   }
}

void CreateNewRow(CParser CommandLineParser, std::vector<std::string> vecLongFields, std::vector<std::string> vecShortFields)
{
   EnterDate(FinanceTable->sDate);

   double dInputValue;
   std::wcout.precision(12);

   for (size_t i = 0; i < vecLongFields.size(); i++)
   {
      if (CommandLineParser.DataFieldExists(vecShortFields.at(i)))
      {
         dInputValue = CommandLineParser.GetDataFieldValue(vecShortFields.at(i));
         EnterDataField(vecLongFields.at(i), dInputValue, FinanceTable->sDate);
      }
      else
      {
         EnterDataField(vecLongFields.at(i), 0, FinanceTable->sDate);
      }
   }
}

bool EnterExpenses(std::ofstream &outFile, CParser CommandLineParser)
{
   if (CommandLineParser.CheckIfFileExists(strDatabasePath))
   {
      std::cout << '\n';
      std::cout << "   A database does not exist. Before using the 'log' command you must create a database using the 'new' command. \n";
      std::cout << '\n';
      return false;
   }

   if (!CommandLineParser.CheckIfUserEnteredValidFields())
   {
      return false;
   }

   if (!CommandLineParser.CheckEachFieldHasEqualSign())
   {
      std::cout << '\n';
      std::cout << "   You entered a category that is not followed by '='. Please ensure all the categories you enter are in the format '-code=quantity'. \n";
      std::cout << '\n';

      return false;
   }

   if (!CommandLineParser.CheckEachFieldHasQuantity())
   {
      std::cout << '\n';
      std::cout << "   You entered a category without a quantity to log. Please ensure all the categories you enter are in the format '-code=quantity'. \n";
      std::cout << '\n';

      return false;
   }

   if (!CommandLineParser.CheckQuantitiesAreNumbers())
   {
      std::cout << '\n';
      std::cout << "   You entered a category followed by a quantity that is not a number. Please ensure that what follows each equal sign is a real number. \n";
      std::cout << '\n';

      return false;
   }

   if (!CommandLineParser.CheckFieldsAreUnique())
   {
      std::cout << '\n';
      std::cout << "   You entered categories that are repeated. Please ensure that the categories you enter are unique. \n";
      std::cout << '\n';

      return false;
   }

   if (!CommandLineParser.CheckUserEnteredProperDate(false))
   {
      std::cout << '\n';
      std::cout << "   You did not enter a valid date. Please ensure that the date is in the format '-d=day/month/year'. \n";
      std::cout << '\n';

      return false;
   }

   std::vector<std::string> MyLongFields;
   std::vector<std::string> MyShortFields;

   // Open the existing database
   iStatus = sqlite3_open(strDatabasePath.c_str(), &Database);

   // Read the long fields in order to retrieve values from the database
   MyLongFields = CommandLineParser.ReadFieldsFromFile();

   // Define the number of fields
   FinanceTable->iNumOfFields = MyLongFields.size() + 3;

   // Generate the short fields so that they can be compared with the ones entered by the user
   MyShortFields = CommandLineParser.GetShortDataFields();

   // Verify the date entered by the user
   FinanceTable->sDate = CommandLineParser.GetDate();

   int iSlashIndices[2];
   int iSlashCtr = 0;

   iSlashIndices[0] = FinanceTable->sDate.find("/");
   iSlashIndices[1] = FinanceTable->sDate.find("/", iSlashIndices[0] + 1);

   int iInputDay = std::stoi(FinanceTable->sDate.substr(0, 2));
   int iInputMonth = std::stoi(FinanceTable->sDate.substr(iSlashIndices[0] + 1, 2));
   int iInputYear = std::stoi(FinanceTable->sDate.substr(iSlashIndices[1] + 1, 4));

   // Enter new values into the database
   SQL_Command = "SELECT Day,Month,Year from Expenses";

   iStatus = sqlite3_exec(Database, SQL_Command, callback, (void*)data, &zErrMsg);

   int iTableDay, iTableMonth, iTableYear;
   bool bRepeated = false;

   for (size_t i = 0; i < FinanceTable->MyValues.size(); i += 3)
   {
      iTableDay = std::stoi(FinanceTable->MyValues.at(i));
      iTableMonth = std::stoi(FinanceTable->MyValues.at(i + 1));
      iTableYear = std::stoi(FinanceTable->MyValues.at(i + 2));

      // If the date entered by the user is already inside of the database, do not create a new row and simply add the new values to the old ones
      if (iInputDay == iTableDay && iInputMonth == iTableMonth && iInputYear == iTableYear)
      {
         bRepeated = true;

         FinanceTable->MyTitles.clear();
         FinanceTable->MyValues.clear();
         FinanceTable->iNumOfRows = 0;

         UpdateExistingRow(CommandLineParser, MyLongFields, MyShortFields, iInputDay, iInputMonth, iInputYear);

         break;
      }
   }

   FinanceTable->MyTitles.clear();
   FinanceTable->MyValues.clear();
   FinanceTable->iNumOfRows = 0;

   // If the date entered by the user is new, create a new row and enter the new values into the database
   if (!bRepeated)
   {
      CreateNewRow(CommandLineParser, MyLongFields, MyShortFields);
   }

   DisplayExpenses(outFile, iInputDay, iInputMonth, iInputYear);

   return true;
}

void ResetDatabase()
{

#ifdef _WIN32
   std::string strRemoveDatabaseCommandWindows = "DEL " + strDatabasePath;
   std::string strRemoveCategoriesCommandWindows = "DEL " + strTableCategoriesPath;
   system(strRemoveDatabaseCommandWindows.c_str());
   system(strRemoveCategoriesCommandWindows.c_str());
#else
   std::string strRemoveDatabaseCommandUnix = "rm " + strDatabasePath;
   std::string strRemoveCategoriesCommandUnix = "rm " + strTableCategoriesPath;
   system(strRemoveCategoriesCommandUnix.c_str());
   system(strRemoveDatabaseCommandUnix.c_str());
#endif

   std::cout << '\n';
   std::cout << "   Database deleted successfully!\n\n";
   std::cout << "   Use the 'new' command to create a new one.\n";
   std::cout << '\n';
}

bool NewConditionsOk(CParser oMyParser)
{
   if (!oMyParser.CheckIfFileExists(strDatabasePath))
   {
      std::cout << '\n';
      std::cout << "   A database already exists. Use the 'reset' command before trying to create a new one.\n\n";
      std::cout << "   If you would like to add categories to an existing database, use the 'add' command.\n";
      std::cout << '\n';
      return false;
   }
   if (!oMyParser.CheckCreationFieldsAreValid())
   {
      return false;
   }
   if (!oMyParser.CheckCreationFieldsAreUnique())
   {
      return false;
   }
   return true;
}

bool AddConditionsOk(CParser oMyParser)
{
   if (oMyParser.CheckIfFileExists(strDatabasePath))
   {
      std::cout << '\n';
      std::cout << "   A database does not exist. Before using the 'add' command you must create a database using the 'new' command.\n";
      std::cout << '\n';
      return false;
   }
   if (!oMyParser.CheckCreationFieldsAreValid())
   {
      return false;
   }
   if (!oMyParser.CheckFieldsBeingAddedAreUnique())
   {
      return false;
   }
   return true;
}

bool PrintFieldsConditionsOk(CParser oMyParser)
{
   if (oMyParser.CheckIfFileExists(strDatabasePath))
   {
      std::cout << '\n';
      std::cout << "   A database does not exist. Before using the 'cat' command you must create a database using the 'new' command.\n";
      std::cout << '\n';
      return false;
   }
   if (!oMyParser.CheckUserOnlyEnteredXFields(0))
   {
      std::cout << '\n';
      std::cout << "   You entered unnecessary data.\n\n";
      std::cout << "   You do not need to enter categories or dates when using the 'cat' command.\n";
      std::cout << '\n';
      return false;
   }
   return true;
}

bool PrintDatesConditionsOk(CParser oMyParser)
{
   if (oMyParser.CheckIfFileExists(strDatabasePath))
   {
      std::cout << '\n';
      std::cout << "   A database does not exist. Before using the 'dat' command you must create a database using the 'new' command.\n";
      std::cout << '\n';
      return false;
   }
   if (!oMyParser.CheckUserOnlyEnteredXFields(0))
   {
      std::cout << '\n';
      std::cout << "   You entered unnecessary data.\n\n";
      std::cout << "   You do not need to enter categories or dates when using the 'dat' command.\n";
      std::cout << '\n';
      return false;
   }
   return true;
}

bool PrintSpecificConditionsOk(CParser oMyParser)
{
   if (oMyParser.CheckIfFileExists(strDatabasePath))
   {
      std::cout << '\n';
      std::cout << "   A database does not exist. Before using the 'tab' command you must create a database using the 'new' command.\n";
      std::cout << '\n';
      return false;
   }
   if (!oMyParser.CheckUserEnteredProperDate(true))
   {
      std::cout << '\n';
      std::cout << "   You did not enter a valid date. Please ensure that the date is in the format '-d=month/year'.\n\n";
      std::cout << "   Use the 'dat' command to see the dates that are valid.\n";
      std::cout << '\n';
      return false;
   }
   if (!oMyParser.CheckUserOnlyEnteredXFields(1))
   {
      std::cout << '\n';
      std::cout << "   You entered unnecessary data.\n\n";
      std::cout << "   You only need to specify the date in the format '-d=month/year' when using the 'tab' command.\n\n";
      std::cout << "   Use the 'dat' command to see the dates that are valid.\n";
      std::cout << '\n';
      return false;
   }
   return true;
}

bool ByConditionsOk(CParser oMyParser)
{
   if (!oMyParser.CheckUserOnlyEnteredXFields(0))
   {
      std::cout << '\n';
      std::cout << "   You entered unnecessary data.\n\n";
      std::cout << "   You do not need to enter categories or dates when using the 'by' command.\n";
      std::cout << '\n';
      return false;
   }
   return true;
}

bool ResetConditionsOk(CParser oMyParser)
{
   if (oMyParser.CheckIfFileExists(strDatabasePath))
   {
      std::cout << '\n';
      std::cout << "   A database does not exist. Before using the 'reset' command you must create a database using the 'new' command.\n";
      std::cout << '\n';
      return false;
   }
   if (!oMyParser.CheckUserOnlyEnteredXFields(0))
   {
      std::cout << '\n';
      std::cout << "   You entered unnecessary data.\n\n";
      std::cout << "   You do not need to enter categories or dates when using the 'reset' command.\n";
      std::cout << '\n';
      return false;
   }
   return true;
}

bool HelpConditionsOk(CParser oMyParser)
{
   if (!oMyParser.CheckUserOnlyEnteredXFields(0))
   {
      std::cout << '\n';
      std::cout << "   You entered unnecessary data.\n\n";
      std::cout << "   You do not need to enter categories or dates when using the 'help' command.\n";
      std::cout << '\n';
      return false;
   }
   return true;
}

void PrintHelp()
{
   std::cout << '\n';
   std::cout << "   Usage:\n\n";

   std::cout << "      pfox [options]\n\n";

   std::cout << "   Options:\n\n";

   std::cout << "      -------------------------------- *** To create a new database ***\n\n";
   std::cout << "      new -<category>                    + Categories cannot contain any numbers or symbols, match existing commands or be repeated.\n";
   std::cout << "                                         + The first letter of each category must be uppercase.\n\n\n";

   std::cout << "      -------------------------------- *** To log expenses ***\n\n";
   std::cout << "      log -d=<date> -<code>=<quantity>   + The date must be specified in the format 'day/month/year' (e.g. 19/7/2016).\n";
   std::cout << "                                         + The date must be valid (e.g. February 29 is only valid on leap years).\n";
   std::cout << "                                         + If no date is provided, today's date will be used.\n";
   std::cout << "                                         + Quantities must be real numbers.\n";
   std::cout << "                                         + Numbers that contain more than 12 digits are rounded.\n\n\n";

   std::cout << "      -------------------------------- *** To add a new category to an existing database ***\n\n";
   std::cout << "      add -<category>                    + Categories cannot contain any numbers or symbols, match existing commands or be repeated.\n";
   std::cout << "                                         + The first letter of each category must be uppercase.\n\n\n";

   std::cout << "      -------------------------------- *** To see the expense report of a particular month ***\n\n";
   std::cout << "      tab -d=<date>                      + The date must be specified in the format 'month/year' (e.g. 7/2016).\n";
   std::cout << "                                         + Expenses must have been logged at least once on the date specified.\n\n\n";

   std::cout << "      -------------------------------- *** To see the months in which expenses have been logged ***\n\n";
   std::cout << "      dat                                + Expenses must have been logged at least once.\n\n\n";

   std::cout << "      -------------------------------- *** To see the categories included in the database ***\n\n";
   std::cout << "      cat                                + A database must have been created.\n\n\n";

   std::cout << "      -------------------------------- *** To delete the database ***\n\n";
   std::cout << "      reset                              + A database must have been created.\n\n\n";

   std::cout << "      -------------------------------- *** To learn how to use the application ***\n\n";
   std::cout << "      help\n\n";

   std::cout << "   Examples:\n\n";

   std::cout << "      pfox new -Groceries -Restaurants -Books -Clothes -Climbing   // Create DB with 4 categories\n";
   std::cout << "      pfox log -d=1/12/2016 -res=16.25 -clo=24.36                  // Went to a restaurant and also bought a shirt\n";
   std::cout << "      pfox log -d=1/12/2016 -clo=-24.36 -cli=32.48                 // Returned the shirt and went climbing\n";
   std::cout << "      pfox log -d=23/12/2016 -boo=42.23                            // Bought a book\n";
   std::cout << "      pfox tab -d=12/2016                                          // Display the expenses of December\n";
   std::cout << "      pfox add -Skiing                                             // Picked up a new hobbie\n";
   std::cout << "      pfox log -d=28/12/2016 -ski=75                               // Went skiing\n";
   std::cout << "      pfox reset                                                   // Delete database\n\n";
}

bool VersionConditionsOk(CParser oMyParser)
{
    if (!oMyParser.CheckUserOnlyEnteredXFields(0))
    {
        std::cout << '\n';
        std::cout << "   You entered unnecessary data.\n\n";
        std::cout << "   You do not need to enter categories or dates when using the 'version' command.\n";
        std::cout << '\n';
        return false;
    }
    return true;
}


================================================
FILE: code/shell.c
================================================
/*
** 2001 September 15
**
** The author disclaims copyright to this source code.  In place of
** a legal notice, here is a blessing:
**
**    May you do good and not evil.
**    May you find forgiveness for yourself and forgive others.
**    May you share freely, never taking more than you give.
**
*************************************************************************
** This file contains code to implement the "sqlite" command line
** utility for accessing SQLite databases.
*/
#if (defined(_WIN32) || defined(WIN32)) && !defined(_CRT_SECURE_NO_WARNINGS)
/* This needs to come before any includes for MSVC compiler */
#define _CRT_SECURE_NO_WARNINGS
#endif

/*
** If requested, include the SQLite compiler options file for MSVC.
*/
#if defined(INCLUDE_MSVC_H)
#include "msvc.h"
#endif

/*
** No support for loadable extensions in VxWorks.
*/
#if (defined(__RTP__) || defined(_WRS_KERNEL)) && !SQLITE_OMIT_LOAD_EXTENSION
# define SQLITE_OMIT_LOAD_EXTENSION 1
#endif

/*
** Enable large-file support for fopen() and friends on unix.
*/
#ifndef SQLITE_DISABLE_LFS
# define _LARGE_FILE       1
# ifndef _FILE_OFFSET_BITS
#   define _FILE_OFFSET_BITS 64
# endif
# define _LARGEFILE_SOURCE 1
#endif

#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "sqlite3.h"
#if SQLITE_USER_AUTHENTICATION
# include "sqlite3userauth.h"
#endif
#include <ctype.h>
#include <stdarg.h>

#if !defined(_WIN32) && !defined(WIN32)
# include <signal.h>
# if !defined(__RTP__) && !defined(_WRS_KERNEL)
#  include <pwd.h>
# endif
# include <unistd.h>
# include <sys/types.h>
#endif

#if HAVE_READLINE
# include <readline/readline.h>
# include <readline/history.h>
#endif

#if HAVE_EDITLINE
# include <editline/readline.h>
#endif

#if HAVE_EDITLINE || HAVE_READLINE

# define shell_add_history(X) add_history(X)
# define shell_read_history(X) read_history(X)
# define shell_write_history(X) write_history(X)
# define shell_stifle_history(X) stifle_history(X)
# define shell_readline(X) readline(X)

#elif HAVE_LINENOISE

# include "linenoise.h"
# define shell_add_history(X) linenoiseHistoryAdd(X)
# define shell_read_history(X) linenoiseHistoryLoad(X)
# define shell_write_history(X) linenoiseHistorySave(X)
# define shell_stifle_history(X) linenoiseHistorySetMaxLen(X)
# define shell_readline(X) linenoise(X)

#else

# define shell_read_history(X)
# define shell_write_history(X)
# define shell_stifle_history(X)

# define SHELL_USE_LOCAL_GETLINE 1
#endif


#if defined(_WIN32) || defined(WIN32)
# include <io.h>
# include <fcntl.h>
# define isatty(h) _isatty(h)
# ifndef access
#  define access(f,m) _access((f),(m))
# endif
# undef popen
# define popen _popen
# undef pclose
# define pclose _pclose
#else
 /* Make sure isatty() has a prototype. */
 extern int isatty(int);

# if !defined(__RTP__) && !defined(_WRS_KERNEL)
  /* popen and pclose are not C89 functions and so are
  ** sometimes omitted from the <stdio.h> header */
   extern FILE *popen(const char*,const char*);
   extern int pclose(FILE*);
# else
#  define SQLITE_OMIT_POPEN 1
# endif
#endif

#if defined(_WIN32_WCE)
/* Windows CE (arm-wince-mingw32ce-gcc) does not provide isatty()
 * thus we always assume that we have a console. That can be
 * overridden with the -batch command line option.
 */
#define isatty(x) 1
#endif

/* ctype macros that work with signed characters */
#define IsSpace(X)  isspace((unsigned char)X)
#define IsDigit(X)  isdigit((unsigned char)X)
#define ToLower(X)  (char)tolower((unsigned char)X)

#if defined(_WIN32) || defined(WIN32)
#include <windows.h>

/* string conversion routines only needed on Win32 */
extern char *sqlite3_win32_unicode_to_utf8(LPCWSTR);
extern char *sqlite3_win32_mbcs_to_utf8_v2(const char *, int);
extern char *sqlite3_win32_utf8_to_mbcs_v2(const char *, int);
#endif

/* On Windows, we normally run with output mode of TEXT so that \n characters
** are automatically translated into \r\n.  However, this behavior needs
** to be disabled in some cases (ex: when generating CSV output and when
** rendering quoted strings that contain \n characters).  The following
** routines take care of that.
*/
#if defined(_WIN32) || defined(WIN32)
static void setBinaryMode(FILE *file, int isOutput){
  if( isOutput ) fflush(file);
  _setmode(_fileno(file), _O_BINARY);
}
static void setTextMode(FILE *file, int isOutput){
  if( isOutput ) fflush(file);
  _setmode(_fileno(file), _O_TEXT);
}
#else
# define setBinaryMode(X,Y)
# define setTextMode(X,Y)
#endif


/* True if the timer is enabled */
static int enableTimer = 0;

/* Return the current wall-clock time */
static sqlite3_int64 timeOfDay(void){
  static sqlite3_vfs *clockVfs = 0;
  sqlite3_int64 t;
  if( clockVfs==0 ) clockVfs = sqlite3_vfs_find(0);
  if( clockVfs->iVersion>=2 && clockVfs->xCurrentTimeInt64!=0 ){
    clockVfs->xCurrentTimeInt64(clockVfs, &t);
  }else{
    double r;
    clockVfs->xCurrentTime(clockVfs, &r);
    t = (sqlite3_int64)(r*86400000.0);
  }
  return t;
}

#if !defined(_WIN32) && !defined(WIN32) && !defined(__minux)
#include <sys/time.h>
#include <sys/resource.h>

/* VxWorks does not support getrusage() as far as we can determine */
#if defined(_WRS_KERNEL) || defined(__RTP__)
struct rusage {
  struct timeval ru_utime; /* user CPU time used */
  struct timeval ru_stime; /* system CPU time used */
};
#define getrusage(A,B) memset(B,0,sizeof(*B))
#endif

/* Saved resource information for the beginning of an operation */
static struct rusage sBegin;  /* CPU time at start */
static sqlite3_int64 iBegin;  /* Wall-clock time at start */

/*
** Begin timing an operation
*/
static void beginTimer(void){
  if( enableTimer ){
    getrusage(RUSAGE_SELF, &sBegin);
    iBegin = timeOfDay();
  }
}

/* Return the difference of two time_structs in seconds */
static double timeDiff(struct timeval *pStart, struct timeval *pEnd){
  return (pEnd->tv_usec - pStart->tv_usec)*0.000001 +
         (double)(pEnd->tv_sec - pStart->tv_sec);
}

/*
** Print the timing results.
*/
static void endTimer(void){
  if( enableTimer ){
    sqlite3_int64 iEnd = timeOfDay();
    struct rusage sEnd;
    getrusage(RUSAGE_SELF, &sEnd);
    printf("Run Time: real %.3f user %f sys %f\n",
       (iEnd - iBegin)*0.001,
       timeDiff(&sBegin.ru_utime, &sEnd.ru_utime),
       timeDiff(&sBegin.ru_stime, &sEnd.ru_stime));
  }
}

#define BEGIN_TIMER beginTimer()
#define END_TIMER endTimer()
#define HAS_TIMER 1

#elif (defined(_WIN32) || defined(WIN32))

/* Saved resource information for the beginning of an operation */
static HANDLE hProcess;
static FILETIME ftKernelBegin;
static FILETIME ftUserBegin;
static sqlite3_int64 ftWallBegin;
typedef BOOL (WINAPI *GETPROCTIMES)(HANDLE, LPFILETIME, LPFILETIME,
                                    LPFILETIME, LPFILETIME);
static GETPROCTIMES getProcessTimesAddr = NULL;

/*
** Check to see if we have timer support.  Return 1 if necessary
** support found (or found previously).
*/
static int hasTimer(void){
  if( getProcessTimesAddr ){
    return 1;
  } else {
    /* GetProcessTimes() isn't supported in WIN95 and some other Windows
    ** versions. See if the version we are running on has it, and if it
    ** does, save off a pointer to it and the current process handle.
    */
    hProcess = GetCurrentProcess();
    if( hProcess ){
      HINSTANCE hinstLib = LoadLibrary(TEXT("Kernel32.dll"));
      if( NULL != hinstLib ){
        getProcessTimesAddr =
            (GETPROCTIMES) GetProcAddress(hinstLib, "GetProcessTimes");
        if( NULL != getProcessTimesAddr ){
          return 1;
        }
        FreeLibrary(hinstLib);
      }
    }
  }
  return 0;
}

/*
** Begin timing an operation
*/
static void beginTimer(void){
  if( enableTimer && getProcessTimesAddr ){
    FILETIME ftCreation, ftExit;
    getProcessTimesAddr(hProcess,&ftCreation,&ftExit,
                        &ftKernelBegin,&ftUserBegin);
    ftWallBegin = timeOfDay();
  }
}

/* Return the difference of two FILETIME structs in seconds */
static double timeDiff(FILETIME *pStart, FILETIME *pEnd){
  sqlite_int64 i64Start = *((sqlite_int64 *) pStart);
  sqlite_int64 i64End = *((sqlite_int64 *) pEnd);
  return (double) ((i64End - i64Start) / 10000000.0);
}

/*
** Print the timing results.
*/
static void endTimer(void){
  if( enableTimer && getProcessTimesAddr){
    FILETIME ftCreation, ftExit, ftKernelEnd, ftUserEnd;
    sqlite3_int64 ftWallEnd = timeOfDay();
    getProcessTimesAddr(hProcess,&ftCreation,&ftExit,&ftKernelEnd,&ftUserEnd);
    printf("Run Time: real %.3f user %f sys %f\n",
       (ftWallEnd - ftWallBegin)*0.001,
       timeDiff(&ftUserBegin, &ftUserEnd),
       timeDiff(&ftKernelBegin, &ftKernelEnd));
  }
}

#define BEGIN_TIMER beginTimer()
#define END_TIMER endTimer()
#define HAS_TIMER hasTimer()

#else
#define BEGIN_TIMER
#define END_TIMER
#define HAS_TIMER 0
#endif

/*
** Used to prevent warnings about unused parameters
*/
#define UNUSED_PARAMETER(x) (void)(x)

/*
** If the following flag is set, then command execution stops
** at an error if we are not interactive.
*/
static int bail_on_error = 0;

/*
** Threat stdin as an interactive input if the following variable
** is true.  Otherwise, assume stdin is connected to a file or pipe.
*/
static int stdin_is_interactive = 1;

/*
** On Windows systems we have to know if standard output is a console
** in order to translate UTF-8 into MBCS.  The following variable is
** true if translation is required.
*/
static int stdout_is_console = 1;

/*
** The following is the open SQLite database.  We make a pointer
** to this database a static variable so that it can be accessed
** by the SIGINT handler to interrupt database processing.
*/
static sqlite3 *globalDb = 0;

/*
** True if an interrupt (Control-C) has been received.
*/
static volatile int seenInterrupt = 0;

/*
** This is the name of our program. It is set in main(), used
** in a number of other places, mostly for error messages.
*/
static char *Argv0;

/*
** Prompt strings. Initialized in main. Settable with
**   .prompt main continue
*/
static char mainPrompt[20];     /* First line prompt. default: "sqlite> "*/
static char continuePrompt[20]; /* Continuation prompt. default: "   ...> " */

/*
** Render output like fprintf().  Except, if the output is going to the
** console and if this is running on a Windows machine, translate the
** output from UTF-8 into MBCS.
*/
#if defined(_WIN32) || defined(WIN32)
void utf8_printf(FILE *out, const char *zFormat, ...){
  va_list ap;
  va_start(ap, zFormat);
  if( stdout_is_console && (out==stdout || out==stderr) ){
    char *z1 = sqlite3_vmprintf(zFormat, ap);
    char *z2 = sqlite3_win32_utf8_to_mbcs_v2(z1, 0);
    sqlite3_free(z1);
    fputs(z2, out);
    sqlite3_free(z2);
  }else{
    vfprintf(out, zFormat, ap);
  }
  va_end(ap);
}
#elif !defined(utf8_printf)
# define utf8_printf fprintf
#endif

/*
** Render output like fprintf().  This should not be used on anything that
** includes string formatting (e.g. "%s").
*/
#if !defined(raw_printf)
# define raw_printf fprintf
#endif

/*
** Write I/O traces to the following stream.
*/
#ifdef SQLITE_ENABLE_IOTRACE
static FILE *iotrace = 0;
#endif

/*
** This routine works like printf in that its first argument is a
** format string and subsequent arguments are values to be substituted
** in place of % fields.  The result of formatting this string
** is written to iotrace.
*/
#ifdef SQLITE_ENABLE_IOTRACE
static void SQLITE_CDECL iotracePrintf(const char *zFormat, ...){
  va_list ap;
  char *z;
  if( iotrace==0 ) return;
  va_start(ap, zFormat);
  z = sqlite3_vmprintf(zFormat, ap);
  va_end(ap);
  utf8_printf(iotrace, "%s", z);
  sqlite3_free(z);
}
#endif


/*
** Determines if a string is a number of not.
*/
static int isNumber(const char *z, int *realnum){
  if( *z=='-' || *z=='+' ) z++;
  if( !IsDigit(*z) ){
    return 0;
  }
  z++;
  if( realnum ) *realnum = 0;
  while( IsDigit(*z) ){ z++; }
  if( *z=='.' ){
    z++;
    if( !IsDigit(*z) ) return 0;
    while( IsDigit(*z) ){ z++; }
    if( realnum ) *realnum = 1;
  }
  if( *z=='e' || *z=='E' ){
    z++;
    if( *z=='+' || *z=='-' ) z++;
    if( !IsDigit(*z) ) return 0;
    while( IsDigit(*z) ){ z++; }
    if( realnum ) *realnum = 1;
  }
  return *z==0;
}

/*
** A global char* and an SQL function to access its current value
** from within an SQL statement. This program used to use the
** sqlite_exec_printf() API to substitue a string into an SQL statement.
** The correct way to do this with sqlite3 is to use the bind API, but
** since the shell is built around the callback paradigm it would be a lot
** of work. Instead just use this hack, which is quite harmless.
*/
static const char *zShellStatic = 0;
static void shellstaticFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  assert( 0==argc );
  assert( zShellStatic );
  UNUSED_PARAMETER(argc);
  UNUSED_PARAMETER(argv);
  sqlite3_result_text(context, zShellStatic, -1, SQLITE_STATIC);
}


/*
** Compute a string length that is limited to what can be stored in
** lower 30 bits of a 32-bit signed integer.
*/
static int strlen30(const char *z){
  const char *z2 = z;
  while( *z2 ){ z2++; }
  return 0x3fffffff & (int)(z2 - z);
}

/*
** This routine reads a line of text from FILE in, stores
** the text in memory obtained from malloc() and returns a pointer
** to the text.  NULL is returned at end of file, or if malloc()
** fails.
**
** If zLine is not NULL then it is a malloced buffer returned from
** a previous call to this routine that may be reused.
*/
static char *local_getline(char *zLine, FILE *in){
  int nLine = zLine==0 ? 0 : 100;
  int n = 0;

  while( 1 ){
    if( n+100>nLine ){
      nLine = nLine*2 + 100;
      zLine = realloc(zLine, nLine);
      if( zLine==0 ) return 0;
    }
    if( fgets(&zLine[n], nLine - n, in)==0 ){
      if( n==0 ){
        free(zLine);
        return 0;
      }
      zLine[n] = 0;
      break;
    }
    while( zLine[n] ) n++;
    if( n>0 && zLine[n-1]=='\n' ){
      n--;
      if( n>0 && zLine[n-1]=='\r' ) n--;
      zLine[n] = 0;
      break;
    }
  }
#if defined(_WIN32) || defined(WIN32)
  /* For interactive input on Windows systems, translate the
  ** multi-byte characterset characters into UTF-8. */
  if( stdin_is_interactive ){
    char *zTrans = sqlite3_win32_mbcs_to_utf8_v2(zLine, 0);
    if( zTrans ){
      int nTrans = strlen30(zTrans)+1;
      if( nTrans>nLine ){
        zLine = realloc(zLine, nTrans);
        if( zLine==0 ){
          sqlite3_free(zTrans);
          return 0;
        }
      }
      memcpy(zLine, zTrans, nTrans);
      sqlite3_free(zTrans);
    }
  }
#endif /* defined(_WIN32) || defined(WIN32) */
  return zLine;
}

/*
** Retrieve a single line of input text.
**
** If in==0 then read from standard input and prompt before each line.
** If isContinuation is true, then a continuation prompt is appropriate.
** If isContinuation is zero, then the main prompt should be used.
**
** If zPrior is not NULL then it is a buffer from a prior call to this
** routine that can be reused.
**
** The result is stored in space obtained from malloc() and must either
** be freed by the caller or else passed back into this routine via the
** zPrior argument for reuse.
*/
static char *one_input_line(FILE *in, char *zPrior, int isContinuation){
  char *zPrompt;
  char *zResult;
  if( in!=0 ){
    zResult = local_getline(zPrior, in);
  }else{
    zPrompt = isContinuation ? continuePrompt : mainPrompt;
#if SHELL_USE_LOCAL_GETLINE
    printf("%s", zPrompt);
    fflush(stdout);
    zResult = local_getline(zPrior, stdin);
#else
    free(zPrior);
    zResult = shell_readline(zPrompt);
    if( zResult && *zResult ) shell_add_history(zResult);
#endif
  }
  return zResult;
}

#if defined(SQLITE_ENABLE_SESSION)
/*
** State information for a single open session
*/
typedef struct OpenSession OpenSession;
struct OpenSession {
  char *zName;             /* Symbolic name for this session */
  int nFilter;             /* Number of xFilter rejection GLOB patterns */
  char **azFilter;         /* Array of xFilter rejection GLOB patterns */
  sqlite3_session *p;      /* The open session */
};
#endif

/*
** Shell output mode information from before ".explain on",
** saved so that it can be restored by ".explain off"
*/
typedef struct SavedModeInfo SavedModeInfo;
struct SavedModeInfo {
  int valid;          /* Is there legit data in here? */
  int mode;           /* Mode prior to ".explain on" */
  int showHeader;     /* The ".header" setting prior to ".explain on" */
  int colWidth[100];  /* Column widths prior to ".explain on" */
};

/*
** State information about the database connection is contained in an
** instance of the following structure.
*/
typedef struct ShellState ShellState;
struct ShellState {
  sqlite3 *db;           /* The database */
  int echoOn;            /* True to echo input commands */
  int autoExplain;       /* Automatically turn on .explain mode */
  int autoEQP;           /* Run EXPLAIN QUERY PLAN prior to seach SQL stmt */
  int statsOn;           /* True to display memory stats before each finalize */
  int scanstatsOn;       /* True to display scan stats before each finalize */
  int countChanges;      /* True to display change counts */
  int backslashOn;       /* Resolve C-style \x escapes in SQL input text */
  int outCount;          /* Revert to stdout when reaching zero */
  int cnt;               /* Number of records displayed so far */
  FILE *out;             /* Write results here */
  FILE *traceOut;        /* Output for sqlite3_trace() */
  int nErr;              /* Number of errors seen */
  int mode;              /* An output mode setting */
  int cMode;             /* temporary output mode for the current query */
  int normalMode;        /* Output mode before ".explain on" */
  int writableSchema;    /* True if PRAGMA writable_schema=ON */
  int showHeader;        /* True to show column names in List or Column mode */
  unsigned shellFlgs;    /* Various flags */
  char *zDestTable;      /* Name of destination table when MODE_Insert */
  char colSeparator[20]; /* Column separator character for several modes */
  char rowSeparator[20]; /* Row separator character for MODE_Ascii */
  int colWidth[100];     /* Requested width of each column when in column mode*/
  int actualWidth[100];  /* Actual width of each column */
  char nullValue[20];    /* The text to print when a NULL comes back from
                         ** the database */
  char outfile[FILENAME_MAX]; /* Filename for *out */
  const char *zDbFilename;    /* name of the database file */
  char *zFreeOnClose;         /* Filename to free when closing */
  const char *zVfs;           /* Name of VFS to use */
  sqlite3_stmt *pStmt;   /* Current statement if any. */
  FILE *pLog;            /* Write log output here */
  int *aiIndent;         /* Array of indents used in MODE_Explain */
  int nIndent;           /* Size of array aiIndent[] */
  int iIndent;           /* Index of current op in aiIndent[] */
#if defined(SQLITE_ENABLE_SESSION)
  int nSession;             /* Number of active sessions */
  OpenSession aSession[4];  /* Array of sessions.  [0] is in focus. */
#endif
};

/*
** These are the allowed shellFlgs values
*/
#define SHFLG_Scratch     0x00001     /* The --scratch option is used */
#define SHFLG_Pagecache   0x00002     /* The --pagecache option is used */
#define SHFLG_Lookaside   0x00004     /* Lookaside memory is used */

/*
** These are the allowed modes.
*/
#define MODE_Line     0  /* One column per line.  Blank line between records */
#define MODE_Column   1  /* One record per line in neat columns */
#define MODE_List     2  /* One record per line with a separator */
#define MODE_Semi     3  /* Same as MODE_List but append ";" to each line */
#define MODE_Html     4  /* Generate an XHTML table */
#define MODE_Insert   5  /* Generate SQL "insert" statements */
#define MODE_Tcl      6  /* Generate ANSI-C or TCL quoted elements */
#define MODE_Csv      7  /* Quote strings, numbers are plain */
#define MODE_Explain  8  /* Like MODE_Column, but do not truncate data */
#define MODE_Ascii    9  /* Use ASCII unit and record separators (0x1F/0x1E) */
#define MODE_Pretty  10  /* Pretty-print schemas */

static const char *modeDescr[] = {
  "line",
  "column",
  "list",
  "semi",
  "html",
  "insert",
  "tcl",
  "csv",
  "explain",
  "ascii",
  "prettyprint",
};

/*
** These are the column/row/line separators used by the various
** import/export modes.
*/
#define SEP_Column    "|"
#define SEP_Row       "\n"
#define SEP_Tab       "\t"
#define SEP_Space     " "
#define SEP_Comma     ","
#define SEP_CrLf      "\r\n"
#define SEP_Unit      "\x1F"
#define SEP_Record    "\x1E"

/*
** Number of elements in an array
*/
#define ArraySize(X)  (int)(sizeof(X)/sizeof(X[0]))

/*
** A callback for the sqlite3_log() interface.
*/
static void shellLog(void *pArg, int iErrCode, const char *zMsg){
  ShellState *p = (ShellState*)pArg;
  if( p->pLog==0 ) return;
  utf8_printf(p->pLog, "(%d) %s\n", iErrCode, zMsg);
  fflush(p->pLog);
}

/*
** Output the given string as a hex-encoded blob (eg. X'1234' )
*/
static void output_hex_blob(FILE *out, const void *pBlob, int nBlob){
  int i;
  char *zBlob = (char *)pBlob;
  raw_printf(out,"X'");
  for(i=0; i<nBlob; i++){ raw_printf(out,"%02x",zBlob[i]&0xff); }
  raw_printf(out,"'");
}

/*
** Output the given string as a quoted string using SQL quoting conventions.
*/
static void output_quoted_string(FILE *out, const char *z){
  int i;
  int nSingle = 0;
  setBinaryMode(out, 1);
  for(i=0; z[i]; i++){
    if( z[i]=='\'' ) nSingle++;
  }
  if( nSingle==0 ){
    utf8_printf(out,"'%s'",z);
  }else{
    raw_printf(out,"'");
    while( *z ){
      for(i=0; z[i] && z[i]!='\''; i++){}
      if( i==0 ){
        raw_printf(out,"''");
        z++;
      }else if( z[i]=='\'' ){
        utf8_printf(out,"%.*s''",i,z);
        z += i+1;
      }else{
        utf8_printf(out,"%s",z);
        break;
      }
    }
    raw_printf(out,"'");
  }
  setTextMode(out, 1);
}

/*
** Output the given string as a quoted according to C or TCL quoting rules.
*/
static void output_c_string(FILE *out, const char *z){
  unsigned int c;
  fputc('"', out);
  while( (c = *(z++))!=0 ){
    if( c=='\\' ){
      fputc(c, out);
      fputc(c, out);
    }else if( c=='"' ){
      fputc('\\', out);
      fputc('"', out);
    }else if( c=='\t' ){
      fputc('\\', out);
      fputc('t', out);
    }else if( c=='\n' ){
      fputc('\\', out);
      fputc('n', out);
    }else if( c=='\r' ){
      fputc('\\', out);
      fputc('r', out);
    }else if( !isprint(c&0xff) ){
      raw_printf(out, "\\%03o", c&0xff);
    }else{
      fputc(c, out);
    }
  }
  fputc('"', out);
}

/*
** Output the given string with characters that are special to
** HTML escaped.
*/
static void output_html_string(FILE *out, const char *z){
  int i;
  if( z==0 ) z = "";
  while( *z ){
    for(i=0;   z[i]
            && z[i]!='<'
            && z[i]!='&'
            && z[i]!='>'
            && z[i]!='\"'
            && z[i]!='\'';
        i++){}
    if( i>0 ){
      utf8_printf(out,"%.*s",i,z);
    }
    if( z[i]=='<' ){
      raw_printf(out,"&lt;");
    }else if( z[i]=='&' ){
      raw_printf(out,"&amp;");
    }else if( z[i]=='>' ){
      raw_printf(out,"&gt;");
    }else if( z[i]=='\"' ){
      raw_printf(out,"&quot;");
    }else if( z[i]=='\'' ){
      raw_printf(out,"&#39;");
    }else{
      break;
    }
    z += i + 1;
  }
}

/*
** If a field contains any character identified by a 1 in the following
** array, then the string must be quoted for CSV.
*/
static const char needCsvQuote[] = {
  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,
  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,
  1, 0, 1, 0, 0, 0, 0, 1,   0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 0,
  0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 1,
  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,
  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,
  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,
  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,
  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,
  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,
  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,
  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,
};

/*
** Output a single term of CSV.  Actually, p->colSeparator is used for
** the separator, which may or may not be a comma.  p->nullValue is
** the null value.  Strings are quoted if necessary.  The separator
** is only issued if bSep is true.
*/
static void output_csv(ShellState *p, const char *z, int bSep){
  FILE *out = p->out;
  if( z==0 ){
    utf8_printf(out,"%s",p->nullValue);
  }else{
    int i;
    int nSep = strlen30(p->colSeparator);
    for(i=0; z[i]; i++){
      if( needCsvQuote[((unsigned char*)z)[i]]
         || (z[i]==p->colSeparator[0] &&
             (nSep==1 || memcmp(z, p->colSeparator, nSep)==0)) ){
        i = 0;
        break;
      }
    }
    if( i==0 ){
      putc('"', out);
      for(i=0; z[i]; i++){
        if( z[i]=='"' ) putc('"', out);
        putc(z[i], out);
      }
      putc('"', out);
    }else{
      utf8_printf(out, "%s", z);
    }
  }
  if( bSep ){
    utf8_printf(p->out, "%s", p->colSeparator);
  }
}

#ifdef SIGINT
/*
** This routine runs when the user presses Ctrl-C
*/
static void interrupt_handler(int NotUsed){
  UNUSED_PARAMETER(NotUsed);
  seenInterrupt++;
  if( seenInterrupt>2 ) exit(1);
  if( globalDb ) sqlite3_interrupt(globalDb);
}
#endif

/*
** When the ".auth ON" is set, the following authorizer callback is
** invoked.  It always returns SQLITE_OK.
*/
static int shellAuth(
  void *pClientData,
  int op,
  const char *zA1,
  const char *zA2,
  const char *zA3,
  const char *zA4
){
  ShellState *p = (ShellState*)pClientData;
  static const char *azAction[] = { 0,
     "CREATE_INDEX",         "CREATE_TABLE",         "CREATE_TEMP_INDEX",
     "CREATE_TEMP_TABLE",    "CREATE_TEMP_TRIGGER",  "CREATE_TEMP_VIEW",
     "CREATE_TRIGGER",       "CREATE_VIEW",          "DELETE",
     "DROP_INDEX",           "DROP_TABLE",           "DROP_TEMP_INDEX",
     "DROP_TEMP_TABLE",      "DROP_TEMP_TRIGGER",    "DROP_TEMP_VIEW",
     "DROP_TRIGGER",         "DROP_VIEW",            "INSERT",
     "PRAGMA",               "READ",                 "SELECT",
     "TRANSACTION",          "UPDATE",               "ATTACH",
     "DETACH",               "ALTER_TABLE",          "REINDEX",
     "ANALYZE",              "CREATE_VTABLE",        "DROP_VTABLE",
     "FUNCTION",             "SAVEPOINT",            "RECURSIVE"
  };
  int i;
  const char *az[4];
  az[0] = zA1;
  az[1] = zA2;
  az[2] = zA3;
  az[3] = zA4;
  raw_printf(p->out, "authorizer: %s", azAction[op]);
  for(i=0; i<4; i++){
    raw_printf(p->out, " ");
    if( az[i] ){
      output_c_string(p->out, az[i]);
    }else{
      raw_printf(p->out, "NULL");
    }
  }
  raw_printf(p->out, "\n");
  return SQLITE_OK;
}
  

/*
** This is the callback routine that the shell
** invokes for each row of a query result.
*/
static int shell_callback(
  void *pArg,
  int nArg,        /* Number of result columns */
  char **azArg,    /* Text of each result column */
  char **azCol,    /* Column names */
  int *aiType      /* Column types */
){
  int i;
  ShellState *p = (ShellState*)pArg;

  switch( p->cMode ){
    case MODE_Line: {
      int w = 5;
      if( azArg==0 ) break;
      for(i=0; i<nArg; i++){
        int len = strlen30(azCol[i] ? azCol[i] : "");
        if( len>w ) w = len;
      }
      if( p->cnt++>0 ) utf8_printf(p->out, "%s", p->rowSeparator);
      for(i=0; i<nArg; i++){
        utf8_printf(p->out,"%*s = %s%s", w, azCol[i],
                azArg[i] ? azArg[i] : p->nullValue, p->rowSeparator);
      }
      break;
    }
    case MODE_Explain:
    case MODE_Column: {
      static const int aExplainWidths[] = {4, 13, 4, 4, 4, 13, 2, 13};
      const int *colWidth;
      int showHdr;
      char *rowSep;
      if( p->cMode==MODE_Column ){
        colWidth = p->colWidth;
        showHdr = p->showHeader;
        rowSep = p->rowSeparator;
      }else{
        colWidth = aExplainWidths;
        showHdr = 1;
        rowSep = SEP_Row;
      }
      if( p->cnt++==0 ){
        for(i=0; i<nArg; i++){
          int w, n;
          if( i<ArraySize(p->colWidth) ){
            w = colWidth[i];
          }else{
            w = 0;
          }
          if( w==0 ){
            w = strlen30(azCol[i] ? azCol[i] : "");
            if( w<10 ) w = 10;
            n = strlen30(azArg && azArg[i] ? azArg[i] : p->nullValue);
            if( w<n ) w = n;
          }
          if( i<ArraySize(p->actualWidth) ){
            p->actualWidth[i] = w;
          }
          if( showHdr ){
            if( w<0 ){
              utf8_printf(p->out,"%*.*s%s",-w,-w,azCol[i],
                      i==nArg-1 ? rowSep : "  ");
            }else{
              utf8_printf(p->out,"%-*.*s%s",w,w,azCol[i],
                      i==nArg-1 ? rowSep : "  ");
            }
          }
        }
        if( showHdr ){
          for(i=0; i<nArg; i++){
            int w;
            if( i<ArraySize(p->actualWidth) ){
               w = p->actualWidth[i];
               if( w<0 ) w = -w;
            }else{
               w = 10;
            }
            utf8_printf(p->out,"%-*.*s%s",w,w,
                   "----------------------------------------------------------"
                   "----------------------------------------------------------",
                    i==nArg-1 ? rowSep : "  ");
          }
        }
      }
      if( azArg==0 ) break;
      for(i=0; i<nArg; i++){
        int w;
        if( i<ArraySize(p->actualWidth) ){
           w = p->actualWidth[i];
        }else{
           w = 10;
        }
        if( p->cMode==MODE_Explain && azArg[i] && strlen30(azArg[i])>w ){
          w = strlen30(azArg[i]);
        }
        if( i==1 && p->aiIndent && p->pStmt ){
          if( p->iIndent<p->nIndent ){
            utf8_printf(p->out, "%*.s", p->aiIndent[p->iIndent], "");
          }
          p->iIndent++;
        }
        if( w<0 ){
          utf8_printf(p->out,"%*.*s%s",-w,-w,
              azArg[i] ? azArg[i] : p->nullValue,
              i==nArg-1 ? rowSep : "  ");
        }else{
          utf8_printf(p->out,"%-*.*s%s",w,w,
              azArg[i] ? azArg[i] : p->nullValue,
              i==nArg-1 ? rowSep : "  ");
        }
      }
      break;
    }
    case MODE_Semi: {   /* .schema and .fullschema output */
      utf8_printf(p->out, "%s;\n", azArg[0]);
      break;
    }
    case MODE_Pretty: {  /* .schema and .fullschema with --indent */
      char *z;
      int j;
      int nParen = 0;
      char cEnd = 0;
      char c;
      int nLine = 0;
      assert( nArg==1 );
      if( azArg[0]==0 ) break;
      if( sqlite3_strlike("CREATE VIEW%", azArg[0], 0)==0
       || sqlite3_strlike("CREATE TRIG%", azArg[0], 0)==0
      ){
        utf8_printf(p->out, "%s;\n", azArg[0]);
        break;
      }
      z = sqlite3_mprintf("%s", azArg[0]);
      j = 0;
      for(i=0; IsSpace(z[i]); i++){}
      for(; (c = z[i])!=0; i++){
        if( IsSpace(c) ){
          if( IsSpace(z[j-1]) || z[j-1]=='(' ) continue;
        }else if( (c=='(' || c==')') && j>0 && IsSpace(z[j-1]) ){
          j--;
        }
        z[j++] = c;
      }
      while( j>0 && IsSpace(z[j-1]) ){ j--; }
      z[j] = 0;
      if( strlen30(z)>=79 ){
        for(i=j=0; (c = z[i])!=0; i++){
          if( c==cEnd ){
            cEnd = 0;
          }else if( c=='"' || c=='\'' || c=='`' ){
            cEnd = c;
          }else if( c=='[' ){
            cEnd = ']';
          }else if( c=='(' ){
            nParen++;
          }else if( c==')' ){
            nParen--;
            if( nLine>0 && nParen==0 && j>0 ){
              utf8_printf(p->out, "%.*s\n", j, z);
              j = 0;
            }
          }
          z[j++] = c;
          if( nParen==1 && (c=='(' || c==',' || c=='\n') ){
            if( c=='\n' ) j--;
            utf8_printf(p->out, "%.*s\n  ", j, z);
            j = 0;
            nLine++;
            while( IsSpace(z[i+1]) ){ i++; }
          }
        }
        z[j] = 0;
      }
      utf8_printf(p->out, "%s;\n", z);
      sqlite3_free(z);
      break;
    }
    case MODE_List: {
      if( p->cnt++==0 && p->showHeader ){
        for(i=0; i<nArg; i++){
          utf8_printf(p->out,"%s%s",azCol[i],
                  i==nArg-1 ? p->rowSeparator : p->colSeparator);
        }
      }
      if( azArg==0 ) break;
      for(i=0; i<nArg; i++){
        char *z = azArg[i];
        if( z==0 ) z = p->nullValue;
        utf8_printf(p->out, "%s", z);
        if( i<nArg-1 ){
          utf8_printf(p->out, "%s", p->colSeparator);
        }else{
          utf8_printf(p->out, "%s", p->rowSeparator);
        }
      }
      break;
    }
    case MODE_Html: {
      if( p->cnt++==0 && p->showHeader ){
        raw_printf(p->out,"<TR>");
        for(i=0; i<nArg; i++){
          raw_printf(p->out,"<TH>");
          output_html_string(p->out, azCol[i]);
          raw_printf(p->out,"</TH>\n");
        }
        raw_printf(p->out,"</TR>\n");
      }
      if( azArg==0 ) break;
      raw_printf(p->out,"<TR>");
      for(i=0; i<nArg; i++){
        raw_printf(p->out,"<TD>");
        output_html_string(p->out, azArg[i] ? azArg[i] : p->nullValue);
        raw_printf(p->out,"</TD>\n");
      }
      raw_printf(p->out,"</TR>\n");
      break;
    }
    case MODE_Tcl: {
      if( p->cnt++==0 && p->showHeader ){
        for(i=0; i<nArg; i++){
          output_c_string(p->out,azCol[i] ? azCol[i] : "");
          if(i<nArg-1) utf8_printf(p->out, "%s", p->colSeparator);
        }
        utf8_printf(p->out, "%s", p->rowSeparator);
      }
      if( azArg==0 ) break;
      for(i=0; i<nArg; i++){
        output_c_string(p->out, azArg[i] ? azArg[i] : p->nullValue);
        if(i<nArg-1) utf8_printf(p->out, "%s", p->colSeparator);
      }
      utf8_printf(p->out, "%s", p->rowSeparator);
      break;
    }
    case MODE_Csv: {
      setBinaryMode(p->out, 1);
      if( p->cnt++==0 && p->showHeader ){
        for(i=0; i<nArg; i++){
          output_csv(p, azCol[i] ? azCol[i] : "", i<nArg-1);
        }
        utf8_printf(p->out, "%s", p->rowSeparator);
      }
      if( nArg>0 ){
        for(i=0; i<nArg; i++){
          output_csv(p, azArg[i], i<nArg-1);
        }
        utf8_printf(p->out, "%s", p->rowSeparator);
      }
      setTextMode(p->out, 1);
      break;
    }
    case MODE_Insert: {
      p->cnt++;
      if( azArg==0 ) break;
      utf8_printf(p->out,"INSERT INTO %s",p->zDestTable);
      if( p->showHeader ){
        raw_printf(p->out,"(");
        for(i=0; i<nArg; i++){
          char *zSep = i>0 ? ",": "";
          utf8_printf(p->out, "%s%s", zSep, azCol[i]);
        }
        raw_printf(p->out,")");
      }
      raw_printf(p->out," VALUES(");
      for(i=0; i<nArg; i++){
        char *zSep = i>0 ? ",": "";
        if( (azArg[i]==0) || (aiType && aiType[i]==SQLITE_NULL) ){
          utf8_printf(p->out,"%sNULL",zSep);
        }else if( aiType && aiType[i]==SQLITE_TEXT ){
          if( zSep[0] ) utf8_printf(p->out,"%s",zSep);
          output_quoted_string(p->out, azArg[i]);
        }else if( aiType && (aiType[i]==SQLITE_INTEGER
                             || aiType[i]==SQLITE_FLOAT) ){
          utf8_printf(p->out,"%s%s",zSep, azArg[i]);
        }else if( aiType && aiType[i]==SQLITE_BLOB && p->pStmt ){
          const void *pBlob = sqlite3_column_blob(p->pStmt, i);
          int nBlob = sqlite3_column_bytes(p->pStmt, i);
          if( zSep[0] ) utf8_printf(p->out,"%s",zSep);
          output_hex_blob(p->out, pBlob, nBlob);
        }else if( isNumber(azArg[i], 0) ){
          utf8_printf(p->out,"%s%s",zSep, azArg[i]);
        }else{
          if( zSep[0] ) utf8_printf(p->out,"%s",zSep);
          output_quoted_string(p->out, azArg[i]);
        }
      }
      raw_printf(p->out,");\n");
      break;
    }
    case MODE_Ascii: {
      if( p->cnt++==0 && p->showHeader ){
        for(i=0; i<nArg; i++){
          if( i>0 ) utf8_printf(p->out, "%s", p->colSeparator);
          utf8_printf(p->out,"%s",azCol[i] ? azCol[i] : "");
        }
        utf8_printf(p->out, "%s", p->rowSeparator);
      }
      if( azArg==0 ) break;
      for(i=0; i<nArg; i++){
        if( i>0 ) utf8_printf(p->out, "%s", p->colSeparator);
        utf8_printf(p->out,"%s",azArg[i] ? azArg[i] : p->nullValue);
      }
      utf8_printf(p->out, "%s", p->rowSeparator);
      break;
    }
  }
  return 0;
}

/*
** This is the callback routine that the SQLite library
** invokes for each row of a query result.
*/
static int callback(void *pArg, int nArg, char **azArg, char **azCol){
  /* since we don't have type info, call the shell_callback with a NULL value */
  return shell_callback(pArg, nArg, azArg, azCol, NULL);
}

/*
** Set the destination table field of the ShellState structure to
** the name of the table given.  Escape any quote characters in the
** table name.
*/
static void set_table_name(ShellState *p, const char *zName){
  int i, n;
  int needQuote;
  char *z;

  if( p->zDestTable ){
    free(p->zDestTable);
    p->zDestTable = 0;
  }
  if( zName==0 ) return;
  needQuote = !isalpha((unsigned char)*zName) && *zName!='_';
  for(i=n=0; zName[i]; i++, n++){
    if( !isalnum((unsigned char)zName[i]) && zName[i]!='_' ){
      needQuote = 1;
      if( zName[i]=='\'' ) n++;
    }
  }
  if( needQuote ) n += 2;
  z = p->zDestTable = malloc( n+1 );
  if( z==0 ){
    raw_printf(stderr,"Error: out of memory\n");
    exit(1);
  }
  n = 0;
  if( needQuote ) z[n++] = '\'';
  for(i=0; zName[i]; i++){
    z[n++] = zName[i];
    if( zName[i]=='\'' ) z[n++] = '\'';
  }
  if( needQuote ) z[n++] = '\'';
  z[n] = 0;
}

/* zIn is either a pointer to a NULL-terminated string in memory obtained
** from malloc(), or a NULL pointer. The string pointed to by zAppend is
** added to zIn, and the result returned in memory obtained from malloc().
** zIn, if it was not NULL, is freed.
**
** If the third argument, quote, is not '\0', then it is used as a
** quote character for zAppend.
*/
static char *appendText(char *zIn, char const *zAppend, char quote){
  int len;
  int i;
  int nAppend = strlen30(zAppend);
  int nIn = (zIn?strlen30(zIn):0);

  len = nAppend+nIn+1;
  if( quote ){
    len += 2;
    for(i=0; i<nAppend; i++){
      if( zAppend[i]==quote ) len++;
    }
  }

  zIn = (char *)realloc(zIn, len);
  if( !zIn ){
    return 0;
  }

  if( quote ){
    char *zCsr = &zIn[nIn];
    *zCsr++ = quote;
    for(i=0; i<nAppend; i++){
      *zCsr++ = zAppend[i];
      if( zAppend[i]==quote ) *zCsr++ = quote;
    }
    *zCsr++ = quote;
    *zCsr++ = '\0';
    assert( (zCsr-zIn)==len );
  }else{
    memcpy(&zIn[nIn], zAppend, nAppend);
    zIn[len-1] = '\0';
  }

  return zIn;
}


/*
** Execute a query statement that will generate SQL output.  Print
** the result columns, comma-separated, on a line and then add a
** semicolon terminator to the end of that line.
**
** If the number of columns is 1 and that column contains text "--"
** then write the semicolon on a separate line.  That way, if a
** "--" comment occurs at the end of the statement, the comment
** won't consume the semicolon terminator.
*/
static int run_table_dump_query(
  ShellState *p,           /* Query context */
  const char *zSelect,     /* SELECT statement to extract content */
  const char *zFirstRow    /* Print before first row, if not NULL */
){
  sqlite3_stmt *pSelect;
  int rc;
  int nResult;
  int i;
  const char *z;
  rc = sqlite3_prepare_v2(p->db, zSelect, -1, &pSelect, 0);
  if( rc!=SQLITE_OK || !pSelect ){
    utf8_printf(p->out, "/**** ERROR: (%d) %s *****/\n", rc,
                sqlite3_errmsg(p->db));
    if( (rc&0xff)!=SQLITE_CORRUPT ) p->nErr++;
    return rc;
  }
  rc = sqlite3_step(pSelect);
  nResult = sqlite3_column_count(pSelect);
  while( rc==SQLITE_ROW ){
    if( zFirstRow ){
      utf8_printf(p->out, "%s", zFirstRow);
      zFirstRow = 0;
    }
    z = (const char*)sqlite3_column_text(pSelect, 0);
    utf8_printf(p->out, "%s", z);
    for(i=1; i<nResult; i++){
      utf8_printf(p->out, ",%s", sqlite3_column_text(pSelect, i));
    }
    if( z==0 ) z = "";
    while( z[0] && (z[0]!='-' || z[1]!='-') ) z++;
    if( z[0] ){
      raw_printf(p->out, "\n;\n");
    }else{
      raw_printf(p->out, ";\n");
    }
    rc = sqlite3_step(pSelect);
  }
  rc = sqlite3_finalize(pSelect);
  if( rc!=SQLITE_OK ){
    utf8_printf(p->out, "/**** ERROR: (%d) %s *****/\n", rc,
                sqlite3_errmsg(p->db));
    if( (rc&0xff)!=SQLITE_CORRUPT ) p->nErr++;
  }
  return rc;
}

/*
** Allocate space and save off current error string.
*/
static char *save_err_msg(
  sqlite3 *db            /* Database to query */
){
  int nErrMsg = 1+strlen30(sqlite3_errmsg(db));
  char *zErrMsg = sqlite3_malloc64(nErrMsg);
  if( zErrMsg ){
    memcpy(zErrMsg, sqlite3_errmsg(db), nErrMsg);
  }
  return zErrMsg;
}

#ifdef __linux__
/*
** Attempt to display I/O stats on Linux using /proc/PID/io
*/
static void displayLinuxIoStats(FILE *out){
  FILE *in;
  char z[200];
  sqlite3_snprintf(sizeof(z), z, "/proc/%d/io", getpid());
  in = fopen(z, "rb");
  if( in==0 ) return;
  while( fgets(z, sizeof(z), in)!=0 ){
    static const struct {
      const char *zPattern;
      const char *zDesc;
    } aTrans[] = {
      { "rchar: ",                  "Bytes received by read():" },
      { "wchar: ",                  "Bytes sent to write():"    },
      { "syscr: ",                  "Read() system calls:"      },
      { "syscw: ",                  "Write() system calls:"     },
      { "read_bytes: ",             "Bytes read from storage:"  },
      { "write_bytes: ",            "Bytes written to storage:" },
      { "cancelled_write_bytes: ",  "Cancelled write bytes:"    },
    };
    int i;
    for(i=0; i<ArraySize(aTrans); i++){
      int n = (int)strlen(aTrans[i].zPattern);
      if( strncmp(aTrans[i].zPattern, z, n)==0 ){
        raw_printf(out, "%-36s %s", aTrans[i].zDesc, &z[n]);
        break;
      }
    }
  }
  fclose(in);
}
#endif


/*
** Display memory stats.
*/
static int display_stats(
  sqlite3 *db,                /* Database to query */
  ShellState *pArg,           /* Pointer to ShellState */
  int bReset                  /* True to reset the stats */
){
  int iCur;
  int iHiwtr;

  if( pArg && pArg->out ){

    iHiwtr = iCur = -1;
    sqlite3_status(SQLITE_STATUS_MEMORY_USED, &iCur, &iHiwtr, bReset);
    raw_printf(pArg->out,
            "Memory Used:                         %d (max %d) bytes\n",
            iCur, iHiwtr);
    iHiwtr = iCur = -1;
    sqlite3_status(SQLITE_STATUS_MALLOC_COUNT, &iCur, &iHiwtr, bReset);
    raw_printf(pArg->out, "Number of Outstanding Allocations:   %d (max %d)\n",
            iCur, iHiwtr);
    if( pArg->shellFlgs & SHFLG_Pagecache ){
      iHiwtr = iCur = -1;
      sqlite3_status(SQLITE_STATUS_PAGECACHE_USED, &iCur, &iHiwtr, bReset);
      raw_printf(pArg->out,
              "Number of Pcache Pages Used:         %d (max %d) pages\n",
              iCur, iHiwtr);
    }
    iHiwtr = iCur = -1;
    sqlite3_status(SQLITE_STATUS_PAGECACHE_OVERFLOW, &iCur, &iHiwtr, bReset);
    raw_printf(pArg->out,
            "Number of Pcache Overflow Bytes:     %d (max %d) bytes\n",
            iCur, iHiwtr);
    if( pArg->shellFlgs & SHFLG_Scratch ){
      iHiwtr = iCur = -1;
      sqlite3_status(SQLITE_STATUS_SCRATCH_USED, &iCur, &iHiwtr, bReset);
      raw_printf(pArg->out,
              "Number of Scratch Allocations Used:  %d (max %d)\n",
              iCur, iHiwtr);
    }
    iHiwtr = iCur = -1;
    sqlite3_status(SQLITE_STATUS_SCRATCH_OVERFLOW, &iCur, &iHiwtr, bReset);
    raw_printf(pArg->out,
            "Number of Scratch Overflow Bytes:    %d (max %d) bytes\n",
            iCur, iHiwtr);
    iHiwtr = iCur = -1;
    sqlite3_status(SQLITE_STATUS_MALLOC_SIZE, &iCur, &iHiwtr, bReset);
    raw_printf(pArg->out, "Largest Allocation:                  %d bytes\n",
            iHiwtr);
    iHiwtr = iCur = -1;
    sqlite3_status(SQLITE_STATUS_PAGECACHE_SIZE, &iCur, &iHiwtr, bReset);
    raw_printf(pArg->out, "Largest Pcache Allocation:           %d bytes\n",
            iHiwtr);
    iHiwtr = iCur = -1;
    sqlite3_status(SQLITE_STATUS_SCRATCH_SIZE, &iCur, &iHiwtr, bReset);
    raw_printf(pArg->out, "Largest Scratch Allocation:          %d bytes\n",
            iHiwtr);
#ifdef YYTRACKMAXSTACKDEPTH
    iHiwtr = iCur = -1;
    sqlite3_status(SQLITE_STATUS_PARSER_STACK, &iCur, &iHiwtr, bReset);
    raw_printf(pArg->out, "Deepest Parser Stack:                %d (max %d)\n",
            iCur, iHiwtr);
#endif
  }

  if( pArg && pArg->out && db ){
    if( pArg->shellFlgs & SHFLG_Lookaside ){
      iHiwtr = iCur = -1;
      sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_USED,
                        &iCur, &iHiwtr, bReset);
      raw_printf(pArg->out,
              "Lookaside Slots Used:                %d (max %d)\n",
              iCur, iHiwtr);
      sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_HIT,
                        &iCur, &iHiwtr, bReset);
      raw_printf(pArg->out, "Successful lookaside attempts:       %d\n",
              iHiwtr);
      sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE,
                        &iCur, &iHiwtr, bReset);
      raw_printf(pArg->out, "Lookaside failures due to size:      %d\n",
              iHiwtr);
      sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL,
                        &iCur, &iHiwtr, bReset);
      raw_printf(pArg->out, "Lookaside failures due to OOM:       %d\n",
              iHiwtr);
    }
    iHiwtr = iCur = -1;
    sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_USED, &iCur, &iHiwtr, bReset);
    raw_printf(pArg->out, "Pager Heap Usage:                    %d bytes\n",
            iCur);
    iHiwtr = iCur = -1;
    sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_HIT, &iCur, &iHiwtr, 1);
    raw_printf(pArg->out, "Page cache hits:                     %d\n", iCur);
    iHiwtr = iCur = -1;
    sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_MISS, &iCur, &iHiwtr, 1);
    raw_printf(pArg->out, "Page cache misses:                   %d\n", iCur);
    iHiwtr = iCur = -1;
    sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_WRITE, &iCur, &iHiwtr, 1);
    raw_printf(pArg->out, "Page cache writes:                   %d\n", iCur);
    iHiwtr = iCur = -1;
    sqlite3_db_status(db, SQLITE_DBSTATUS_SCHEMA_USED, &iCur, &iHiwtr, bReset);
    raw_printf(pArg->out, "Schema Heap Usage:                   %d bytes\n",
            iCur);
    iHiwtr = iCur = -1;
    sqlite3_db_status(db, SQLITE_DBSTATUS_STMT_USED, &iCur, &iHiwtr, bReset);
    raw_printf(pArg->out, "Statement Heap/Lookaside Usage:      %d bytes\n",
            iCur);
  }

  if( pArg && pArg->out && db && pArg->pStmt ){
    iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_FULLSCAN_STEP,
                               bReset);
    raw_printf(pArg->out, "Fullscan Steps:                      %d\n", iCur);
    iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_SORT, bReset);
    raw_printf(pArg->out, "Sort Operations:                     %d\n", iCur);
    iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_AUTOINDEX,bReset);
    raw_printf(pArg->out, "Autoindex Inserts:                   %d\n", iCur);
    iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP, bReset);
    raw_printf(pArg->out, "Virtual Machine Steps:               %d\n", iCur);
  }

#ifdef __linux__
  displayLinuxIoStats(pArg->out);
#endif

  /* Do not remove this machine readable comment: extra-stats-output-here */

  return 0;
}

/*
** Display scan stats.
*/
static void display_scanstats(
  sqlite3 *db,                    /* Database to query */
  ShellState *pArg                /* Pointer to ShellState */
){
#ifndef SQLITE_ENABLE_STMT_SCANSTATUS
  UNUSED_PARAMETER(db);
  UNUSED_PARAMETER(pArg);
#else
  int i, k, n, mx;
  raw_printf(pArg->out, "-------- scanstats --------\n");
  mx = 0;
  for(k=0; k<=mx; k++){
    double rEstLoop = 1.0;
    for(i=n=0; 1; i++){
      sqlite3_stmt *p = pArg->pStmt;
      sqlite3_int64 nLoop, nVisit;
      double rEst;
      int iSid;
      const char *zExplain;
      if( sqlite3_stmt_scanstatus(p, i, SQLITE_SCANSTAT_NLOOP, (void*)&nLoop) ){
        break;
      }
      sqlite3_stmt_scanstatus(p, i, SQLITE_SCANSTAT_SELECTID, (void*)&iSid);
      if( iSid>mx ) mx = iSid;
      if( iSid!=k ) continue;
      if( n==0 ){
        rEstLoop = (double)nLoop;
        if( k>0 ) raw_printf(pArg->out, "-------- subquery %d -------\n", k);
      }
      n++;
      sqlite3_stmt_scanstatus(p, i, SQLITE_SCANSTAT_NVISIT, (void*)&nVisit);
      sqlite3_stmt_scanstatus(p, i, SQLITE_SCANSTAT_EST, (void*)&rEst);
      sqlite3_stmt_scanstatus(p, i, SQLITE_SCANSTAT_EXPLAIN, (void*)&zExplain);
      utf8_printf(pArg->out, "Loop %2d: %s\n", n, zExplain);
      rEstLoop *= rEst;
      raw_printf(pArg->out,
          "         nLoop=%-8lld nRow=%-8lld estRow=%-8lld estRow/Loop=%-8g\n",
          nLoop, nVisit, (sqlite3_int64)(rEstLoop+0.5), rEst
      );
    }
  }
  raw_printf(pArg->out, "---------------------------\n");
#endif
}

/*
** Parameter azArray points to a zero-terminated array of strings. zStr
** points to a single nul-terminated string. Return non-zero if zStr
** is equal, according to strcmp(), to any of the strings in the array.
** Otherwise, return zero.
*/
static int str_in_array(const char *zStr, const char **azArray){
  int i;
  for(i=0; azArray[i]; i++){
    if( 0==strcmp(zStr, azArray[i]) ) return 1;
  }
  return 0;
}

/*
** If compiled statement pSql appears to be an EXPLAIN statement, allocate
** and populate the ShellState.aiIndent[] array with the number of
** spaces each opcode should be indented before it is output.
**
** The indenting rules are:
**
**     * For each "Next", "Prev", "VNext" or "VPrev" instruction, indent
**       all opcodes that occur between the p2 jump destination and the opcode
**       itself by 2 spaces.
**
**     * For each "Goto", if the jump destination is earlier in the program
**       and ends on one of:
**          Yield  SeekGt  SeekLt  RowSetRead  Rewind
**       or if the P1 parameter is one instead of zero,
**       then indent all opcodes between the earlier instruction
**       and "Goto" by 2 spaces.
*/
static void explain_data_prepare(ShellState *p, sqlite3_stmt *pSql){
  const char *zSql;               /* The text of the SQL statement */
  const char *z;                  /* Used to check if this is an EXPLAIN */
  int *abYield = 0;               /* True if op is an OP_Yield */
  int nAlloc = 0;                 /* Allocated size of p->aiIndent[], abYield */
  int iOp;                        /* Index of operation in p->aiIndent[] */

  const char *azNext[] = { "Next", "Prev", "VPrev", "VNext", "SorterNext",
                           "NextIfOpen", "PrevIfOpen", 0 };
  const char *azYield[] = { "Yield", "SeekLT", "SeekGT", "RowSetRead",
                            "Rewind", 0 };
  const char *azGoto[] = { "Goto", 0 };

  /* Try to figure out if this is really an EXPLAIN statement. If this
  ** cannot be verified, return early.  */
  if( sqlite3_column_count(pSql)!=8 ){
    p->cMode = p->mode;
    return;
  }
  zSql = sqlite3_sql(pSql);
  if( zSql==0 ) return;
  for(z=zSql; *z==' ' || *z=='\t' || *z=='\n' || *z=='\f' || *z=='\r'; z++);
  if( sqlite3_strnicmp(z, "explain", 7) ){
    p->cMode = p->mode;
    return;
  }

  for(iOp=0; SQLITE_ROW==sqlite3_step(pSql); iOp++){
    int i;
    int iAddr = sqlite3_column_int(pSql, 0);
    const char *zOp = (const char*)sqlite3_column_text(pSql, 1);

    /* Set p2 to the P2 field of the current opcode. Then, assuming that
    ** p2 is an instruction address, set variable p2op to the index of that
    ** instruction in the aiIndent[] array. p2 and p2op may be different if
    ** the current instruction is part of a sub-program generated by an
    ** SQL trigger or foreign key.  */
    int p2 = sqlite3_column_int(pSql, 3);
    int p2op = (p2 + (iOp-iAddr));

    /* Grow the p->aiIndent array as required */
    if( iOp>=nAlloc ){
      if( iOp==0 ){
        /* Do further verfication that this is explain output.  Abort if
        ** it is not */
        static const char *explainCols[] = {
           "addr", "opcode", "p1", "p2", "p3", "p4", "p5", "comment" };
        int jj;
        for(jj=0; jj<ArraySize(explainCols); jj++){
          if( strcmp(sqlite3_column_name(pSql,jj),explainCols[jj])!=0 ){
            p->cMode = p->mode;
            sqlite3_reset(pSql);
            return;
          }
        }
      }
      nAlloc += 100;
      p->aiIndent = (int*)sqlite3_realloc64(p->aiIndent, nAlloc*sizeof(int));
      abYield = (int*)sqlite3_realloc64(abYield, nAlloc*sizeof(int));
    }
    abYield[iOp] = str_in_array(zOp, azYield);
    p->aiIndent[iOp] = 0;
    p->nIndent = iOp+1;

    if( str_in_array(zOp, azNext) ){
      for(i=p2op; i<iOp; i++) p->aiIndent[i] += 2;
    }
    if( str_in_array(zOp, azGoto) && p2op<p->nIndent
     && (abYield[p2op] || sqlite3_column_int(pSql, 2))
    ){
      for(i=p2op; i<iOp; i++) p->aiIndent[i] += 2;
    }
  }

  p->iIndent = 0;
  sqlite3_free(abYield);
  sqlite3_reset(pSql);
}

/*
** Free the array allocated by explain_data_prepare().
*/
static void explain_data_delete(ShellState *p){
  sqlite3_free(p->aiIndent);
  p->aiIndent = 0;
  p->nIndent = 0;
  p->iIndent = 0;
}

/*
** Disable and restore .wheretrace and .selecttrace settings.
*/
#if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_SELECTTRACE)
extern int sqlite3SelectTrace;
static int savedSelectTrace;
#endif
#if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_WHERETRACE)
extern int sqlite3WhereTrace;
static int savedWhereTrace;
#endif
static void disable_debug_trace_modes(void){
#if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_SELECTTRACE)
  savedSelectTrace = sqlite3SelectTrace;
  sqlite3SelectTrace = 0;
#endif
#if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_WHERETRACE)
  savedWhereTrace = sqlite3WhereTrace;
  sqlite3WhereTrace = 0;
#endif
}
static void restore_debug_trace_modes(void){
#if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_SELECTTRACE)
  sqlite3SelectTrace = savedSelectTrace;
#endif
#if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_WHERETRACE)
  sqlite3WhereTrace = savedWhereTrace;
#endif
}

/*
** Run a prepared statement
*/
static void exec_prepared_stmt(
  ShellState *pArg,                                /* Pointer to ShellState */
  sqlite3_stmt *pStmt,                             /* Statment to run */
  int (*xCallback)(void*,int,char**,char**,int*)   /* Callback function */
){
  int rc;

  /* perform the first step.  this will tell us if we
  ** have a result set or not and how wide it is.
  */
  rc = sqlite3_step(pStmt);
  /* if we have a result set... */
  if( SQLITE_ROW == rc ){
    /* if we have a callback... */
    if( xCallback ){
      /* allocate space for col name ptr, value ptr, and type */
      int nCol = sqlite3_column_count(pStmt);
      void *pData = sqlite3_malloc64(3*nCol*sizeof(const char*) + 1);
      if( !pData ){
        rc = SQLITE_NOMEM;
      }else{
        char **azCols = (char **)pData;      /* Names of result columns */
        char **azVals = &azCols[nCol];       /* Results */
        int *aiTypes = (int *)&azVals[nCol]; /* Result types */
        int i, x;
        assert(sizeof(int) <= sizeof(char *));
        /* save off ptrs to column names */
        for(i=0; i<nCol; i++){
          azCols[i] = (char *)sqlite3_column_name(pStmt, i);
        }
        do{
          /* extract the data and data types */
          for(i=0; i<nCol; i++){
            aiTypes[i] = x = sqlite3_column_type(pStmt, i);
            if( x==SQLITE_BLOB && pArg && pArg->cMode==MODE_Insert ){
              azVals[i] = "";
            }else{
              azVals[i] = (char*)sqlite3_column_text(pStmt, i);
            }
            if( !azVals[i] && (aiTypes[i]!=SQLITE_NULL) ){
              rc = SQLITE_NOMEM;
              break; /* from for */
            }
          } /* end for */

          /* if data and types extracted successfully... */
          if( SQLITE_ROW == rc ){
            /* call the supplied callback with the result row data */
            if( xCallback(pArg, nCol, azVals, azCols, aiTypes) ){
              rc = SQLITE_ABORT;
            }else{
              rc = sqlite3_step(pStmt);
            }
          }
        } while( SQLITE_ROW == rc );
        sqlite3_free(pData);
      }
    }else{
      do{
        rc = sqlite3_step(pStmt);
      } while( rc == SQLITE_ROW );
    }
  }
}

/*
** Execute a statement or set of statements.  Print
** any result rows/columns depending on the current mode
** set via the supplied callback.
**
** This is very similar to SQLite's built-in sqlite3_exec()
** function except it takes a slightly different callback
** and callback data argument.
*/
static int shell_exec(
  sqlite3 *db,                              /* An open database */
  const char *zSql,                         /* SQL to be evaluated */
  int (*xCallback)(void*,int,char**,char**,int*),   /* Callback function */
                                            /* (not the same as sqlite3_exec) */
  ShellState *pArg,                         /* Pointer to ShellState */
  char **pzErrMsg                           /* Error msg written here */
){
  sqlite3_stmt *pStmt = NULL;     /* Statement to execute. */
  int rc = SQLITE_OK;             /* Return Code */
  int rc2;
  const char *zLeftover;          /* Tail of unprocessed SQL */

  if( pzErrMsg ){
    *pzErrMsg = NULL;
  }

  while( zSql[0] && (SQLITE_OK == rc) ){
    static const char *zStmtSql;
    rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, &zLeftover);
    if( SQLITE_OK != rc ){
      if( pzErrMsg ){
        *pzErrMsg = save_err_msg(db);
      }
    }else{
      if( !pStmt ){
        /* this happens for a comment or white-space */
        zSql = zLeftover;
        while( IsSpace(zSql[0]) ) zSql++;
        continue;
      }
      zStmtSql = sqlite3_sql(pStmt);
      while( IsSpace(zStmtSql[0]) ) zStmtSql++;

      /* save off the prepared statment handle and reset row count */
      if( pArg ){
        pArg->pStmt = pStmt;
        pArg->cnt = 0;
      }

      /* echo the sql statement if echo on */
      if( pArg && pArg->echoOn ){
        utf8_printf(pArg->out, "%s\n", zStmtSql ? zStmtSql : zSql);
      }

      /* Show the EXPLAIN QUERY PLAN if .eqp is on */
      if( pArg && pArg->autoEQP && sqlite3_strlike("EXPLAIN%",zStmtSql,0)!=0 ){
        sqlite3_stmt *pExplain;
        char *zEQP;
        disable_debug_trace_modes();
        zEQP = sqlite3_mprintf("EXPLAIN QUERY PLAN %s", zStmtSql);
        rc = sqlite3_prepare_v2(db, zEQP, -1, &pExplain, 0);
        if( rc==SQLITE_OK ){
          while( sqlite3_step(pExplain)==SQLITE_ROW ){
            raw_printf(pArg->out,"--EQP-- %d,",sqlite3_column_int(pExplain, 0));
            raw_printf(pArg->out,"%d,", sqlite3_column_int(pExplain, 1));
            raw_printf(pArg->out,"%d,", sqlite3_column_int(pExplain, 2));
            utf8_printf(pArg->out,"%s\n", sqlite3_column_text(pExplain, 3));
          }
        }
        sqlite3_finalize(pExplain);
        sqlite3_free(zEQP);
        if( pArg->autoEQP>=2 ){
          /* Also do an EXPLAIN for ".eqp full" mode */
          zEQP = sqlite3_mprintf("EXPLAIN %s", zStmtSql);
          rc = sqlite3_prepare_v2(db, zEQP, -1, &pExplain, 0);
          if( rc==SQLITE_OK ){
            pArg->cMode = MODE_Explain;
            explain_data_prepare(pArg, pExplain);
            exec_prepared_stmt(pArg, pExplain, xCallback);
            explain_data_delete(pArg);
          }
          sqlite3_finalize(pExplain);
          sqlite3_free(zEQP);
        }
        restore_debug_trace_modes();
      }

      if( pArg ){
        pArg->cMode = pArg->mode;
        if( pArg->autoExplain
         && sqlite3_column_count(pStmt)==8
         && sqlite3_strlike("EXPLAIN%", zStmtSql,0)==0
        ){
          pArg->cMode = MODE_Explain;
        }

        /* If the shell is currently in ".explain" mode, gather the extra
        ** data required to add indents to the output.*/
        if( pArg->cMode==MODE_Explain ){
          explain_data_prepare(pArg, pStmt);
        }
      }

      exec_prepared_stmt(pArg, pStmt, xCallback);
      explain_data_delete(pArg);

      /* print usage stats if stats on */
      if( pArg && pArg->statsOn ){
        display_stats(db, pArg, 0);
      }

      /* print loop-counters if required */
      if( pArg && pArg->scanstatsOn ){
        display_scanstats(db, pArg);
      }

      /* Finalize the statement just executed. If this fails, save a
      ** copy of the error message. Otherwise, set zSql to point to the
      ** next statement to execute. */
      rc2 = sqlite3_finalize(pStmt);
      if( rc!=SQLITE_NOMEM ) rc = rc2;
      if( rc==SQLITE_OK ){
        zSql = zLeftover;
        while( IsSpace(zSql[0]) ) zSql++;
      }else if( pzErrMsg ){
        *pzErrMsg = save_err_msg(db);
      }

      /* clear saved stmt handle */
      if( pArg ){
        pArg->pStmt = NULL;
      }
    }
  } /* end while */

  return rc;
}


/*
** This is a different callback routine used for dumping the database.
** Each row received by this callback consists of a table name,
** the table type ("index" or "table") and SQL to create the table.
** This routine should print text sufficient to recreate the table.
*/
static int dump_callback(void *pArg, int nArg, char **azArg, char **azCol){
  int rc;
  const char *zTable;
  const char *zType;
  const char *zSql;
  const char *zPrepStmt = 0;
  ShellState *p = (ShellState *)pArg;

  UNUSED_PARAMETER(azCol);
  if( nArg!=3 ) return 1;
  zTable = azArg[0];
  zType = azArg[1];
  zSql = azArg[2];

  if( strcmp(zTable, "sqlite_sequence")==0 ){
    zPrepStmt = "DELETE FROM sqlite_sequence;\n";
  }else if( sqlite3_strglob("sqlite_stat?", zTable)==0 ){
    raw_printf(p->out, "ANALYZE sqlite_master;\n");
  }else if( strncmp(zTable, "sqlite_", 7)==0 ){
    return 0;
  }else if( strncmp(zSql, "CREATE VIRTUAL TABLE", 20)==0 ){
    char *zIns;
    if( !p->writableSchema ){
      raw_printf(p->out, "PRAGMA writable_schema=ON;\n");
      p->writableSchema = 1;
    }
    zIns = sqlite3_mprintf(
       "INSERT INTO sqlite_master(type,name,tbl_name,rootpage,sql)"
       "VALUES('table','%q','%q',0,'%q');",
       zTable, zTable, zSql);
    utf8_printf(p->out, "%s\n", zIns);
    sqlite3_free(zIns);
    return 0;
  }else{
    utf8_printf(p->out, "%s;\n", zSql);
  }

  if( strcmp(zType, "table")==0 ){
    sqlite3_stmt *pTableInfo = 0;
    char *zSelect = 0;
    char *zTableInfo = 0;
    char *zTmp = 0;
    int nRow = 0;

    zTableInfo = appendText(zTableInfo, "PRAGMA table_info(", 0);
    zTableInfo = appendText(zTableInfo, zTable, '"');
    zTableInfo = appendText(zTableInfo, ");", 0);

    rc = sqlite3_prepare_v2(p->db, zTableInfo, -1, &pTableInfo, 0);
    free(zTableInfo);
    if( rc!=SQLITE_OK || !pTableInfo ){
      return 1;
    }

    zSelect = appendText(zSelect, "SELECT 'INSERT INTO ' || ", 0);
    /* Always quote the table name, even if it appears to be pure ascii,
    ** in case it is a keyword. Ex:  INSERT INTO "table" ... */
    zTmp = appendText(zTmp, zTable, '"');
    if( zTmp ){
      zSelect = appendText(zSelect, zTmp, '\'');
      free(zTmp);
    }
    zSelect = appendText(zSelect, " || ' VALUES(' || ", 0);
    rc = sqlite3_step(pTableInfo);
    while( rc==SQLITE_ROW ){
      const char *zText = (const char *)sqlite3_column_text(pTableInfo, 1);
      zSelect = appendText(zSelect, "quote(", 0);
      zSelect = appendText(zSelect, zText, '"');
      rc = sqlite3_step(pTableInfo);
      if( rc==SQLITE_ROW ){
        zSelect = appendText(zSelect, "), ", 0);
      }else{
        zSelect = appendText(zSelect, ") ", 0);
      }
      nRow++;
    }
    rc = sqlite3_finalize(pTableInfo);
    if( rc!=SQLITE_OK || nRow==0 ){
      free(zSelect);
      return 1;
    }
    zSelect = appendText(zSelect, "|| ')' FROM  ", 0);
    zSelect = appendText(zSelect, zTable, '"');

    rc = run_table_dump_query(p, zSelect, zPrepStmt);
    if( rc==SQLITE_CORRUPT ){
      zSelect = appendText(zSelect, " ORDER BY rowid DESC", 0);
      run_table_dump_query(p, zSelect, 0);
    }
    free(zSelect);
  }
  return 0;
}

/*
** Run zQuery.  Use dump_callback() as the callback routine so that
** the contents of the query are output as SQL statements.
**
** If we get a SQLITE_CORRUPT error, rerun the query after appending
** "ORDER BY rowid DESC" to the end.
*/
static int run_schema_dump_query(
  ShellState *p,
  const char *zQuery
){
  int rc;
  char *zErr = 0;
  rc = sqlite3_exec(p->db, zQuery, dump_callback, p, &zErr);
  if( rc==SQLITE_CORRUPT ){
    char *zQ2;
    int len = strlen30(zQuery);
    raw_printf(p->out, "/****** CORRUPTION ERROR *******/\n");
    if( zErr ){
      utf8_printf(p->out, "/****** %s ******/\n", zErr);
      sqlite3_free(zErr);
      zErr = 0;
    }
    zQ2 = malloc( len+100 );
    if( zQ2==0 ) return rc;
    sqlite3_snprintf(len+100, zQ2, "%s ORDER BY rowid DESC", zQuery);
    rc = sqlite3_exec(p->db, zQ2, dump_callback, p, &zErr);
    if( rc ){
      utf8_printf(p->out, "/****** ERROR: %s ******/\n", zErr);
    }else{
      rc = SQLITE_CORRUPT;
    }
    sqlite3_free(zErr);
    free(zQ2);
  }
  return rc;
}

/*
** Text of a help message
*/
static char zHelp[] =
  ".auth ON|OFF           Show authorizer callbacks\n"
  ".backup ?DB? FILE      Backup DB (default \"main\") to FILE\n"
  ".bail on|off           Stop after hitting an error.  Default OFF\n"
  ".binary on|off         Turn binary output on or off.  Default OFF\n"
  ".changes on|off        Show number of rows changed by SQL\n"
  ".clone NEWDB           Clone data into NEWDB from the existing database\n"
  ".databases             List names and files of attached databases\n"
  ".dbinfo ?DB?           Show status information about the database\n"
  ".dump ?TABLE? ...      Dump the database in an SQL text format\n"
  "                         If TABLE specified, only dump tables matching\n"
  "                         LIKE pattern TABLE.\n"
  ".echo on|off           Turn command echo on or off\n"
  ".eqp on|off|full       Enable or disable automatic EXPLAIN QUERY PLAN\n"
  ".exit                  Exit this program\n"
  ".explain ?on|off|auto? Turn EXPLAIN output mode on or off or to automatic\n"
  ".fullschema ?--indent? Show schema and the content of sqlite_stat tables\n"
  ".headers on|off        Turn display of headers on or off\n"
  ".help                  Show this message\n"
  ".import FILE TABLE     Import data from FILE into TABLE\n"
  ".indexes ?TABLE?       Show names of all indexes\n"
  "                         If TABLE specified, only show indexes for tables\n"
  "                         matching LIKE pattern TABLE.\n"
#ifdef SQLITE_ENABLE_IOTRACE
  ".iotrace FILE          Enable I/O diagnostic logging to FILE\n"
#endif
  ".limit ?LIMIT? ?VAL?   Display or change the value of an SQLITE_LIMIT\n"
#ifndef SQLITE_OMIT_LOAD_EXTENSION
  ".load FILE ?ENTRY?     Load an extension library\n"
#endif
  ".log FILE|off          Turn logging on or off.  FILE can be stderr/stdout\n"
  ".mode MODE ?TABLE?     Set output mode where MODE is one of:\n"
  "                         ascii    Columns/rows delimited by 0x1F and 0x1E\n"
  "                         csv      Comma-separated values\n"
  "                         column   Left-aligned columns.  (See .width)\n"
  "                         html     HTML <table> code\n"
  "                         insert   SQL insert statements for TABLE\n"
  "                         line     One value per line\n"
  "                         list     Values delimited by .separator strings\n"
  "                         tabs     Tab-separated values\n"
  "                         tcl      TCL list elements\n"
  ".nullvalue STRING      Use STRING in place of NULL values\n"
  ".once FILENAME         Output for the next SQL command only to FILENAME\n"
  ".open ?FILENAME?       Close existing database and reopen FILENAME\n"
  ".output ?FILENAME?     Send output to FILENAME or stdout\n"
  ".print STRING...       Print literal STRING\n"
  ".prompt MAIN CONTINUE  Replace the standard prompts\n"
  ".quit                  Exit this program\n"
  ".read FILENAME         Execute SQL in FILENAME\n"
  ".restore ?DB? FILE     Restore content of DB (default \"main\") from FILE\n"
  ".save FILE             Write in-memory database into FILE\n"
  ".scanstats on|off      Turn sqlite3_stmt_scanstatus() metrics on or off\n"
  ".schema ?PATTERN?      Show the CREATE statements matching PATTERN\n"
  "                          Add --indent for pretty-printing\n"
  ".separator COL ?ROW?   Change the column separator and optionally the row\n"
  "                         separator for both the output mode and .import\n"
#if defined(SQLITE_ENABLE_SESSION)
  ".session CMD ...       Create or control sessions\n"
#endif
  ".shell CMD ARGS...     Run CMD ARGS... in a system shell\n"
  ".show                  Show the current values for various settings\n"
  ".stats ?on|off?        Show stats or turn stats on or off\n"
  ".system CMD ARGS...    Run CMD ARGS... in a system shell\n"
  ".tables ?TABLE?        List names of tables\n"
  "                         If TABLE specified, only list tables matching\n"
  "                         LIKE pattern TABLE.\n"
  ".timeout MS            Try opening locked tables for MS milliseconds\n"
  ".timer on|off          Turn SQL timer on or off\n"
  ".trace FILE|off        Output each SQL statement as it is run\n"
  ".vfsinfo ?AUX?         Information about the top-level VFS\n"
  ".vfslist               List all available VFSes\n"
  ".vfsname ?AUX?         Print the name of the VFS stack\n"
  ".width NUM1 NUM2 ...   Set column widths for \"column\" mode\n"
  "                         Negative values right-justify\n"
;

#if defined(SQLITE_ENABLE_SESSION)
/*
** Print help information for the ".sessions" command
*/
void session_help(ShellState *p){
  raw_printf(p->out,
    ".session ?NAME? SUBCOMMAND ?ARGS...?\n"
    "If ?NAME? is omitted, the first defined session is used.\n"
    "Subcommands:\n"
    "   attach TABLE             Attach TABLE\n"
    "   changeset FILE           Write a changeset into FILE\n"
    "   close                    Close one session\n"
    "   enable ?BOOLEAN?         Set or query the enable bit\n"
    "   filter GLOB...           Reject tables matching GLOBs\n"
    "   indirect ?BOOLEAN?       Mark or query the indirect status\n"
    "   isempty                  Query whether the session is empty\n"
    "   list                     List currently open session names\n"
    "   open DB NAME             Open a new session on DB\n"
    "   patchset FILE            Write a patchset into FILE\n"
  );
}
#endif


/* Forward reference */
static int process_input(ShellState *p, FILE *in);
/*
** Implementation of the "readfile(X)" SQL function.  The entire content
** of the file named X is read and returned as a BLOB.  NULL is returned
** if the file does not exist or is unreadable.
*/
static void readfileFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  const char *zName;
  FILE *in;
  long nIn;
  void *pBuf;

  UNUSED_PARAMETER(argc);
  zName = (const char*)sqlite3_value_text(argv[0]);
  if( zName==0 ) return;
  in = fopen(zName, "rb");
  if( in==0 ) return;
  fseek(in, 0, SEEK_END);
  nIn = ftell(in);
  rewind(in);
  pBuf = sqlite3_malloc64( nIn );
  if( pBuf && 1==fread(pBuf, nIn, 1, in) ){
    sqlite3_result_blob(context, pBuf, nIn, sqlite3_free);
  }else{
    sqlite3_free(pBuf);
  }
  fclose(in);
}

/*
** Implementation of the "writefile(X,Y)" SQL function.  The argument Y
** is written into file X.  The number of bytes written is returned.  Or
** NULL is returned if something goes wrong, such as being unable to open
** file X for writing.
*/
static void writefileFunc(
  sqlite3_context *context,
  int argc,
  sqlite3_value **argv
){
  FILE *out;
  const char *z;
  sqlite3_int64 rc;
  const char *zFile;

  UNUSED_PARAMETER(argc);
  zFile = (const char*)sqlite3_value_text(argv[0]);
  if( zFile==0 ) return;
  out = fopen(zFile, "wb");
  if( out==0 ) return;
  z = (const char*)sqlite3_value_blob(argv[1]);
  if( z==0 ){
    rc = 0;
  }else{
    rc = fwrite(z, 1, sqlite3_value_bytes(argv[1]), out);
  }
  fclose(out);
  sqlite3_result_int64(context, rc);
}

#if defined(SQLITE_ENABLE_SESSION)
/*
** Close a single OpenSession object and release all of its associated
** resources.
*/
static void session_close(OpenSession *pSession){
  int i;
  sqlite3session_delete(pSession->p);
  sqlite3_free(pSession->zName);
  for(i=0; i<pSession->nFilter; i++){
    sqlite3_free(pSession->azFilter[i]);
  }
  sqlite3_free(pSession->azFilter);
  memset(pSession, 0, sizeof(OpenSession));
}
#endif

/*
** Close all OpenSession objects and release all associated resources.
*/
#if defined(SQLITE_ENABLE_SESSION)
static void session_close_all(ShellState *p){
  int i;
  for(i=0; i<p->nSession; i++){
    session_close(&p->aSession[i]);
  }
  p->nSession = 0;
}
#else
# define session_close_all(X)
#endif

/*
** Implementation of the xFilter function for an open session.  Omit
** any tables named by ".session filter" but let all other table through.
*/
#if defined(SQLITE_ENABLE_SESSION)
static int session_filter(void *pCtx, const char *zTab){
  OpenSession *pSession = (OpenSession*)pCtx;
  int i;
  for(i=0; i<pSession->nFilter; i++){
    if( sqlite3_strglob(pSession->azFilter[i], zTab)==0 ) return 0;
  }
  return 1;
}
#endif

/*
** Make sure the database is open.  If it is not, then open it.  If
** the database fails to open, print an error message and exit.
*/
static void open_db(ShellState *p, int keepAlive){
  if( p->db==0 ){
    sqlite3_initialize();
    sqlite3_open(p->zDbFilename, &p->db);
    globalDb = p->db;
    if( p->db && sqlite3_errcode(p->db)==SQLITE_OK ){
      sqlite3_create_function(p->db, "shellstatic", 0, SQLITE_UTF8, 0,
          shellstaticFunc, 0, 0);
    }
    if( p->db==0 || SQLITE_OK!=sqlite3_errcode(p->db) ){
      utf8_printf(stderr,"Error: unable to open database \"%s\": %s\n",
          p->zDbFilename, sqlite3_errmsg(p->db));
      if( keepAlive ) return;
      exit(1);
    }
#ifndef SQLITE_OMIT_LOAD_EXTENSION
    sqlite3_enable_load_extension(p->db, 1);
#endif
    sqlite3_create_function(p->db, "readfile", 1, SQLITE_UTF8, 0,
                            readfileFunc, 0, 0);
    sqlite3_create_function(p->db, "writefile", 2, SQLITE_UTF8, 0,
                            writefileFunc, 0, 0);
  }
}

/*
** Do C-language style dequoting.
**
**    \a    -> alarm
**    \b    -> backspace
**    \t    -> tab
**    \n    -> newline
**    \v    -> vertical tab
**    \f    -> form feed
**    \r    -> carriage return
**    \s    -> space
**    \"    -> "
**    \'    -> '
**    \\    -> backslash
**    \NNN  -> ascii character NNN in octal
*/
static void resolve_backslashes(char *z){
  int i, j;
  char c;
  while( *z && *z!='\\' ) z++;
  for(i=j=0; (c = z[i])!=0; i++, j++){
    if( c=='\\' && z[i+1]!=0 ){
      c = z[++i];
      if( c=='a' ){
        c = '\a';
      }else if( c=='b' ){
        c = '\b';
      }else if( c=='t' ){
        c = '\t';
      }else if( c=='n' ){
        c = '\n';
      }else if( c=='v' ){
        c = '\v';
      }else if( c=='f' ){
        c = '\f';
      }else if( c=='r' ){
        c = '\r';
      }else if( c=='"' ){
        c = '"';
      }else if( c=='\'' ){
        c = '\'';
      }else if( c=='\\' ){
        c = '\\';
      }else if( c>='0' && c<='7' ){
        c -= '0';
        if( z[i+1]>='0' && z[i+1]<='7' ){
          i++;
          c = (c<<3) + z[i] - '0';
          if( z[i+1]>='0' && z[i+1]<='7' ){
            i++;
            c = (c<<3) + z[i] - '0';
          }
        }
      }
    }
    z[j] = c;
  }
  if( j<i ) z[j] = 0;
}

/*
** Return the value of a hexadecimal digit.  Return -1 if the input
** is not a hex digit.
*/
static int hexDigitValue(char c){
  if( c>='0' && c<='9' ) return c - '0';
  if( c>='a' && c<='f' ) return c - 'a' + 10;
  if( c>='A' && c<='F' ) return c - 'A' + 10;
  return -1;
}

/*
** Interpret zArg as an integer value, possibly with suffixes.
*/
static sqlite3_int64 integerValue(const char *zArg){
  sqlite3_int64 v = 0;
  static const struct { char *zSuffix; int iMult; } aMult[] = {
    { "KiB", 1024 },
    { "MiB", 1024*1024 },
    { "GiB", 1024*1024*1024 },
    { "KB",  1000 },
    { "MB",  1000000 },
    { "GB",  1000000000 },
    { "K",   1000 },
    { "M",   1000000 },
    { "G",   1000000000 },
  };
  int i;
  int isNeg = 0;
  if( zArg[0]=='-' ){
    isNeg = 1;
    zArg++;
  }else if( zArg[0]=='+' ){
    zArg++;
  }
  if( zArg[0]=='0' && zArg[1]=='x' ){
    int x;
    zArg += 2;
    while( (x = hexDigitValue(zArg[0]))>=0 ){
      v = (v<<4) + x;
      zArg++;
    }
  }else{
    while( IsDigit(zArg[0]) ){
      v = v*10 + zArg[0] - '0';
      zArg++;
    }
  }
  for(i=0; i<ArraySize(aMult); i++){
    if( sqlite3_stricmp(aMult[i].zSuffix, zArg)==0 ){
      v *= aMult[i].iMult;
      break;
    }
  }
  return isNeg? -v : v;
}

/*
** Interpret zArg as either an integer or a boolean value.  Return 1 or 0
** for TRUE and FALSE.  Return the integer value if appropriate.
*/
static int booleanValue(char *zArg){
  int i;
  if( zArg[0]=='0' && zArg[1]=='x' ){
    for(i=2; hexDigitValue(zArg[i])>=0; i++){}
  }else{
    for(i=0; zArg[i]>='0' && zArg[i]<='9'; i++){}
  }
  if( i>0 && zArg[i]==0 ) return (int)(integerValue(zArg) & 0xffffffff);
  if( sqlite3_stricmp(zArg, "on")==0 || sqlite3_stricmp(zArg,"yes")==0 ){
    return 1;
  }
  if( sqlite3_stricmp(zArg, "off")==0 || sqlite3_stricmp(zArg,"no")==0 ){
    return 0;
  }
  utf8_printf(stderr, "ERROR: Not a boolean value: \"%s\". Assuming \"no\".\n",
          zArg);
  return 0;
}

/*
** Close an output file, assuming it is not stderr or stdout
*/
static void output_file_close(FILE *f){
  if( f && f!=stdout && f!=stderr ) fclose(f);
}

/*
** Try to open an output file.   The names "stdout" and "stderr" are
** recognized and do the right thing.  NULL is returned if the output
** filename is "off".
*/
static FILE *output_file_open(const char *zFile){
  FILE *f;
  if( strcmp(zFile,"stdout")==0 ){
    f = stdout;
  }else if( strcmp(zFile, "stderr")==0 ){
    f = stderr;
  }else if( strcmp(zFile, "off")==0 ){
    f = 0;
  }else{
    f = fopen(zFile, "wb");
    if( f==0 ){
      utf8_printf(stderr, "Error: cannot open \"%s\"\n", zFile);
    }
  }
  return f;
}

/*
** A routine for handling output from sqlite3_trace().
*/
static void sql_trace_callback(void *pArg, const char *z){
  FILE *f = (FILE*)pArg;
  if( f ){
    int i = (int)strlen(z);
    while( i>0 && z[i-1]==';' ){ i--; }
    utf8_printf(f, "%.*s;\n", i, z);
  }
}

/*
** A no-op routine that runs with the ".breakpoint" doc-command.  This is
** a useful spot to set a debugger breakpoint.
*/
static void test_breakpoint(void){
  static int nCall = 0;
  nCall++;
}

/*
** An object used to read a CSV and other files for import.
*/
typedef struct ImportCtx ImportCtx;
struct ImportCtx {
  const char *zFile;  /* Name of the input file */
  FILE *in;           /* Read the CSV text from this input stream */
  char *z;            /* Accumulated text for a field */
  int n;              /* Number of bytes in z */
  int nAlloc;         /* Space allocated for z[] */
  int nLine;          /* Current line number */
  int cTerm;          /* Character that terminated the most recent field */
  int cColSep;        /* The column separator character.  (Usually ",") */
  int cRowSep;        /* The row separator character.  (Usually "\n") */
};

/* Append a single byte to z[] */
static void import_append_char(ImportCtx *p, int c){
  if( p->n+1>=p->nAlloc ){
    p->nAlloc += p->nAlloc + 100;
    p->z = sqlite3_realloc64(p->z, p->nAlloc);
    if( p->z==0 ){
      raw_printf(stderr, "out of memory\n");
      exit(1);
    }
  }
  p->z[p->n++] = (char)c;
}

/* Read a single field of CSV text.  Compatible with rfc4180 and extended
** with the option of having a separator other than ",".
**
**   +  Input comes from p->in.
**   +  Store results in p->z of length p->n.  Space to hold p->z comes
**      from sqlite3_malloc64().
**   +  Use p->cSep as the column separator.  The default is ",".
**   +  Use p->rSep as the row separator.  The default is "\n".
**   +  Keep track of the line number in p->nLine.
**   +  Store the character that terminates the field in p->cTerm.  Store
**      EOF on end-of-file.
**   +  Report syntax errors on stderr
*/
static char *SQLITE_CDECL csv_read_one_field(ImportCtx *p){
  int c;
  int cSep = p->cColSep;
  int rSep = p->cRowSep;
  p->n = 0;
  c = fgetc(p->in);
  if( c==EOF || seenInterrupt ){
    p->cTerm = EOF;
    return 0;
  }
  if( c=='"' ){
    int pc, ppc;
    int startLine = p->nLine;
    int cQuote = c;
    pc = ppc = 0;
    while( 1 ){
      c = fgetc(p->in);
      if( c==rSep ) p->nLine++;
      if( c==cQuote ){
        if( pc==cQuote ){
          pc = 0;
          continue;
        }
      }
      if( (c==cSep && pc==cQuote)
       || (c==rSep && pc==cQuote)
       || (c==rSep && pc=='\r' && ppc==cQuote)
       || (c==EOF && pc==cQuote)
      ){
        do{ p->n--; }while( p->z[p->n]!=cQuote );
        p->cTerm = c;
        break;
      }
      if( pc==cQuote && c!='\r' ){
        utf8_printf(stderr, "%s:%d: unescaped %c character\n",
                p->zFile, p->nLine, cQuote);
      }
      if( c==EOF ){
        utf8_printf(stderr, "%s:%d: unterminated %c-quoted field\n",
                p->zFile, startLine, cQuote);
        p->cTerm = c;
        break;
      }
      import_append_char(p, c);
      ppc = pc;
      pc = c;
    }
  }else{
    while( c!=EOF && c!=cSep && c!=rSep ){
      import_append_char(p, c);
      c = fgetc(p->in);
    }
    if( c==rSep ){
      p->nLine++;
      if( p->n>0 && p->z[p->n-1]=='\r' ) p->n--;
    }
    p->cTerm = c;
  }
  if( p->z ) p->z[p->n] = 0;
  return p->z;
}

/* Read a single field of ASCII delimited text.
**
**   +  Input comes from p->in.
**   +  Store results in p->z of length p->n.  Space to hold p->z comes
**      from sqlite3_malloc64().
**   +  Use p->cSep as the column separator.  The default is "\x1F".
**   +  Use p->rSep as the row separator.  The default is "\x1E".
**   +  Keep track of the row number in p->nLine.
**   +  Store the character that terminates the field in p->cTerm.  Store
**      EOF on end-of-file.
**   +  Report syntax errors on stderr
*/
static char *SQLITE_CDECL ascii_read_one_field(ImportCtx *p){
  int c;
  int cSep = p->cColSep;
  int rSep = p->cRowSep;
  p->n = 0;
  c = fgetc(p->in);
  if( c==EOF || seenInterrupt ){
    p->cTerm = EOF;
    return 0;
  }
  while( c!=EOF && c!=cSep && c!=rSep ){
    import_append_char(p, c);
    c = fgetc(p->in);
  }
  if( c==rSep ){
    p->nLine++;
  }
  p->cTerm = c;
  if( p->z ) p->z[p->n] = 0;
  return p->z;
}

/*
** Try to transfer data for table zTable.  If an error is seen while
** moving forward, try to go backwards.  The backwards movement won't
** work for WITHOUT ROWID tables.
*/
static void tryToCloneData(
  ShellState *p,
  sqlite3 *newDb,
  const char *zTable
){
  sqlite3_stmt *pQuery = 0;
  sqlite3_stmt *pInsert = 0;
  char *zQuery = 0;
  char *zInsert = 0;
  int rc;
  int i, j, n;
  int nTable = (int)strlen(zTable);
  int k = 0;
  int cnt = 0;
  const int spinRate = 10000;

  zQuery = sqlite3_mprintf("SELECT * FROM \"%w\"", zTable);
  rc = sqlite3_prepare_v2(p->db, zQuery, -1, &pQuery, 0);
  if( rc ){
    utf8_printf(stderr, "Error %d: %s on [%s]\n",
            sqlite3_extended_errcode(p->db), sqlite3_errmsg(p->db),
            zQuery);
    goto end_data_xfer;
  }
  n = sqlite3_column_count(pQuery);
  zInsert = sqlite3_malloc64(200 + nTable + n*3);
  if( zInsert==0 ){
    raw_printf(stderr, "out of memory\n");
    goto end_data_xfer;
  }
  sqlite3_snprintf(200+nTable,zInsert,
                   "INSERT OR IGNORE INTO \"%s\" VALUES(?", zTable);
  i = (int)strlen(zInsert);
  for(j=1; j<n; j++){
    memcpy(zInsert+i, ",?", 2);
    i += 2;
  }
  memcpy(zInsert+i, ");", 3);
  rc = sqlite3_prepare_v2(newDb, zInsert, -1, &pInsert, 0);
  if( rc ){
    utf8_printf(stderr, "Error %d: %s on [%s]\n",
            sqlite3_extended_errcode(newDb), sqlite3_errmsg(newDb),
            zQuery);
    goto end_data_xfer;
  }
  for(k=0; k<2; k++){
    while( (rc = sqlite3_step(pQuery))==SQLITE_ROW ){
      for(i=0; i<n; i++){
        switch( sqlite3_column_type(pQuery, i) ){
          case SQLITE_NULL: {
            sqlite3_bind_null(pInsert, i+1);
            break;
          }
          case SQLITE_INTEGER: {
            sqlite3_bind_int64(pInsert, i+1, sqlite3_column_int64(pQuery,i));
            break;
          }
          case SQLITE_FLOAT: {
            sqlite3_bind_double(pInsert, i+1, sqlite3_column_double(pQuery,i));
            break;
          }
          case SQLITE_TEXT: {
            sqlite3_bind_text(pInsert, i+1,
                             (const char*)sqlite3_column_text(pQuery,i),
                             -1, SQLITE_STATIC);
            break;
          }
          case SQLITE_BLOB: {
            sqlite3_bind_blob(pInsert, i+1, sqlite3_column_blob(pQuery,i),
                                            sqlite3_column_bytes(pQuery,i),
                                            SQLITE_STATIC);
            break;
          }
        }
      } /* End for */
      rc = sqlite3_step(pInsert);
      if( rc!=SQLITE_OK && rc!=SQLITE_ROW && rc!=SQLITE_DONE ){
        utf8_printf(stderr, "Error %d: %s\n", sqlite3_extended_errcode(newDb),
                        sqlite3_errmsg(newDb));
      }
      sqlite3_reset(pInsert);
      cnt++;
      if( (cnt%spinRate)==0 ){
        printf("%c\b", "|/-\\"[(cnt/spinRate)%4]);
        fflush(stdout);
      }
    } /* End while */
    if( rc==SQLITE_DONE ) break;
    sqlite3_finalize(pQuery);
    sqlite3_free(zQuery);
    zQuery = sqlite3_mprintf("SELECT * FROM \"%w\" ORDER BY rowid DESC;",
                             zTable);
    rc = sqlite3_prepare_v2(p->db, zQuery, -1, &pQuery, 0);
    if( rc ){
      utf8_printf(stderr, "Warning: cannot step \"%s\" backwards", zTable);
      break;
    }
  } /* End for(k=0...) */

end_data_xfer:
  sqlite3_finalize(pQuery);
  sqlite3_finalize(pInsert);
  sqlite3_free(zQuery);
  sqlite3_free(zInsert);
}


/*
** Try to transfer all rows of the schema that match zWhere.  For
** each row, invoke xForEach() on the object defined by that row.
** If an error is encountered while moving forward through the
** sqlite_master table, try again moving backwards.
*/
static void tryToCloneSchema(
  ShellState *p,
  sqlite3 *newDb,
  const char *zWhere,
  void (*xForEach)(ShellState*,sqlite3*,const char*)
){
  sqlite3_stmt *pQuery = 0;
  char *zQuery = 0;
  int rc;
  const unsigned char *zName;
  const unsigned char *zSql;
  char *zErrMsg = 0;

  zQuery = sqlite3_mprintf("SELECT name, sql FROM sqlite_master"
                           " WHERE %s", zWhere);
  rc = sqlite3_prepare_v2(p->db, zQuery, -1, &pQuery, 0);
  if( rc ){
    utf8_printf(stderr, "Error: (%d) %s on [%s]\n",
                    sqlite3_extended_errcode(p->db), sqlite3_errmsg(p->db),
                    zQuery);
    goto end_schema_xfer;
  }
  while( (rc = sqlite3_step(pQuery))==SQLITE_ROW ){
    zName = sqlite3_column_text(pQuery, 0);
    zSql = sqlite3_column_text(pQuery, 1);
    printf("%s... ", zName); fflush(stdout);
    sqlite3_exec(newDb, (const char*)zSql, 0, 0, &zErrMsg);
    if( zErrMsg ){
      utf8_printf(stderr, "Error: %s\nSQL: [%s]\n", zErrMsg, zSql);
      sqlite3_free(zErrMsg);
      zErrMsg = 0;
    }
    if( xForEach ){
      xForEach(p, newDb, (const char*)zName);
    }
    printf("done\n");
  }
  if( rc!=SQLITE_DONE ){
    sqlite3_finalize(pQuery);
    sqlite3_free(zQuery);
    zQuery = sqlite3_mprintf("SELECT name, sql FROM sqlite_master"
                             " WHERE %s ORDER BY rowid DESC", zWhere);
    rc = sqlite3_prepare_v2(p->db, zQuery, -1, &pQuery, 0);
    if( rc ){
      utf8_printf(stderr, "Error: (%d) %s on [%s]\n",
                      sqlite3_extended_errcode(p->db), sqlite3_errmsg(p->db),
                      zQuery);
      goto end_schema_xfer;
    }
    while( (rc = sqlite3_step(pQuery))==SQLITE_ROW ){
      zName = sqlite3_column_text(pQuery, 0);
      zSql = sqlite3_column_text(pQuery, 1);
      printf("%s... ", zName); fflush(stdout);
      sqlite3_exec(newDb, (const char*)zSql, 0, 0, &zErrMsg);
      if( zErrMsg ){
        utf8_printf(stderr, "Error: %s\nSQL: [%s]\n", zErrMsg, zSql);
        sqlite3_free(zErrMsg);
        zErrMsg = 0;
      }
      if( xForEach ){
        xForEach(p, newDb, (const char*)zName);
      }
      printf("done\n");
    }
  }
end_schema_xfer:
  sqlite3_finalize(pQuery);
  sqlite3_free(zQuery);
}

/*
** Open a new database file named "zNewDb".  Try to recover as much information
** as possible out of the main database (which might be corrupt) and write it
** into zNewDb.
*/
static void tryToClone(ShellState *p, const char *zNewDb){
  int rc;
  sqlite3 *newDb = 0;
  if( access(zNewDb,0)==0 ){
    utf8_printf(stderr, "File \"%s\" already exists.\n", zNewDb);
    return;
  }
  rc = sqlite3_open(zNewDb, &newDb);
  if( rc ){
    utf8_printf(stderr, "Cannot create output database: %s\n",
            sqlite3_errmsg(newDb));
  }else{
    sqlite3_exec(p->db, "PRAGMA writable_schema=ON;", 0, 0, 0);
    sqlite3_exec(newDb, "BEGIN EXCLUSIVE;", 0, 0, 0);
    tryToCloneSchema(p, newDb, "type='table'", tryToCloneData);
    tryToCloneSchema(p, newDb, "type!='table'", 0);
    sqlite3_exec(newDb, "COMMIT;", 0, 0, 0);
    sqlite3_exec(p->db, "PRAGMA writable_schema=OFF;", 0, 0, 0);
  }
  sqlite3_close(newDb);
}

/*
** Change the output file back to stdout
*/
static void output_reset(ShellState *p){
  if( p->outfile[0]=='|' ){
#ifndef SQLITE_OMIT_POPEN
    pclose(p->out);
#endif
  }else{
    output_file_close(p->out);
  }
  p->outfile[0] = 0;
  p->out = stdout;
}

/*
** Run an SQL command and return the single integer result.
*/
static int db_int(ShellState *p, const char *zSql){
  sqlite3_stmt *pStmt;
  int res = 0;
  sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0);
  if( pStmt && sqlite3_step(pStmt)==SQLITE_ROW ){
    res = sqlite3_column_int(pStmt,0);
  }
  sqlite3_finalize(pStmt);
  return res;
}

/*
** Convert a 2-byte or 4-byte big-endian integer into a native integer
*/
unsigned int get2byteInt(unsigned char *a){
  return (a[0]<<8) + a[1];
}
unsigned int get4byteInt(unsigned char *a){
  return (a[0]<<24) + (a[1]<<16) + (a[2]<<8) + a[3];
}

/*
** Implementation of the ".info" command.
**
** Return 1 on error, 2 to exit, and 0 otherwise.
*/
static int shell_dbinfo_command(ShellState *p, int nArg, char **azArg){
  static const struct { const char *zName; int ofst; } aField[] = {
     { "file change counter:",  24  },
     { "database page count:",  28  },
     { "freelist page count:",  36  },
     { "schema cookie:",        40  },
     { "schema format:",        44  },
     { "default cache size:",   48  },
     { "autovacuum top root:",  52  },
     { "incremental vacuum:",   64  },
     { "text encoding:",        56  },
     { "user version:",         60  },
     { "application id:",       68  },
     { "software version:",     96  },
  };
  static const struct { const char *zName; const char *zSql; } aQuery[] = {
     { "number of tables:",
       "SELECT count(*) FROM %s WHERE type='table'" },
     { "number of indexes:",
       "SELECT count(*) FROM %s WHERE type='index'" },
     { "number of triggers:",
       "SELECT count(*) FROM %s WHERE type='trigger'" },
     { "number of views:",
       "SELECT count(*) FROM %s WHERE type='view'" },
     { "schema size:",
       "SELECT total(length(sql)) FROM %s" },
  };
  sqlite3_file *pFile = 0;
  int i;
  char *zSchemaTab;
  char *zDb = nArg>=2 ? azArg[1] : "main";
  unsigned char aHdr[100];
  open_db(p, 0);
  if( p->db==0 ) return 1;
  sqlite3_file_control(p->db, zDb, SQLITE_FCNTL_FILE_POINTER, &pFile);
  if( pFile==0 || pFile->pMethods==0 || pFile->pMethods->xRead==0 ){
    return 1;
  }
  i = pFile->pMethods->xRead(pFile, aHdr, 100, 0);
  if( i!=SQLITE_OK ){
    raw_printf(stderr, "unable to read database header\n");
    return 1;
  }
  i = get2byteInt(aHdr+16);
  if( i==1 ) i = 65536;
  utf8_printf(p->out, "%-20s %d\n", "database page size:", i);
  utf8_printf(p->out, "%-20s %d\n", "write format:", aHdr[18]);
  utf8_printf(p->out, "%-20s %d\n", "read format:", aHdr[19]);
  utf8_printf(p->out, "%-20s %d\n", "reserved bytes:", aHdr[20]);
  for(i=0; i<ArraySize(aField); i++){
    int ofst = aField[i].ofst;
    unsigned int val = get4byteInt(aHdr + ofst);
    utf8_printf(p->out, "%-20s %u", aField[i].zName, val);
    switch( ofst ){
      case 56: {
        if( val==1 ) raw_printf(p->out, " (utf8)");
        if( val==2 ) raw_printf(p->out, " (utf16le)");
        if( val==3 ) raw_printf(p->out, " (utf16be)");
      }
    }
    raw_printf(p->out, "\n");
  }
  if( zDb==0 ){
    zSchemaTab = sqlite3_mprintf("main.sqlite_master");
  }else if( strcmp(zDb,"temp")==0 ){
    zSchemaTab = sqlite3_mprintf("%s", "sqlite_temp_master");
  }else{
    zSchemaTab = sqlite3_mprintf("\"%w\".sqlite_master", zDb);
  }
  for(i=0; i<ArraySize(aQuery); i++){
    char *zSql = sqlite3_mprintf(aQuery[i].zSql, zSchemaTab);
    int val = db_int(p, zSql);
    sqlite3_free(zSql);
    utf8_printf(p->out, "%-20s %d\n", aQuery[i].zName, val);
  }
  sqlite3_free(zSchemaTab);
  return 0;
}

/*
** Print the current sqlite3_errmsg() value to stderr and return 1.
*/
static int shellDatabaseError(sqlite3 *db){
  const char *zErr = sqlite3_errmsg(db);
  utf8_printf(stderr, "Error: %s\n", zErr);
  return 1;
}

/*
** Print an out-of-memory message to stderr and return 1.
*/
static int shellNomemError(void){
  raw_printf(stderr, "Error: out of memory\n");
  return 1;
}

/*
** Compare the string as a command-line option with either one or two
** initial "-" characters.
*/
static int optionMatch(const char *zStr, const char *zOpt){
  if( zStr[0]!='-' ) return 0;
  zStr++;
  if( zStr[0]=='-' ) zStr++;
  return strcmp(zStr, zOpt)==0;
}

/*
** If an input line begins with "." then invoke this routine to
** process that line.
**
** Return 1 on error, 2 to exit, and 0 otherwise.
*/
static int do_meta_command(char *zLine, ShellState *p){
  int h = 1;
  int nArg = 0;
  int n, c;
  int rc = 0;
  char *azArg[50];

  /* Parse the input line into tokens.
  */
  while( zLine[h] && nArg<ArraySize(azArg) ){
    while( IsSpace(zLine[h]) ){ h++; }
    if( zLine[h]==0 ) break;
    if( zLine[h]=='\'' || zLine[h]=='"' ){
      int delim = zLine[h++];
      azArg[nArg++] = &zLine[h];
      while( zLine[h] && zLine[h]!=delim ){
        if( zLine[h]=='\\' && delim=='"' && zLine[h+1]!=0 ) h++;
        h++;
      }
      if( zLine[h]==delim ){
        zLine[h++] = 0;
      }
      if( delim=='"' ) resolve_backslashes(azArg[nArg-1]);
    }else{
      azArg[nArg++] = &zLine[h];
      while( zLine[h] && !IsSpace(zLine[h]) ){ h++; }
      if( zLine[h] ) zLine[h++] = 0;
      resolve_backslashes(azArg[nArg-1]);
    }
  }

  /* Process the input line.
  */
  if( nArg==0 ) return 0; /* no tokens, no error */
  n = strlen30(azArg[0]);
  c = azArg[0][0];

  if( c=='a' && strncmp(azArg[0], "auth", n)==0 ){
    if( nArg!=2 ){
      raw_printf(stderr, "Usage: .auth ON|OFF\n");
      rc = 1;
      goto meta_command_exit;
    }
    open_db(p, 0);
    if( booleanValue(azArg[1]) ){
      sqlite3_set_authorizer(p->db, shellAuth, p);
    }else{
      sqlite3_set_authorizer(p->db, 0, 0);
    }
  }else

  if( (c=='b' && n>=3 && strncmp(azArg[0], "backup", n)==0)
   || (c=='s' && n>=3 && strncmp(azArg[0], "save", n)==0)
  ){
    const char *zDestFile = 0;
    const char *zDb = 0;
    sqlite3 *pDest;
    sqlite3_backup *pBackup;
    int j;
    for(j=1; j<nArg; j++){
      const char *z = azArg[j];
      if( z[0]=='-' ){
        while( z[0]=='-' ) z++;
        /* No options to process at this time */
        {
          utf8_printf(stderr, "unknown option: %s\n", azArg[j]);
          return 1;
        }
      }else if( zDestFile==0 ){
        zDestFile = azArg[j];
      }else if( zDb==0 ){
        zDb = zDestFile;
        zDestFile = azArg[j];
      }else{
        raw_printf(stderr, "too many arguments to .backup\n");
        return 1;
      }
    }
    if( zDestFile==0 ){
      raw_printf(stderr, "missing FILENAME argument on .backup\n");
      return 1;
    }
    if( zDb==0 ) zDb = "main";
    rc = sqlite3_open(zDestFile, &pDest);
    if( rc!=SQLITE_OK ){
      utf8_printf(stderr, "Error: cannot open \"%s\"\n", zDestFile);
      sqlite3_close(pDest);
      return 1;
    }
    open_db(p, 0);
    pBackup = sqlite3_backup_init(pDest, "main", p->db, zDb);
    if( pBackup==0 ){
      utf8_printf(stderr, "Error: %s\n", sqlite3_errmsg(pDest));
      sqlite3_close(pDest);
      return 1;
    }
    while(  (rc = sqlite3_backup_step(pBackup,100))==SQLITE_OK ){}
    sqlite3_backup_finish(pBackup);
    if( rc==SQLITE_DONE ){
      rc = 0;
    }else{
      utf8_printf(stderr, "Error: %s\n", sqlite3_errmsg(pDest));
      rc = 1;
    }
    sqlite3_close(pDest);
  }else

  if( c=='b' && n>=3 && strncmp(azArg[0], "bail", n)==0 ){
    if( nArg==2 ){
      bail_on_error = booleanValue(azArg[1]);
    }else{
      raw_printf(stderr, "Usage: .bail on|off\n");
      rc = 1;
    }
  }else

  if( c=='b' && n>=3 && strncmp(azArg[0], "binary", n)==0 ){
    if( nArg==2 ){
      if( booleanValue(azArg[1]) ){
        setBinaryMode(p->out, 1);
      }else{
        setTextMode(p->out, 1);
      }
    }else{
      raw_printf(stderr, "Usage: .binary on|off\n");
      rc = 1;
    }
  }else

  /* The undocumented ".breakpoint" command causes a call to the no-op
  ** routine named test_breakpoint().
  */
  if( c=='b' && n>=3 && strncmp(azArg[0], "breakpoint", n)==0 ){
    test_breakpoint();
  }else

  if( c=='c' && n>=3 && s
Download .txt
gitextract_x8w7ov8e/

├── LICENSE
├── README.md
├── code/
│   ├── CmdLineParser.h
│   ├── Makefile
│   ├── TablePrinter.h
│   ├── main.cpp
│   ├── shell.c
│   ├── sqlite3.c
│   ├── sqlite3.h
│   └── sqlite3ext.h
└── installer/
    └── unix_installer.sh
Download .txt
Showing preview only (395K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (4475 symbols across 7 files)

FILE: code/CmdLineParser.h
  function class (line 14) | class CParser
  function parse (line 103) | void CParser::parse(int argc, char * argv[])
  function CheckInstructions (line 123) | bool CParser::CheckInstructions()
  function WriteFieldsToFile (line 198) | void CParser::WriteFieldsToFile()
  function DataFieldExists (line 240) | bool CParser::DataFieldExists(std::string sCmd)
  function GetDataFieldValue (line 280) | double CParser::GetDataFieldValue(std::string sCmd)
  function CheckEachFieldHasEqualSign (line 381) | bool CParser::CheckEachFieldHasEqualSign()
  function CheckEachFieldHasQuantity (line 399) | bool CParser::CheckEachFieldHasQuantity()
  function CheckQuantitiesAreNumbers (line 416) | bool CParser::CheckQuantitiesAreNumbers()
  function CheckUserEnteredProperDate (line 446) | bool CParser::CheckUserEnteredProperDate(bool bPrintSpecificTable)
  function CheckCreationFieldsAreValid (line 560) | bool CParser::CheckCreationFieldsAreValid()
  function CheckIfFileExists (line 585) | bool CParser::CheckIfFileExists(std::string filePath)
  function CheckIfUserEnteredValidFields (line 597) | bool CParser::CheckIfUserEnteredValidFields()
  function CheckCreationFieldsAreUnique (line 671) | bool CParser::CheckCreationFieldsAreUnique()
  function CheckFieldsBeingAddedAreUnique (line 711) | bool CParser::CheckFieldsBeingAddedAreUnique()
  function CheckFieldsAreUnique (line 758) | bool CParser::CheckFieldsAreUnique()
  function CheckUserOnlyEnteredXFields (line 783) | bool CParser::CheckUserOnlyEnteredXFields(int iNumOfFields)

FILE: code/TablePrinter.h
  function class (line 14) | class CTablePrinter

FILE: code/main.cpp
  function main (line 59) | int main(int argc, char * argv[])
  function callback (line 214) | static int callback(void *NotUsed, int argc, char **argv, char **azColName)
  function EnterDate (line 226) | void EnterDate(std::string sDate)
  function EnterDataField (line 244) | void EnterDataField(std::string sCmd, double dInputValue, std::string sD...
  function CreateNewDatabase (line 265) | void CreateNewDatabase(CParser CommandLineParser)
  function AddFieldToDatabase (line 305) | void AddFieldToDatabase(CParser CommandLineParser)
  function PrintFields (line 346) | void PrintFields(CParser CommandLineParser)
  function PrintDates (line 360) | bool PrintDates()
  function PrintSpecificTable (line 386) | bool PrintSpecificTable(std::ofstream &outFile, CParser CommandLineParser)
  function DisplayExpenses (line 430) | void DisplayExpenses(std::ofstream &outFile, int iInputDay, int iInputMo...
  function UpdateExistingRow (line 492) | void UpdateExistingRow(CParser CommandLineParser, std::vector<std::strin...
  function CreateNewRow (line 520) | void CreateNewRow(CParser CommandLineParser, std::vector<std::string> ve...
  function EnterExpenses (line 541) | bool EnterExpenses(std::ofstream &outFile, CParser CommandLineParser)
  function ResetDatabase (line 673) | void ResetDatabase()
  function NewConditionsOk (line 694) | bool NewConditionsOk(CParser oMyParser)
  function AddConditionsOk (line 715) | bool AddConditionsOk(CParser oMyParser)
  function PrintFieldsConditionsOk (line 735) | bool PrintFieldsConditionsOk(CParser oMyParser)
  function PrintDatesConditionsOk (line 755) | bool PrintDatesConditionsOk(CParser oMyParser)
  function PrintSpecificConditionsOk (line 775) | bool PrintSpecificConditionsOk(CParser oMyParser)
  function ByConditionsOk (line 804) | bool ByConditionsOk(CParser oMyParser)
  function ResetConditionsOk (line 817) | bool ResetConditionsOk(CParser oMyParser)
  function HelpConditionsOk (line 837) | bool HelpConditionsOk(CParser oMyParser)
  function PrintHelp (line 850) | void PrintHelp()
  function VersionConditionsOk (line 902) | bool VersionConditionsOk(CParser oMyParser)

FILE: code/shell.c
  function setBinaryMode (line 155) | static void setBinaryMode(FILE *file, int isOutput){
  function setTextMode (line 159) | static void setTextMode(FILE *file, int isOutput){
  function sqlite3_int64 (line 173) | static sqlite3_int64 timeOfDay(void){
  type rusage (line 193) | struct rusage {
  type rusage (line 201) | struct rusage
  function beginTimer (line 207) | static void beginTimer(void){
  function timeDiff (line 215) | static double timeDiff(struct timeval *pStart, struct timeval *pEnd){
  function endTimer (line 223) | static void endTimer(void){
  type LPFILETIME (line 246) | typedef BOOL (WINAPI *GETPROCTIMES)(HANDLE, LPFILETIME, LPFILETIME,
  function hasTimer (line 254) | static int hasTimer(void){
  function beginTimer (line 281) | static void beginTimer(void){
  function timeDiff (line 291) | static double timeDiff(FILETIME *pStart, FILETIME *pEnd){
  function endTimer (line 300) | static void endTimer(void){
  function utf8_printf (line 377) | void utf8_printf(FILE *out, const char *zFormat, ...){
  function iotracePrintf (line 417) | static void SQLITE_CDECL iotracePrintf(const char *zFormat, ...){
  function isNumber (line 433) | static int isNumber(const char *z, int *realnum){
  function shellstaticFunc (line 466) | static void shellstaticFunc(
  function strlen30 (line 483) | static int strlen30(const char *z){
  type OpenSession (line 584) | typedef struct OpenSession OpenSession;
  type OpenSession (line 585) | struct OpenSession {
  type SavedModeInfo (line 597) | typedef struct SavedModeInfo SavedModeInfo;
  type SavedModeInfo (line 598) | struct SavedModeInfo {
  type ShellState (line 609) | typedef struct ShellState ShellState;
  type ShellState (line 610) | struct ShellState {
  function shellLog (line 709) | static void shellLog(void *pArg, int iErrCode, const char *zMsg){
  function output_hex_blob (line 719) | static void output_hex_blob(FILE *out, const void *pBlob, int nBlob){
  function output_quoted_string (line 730) | static void output_quoted_string(FILE *out, const char *z){
  function output_c_string (line 762) | static void output_c_string(FILE *out, const char *z){
  function output_html_string (line 794) | static void output_html_string(FILE *out, const char *z){
  function output_csv (line 854) | static void output_csv(ShellState *p, const char *z, int bSep){
  function interrupt_handler (line 889) | static void interrupt_handler(int NotUsed){
  function shellAuth (line 901) | static int shellAuth(
  function shell_callback (line 947) | static int shell_callback(
  function callback (line 1258) | static int callback(void *pArg, int nArg, char **azArg, char **azCol){
  function set_table_name (line 1268) | static void set_table_name(ShellState *p, const char *zName){
  function run_table_dump_query (line 1357) | static int run_table_dump_query(
  function displayLinuxIoStats (line 1422) | static void displayLinuxIoStats(FILE *out){
  function display_stats (line 1458) | static int display_stats(
  function display_scanstats (line 1589) | static void display_scanstats(
  function str_in_array (line 1640) | static int str_in_array(const char *zStr, const char **azArray){
  function explain_data_prepare (line 1666) | static void explain_data_prepare(ShellState *p, sqlite3_stmt *pSql){
  function explain_data_delete (line 1748) | static void explain_data_delete(ShellState *p){
  function disable_debug_trace_modes (line 1766) | static void disable_debug_trace_modes(void){
  function restore_debug_trace_modes (line 1776) | static void restore_debug_trace_modes(void){
  function exec_prepared_stmt (line 1788) | static void exec_prepared_stmt(
  function shell_exec (line 1862) | static int shell_exec(
  function dump_callback (line 1998) | static int dump_callback(void *pArg, int nArg, char **azArg, char **azCol){
  function run_schema_dump_query (line 2099) | static int run_schema_dump_query(
  function session_help (line 2213) | void session_help(ShellState *p){
  function readfileFunc (line 2240) | static void readfileFunc(
  function writefileFunc (line 2273) | static void writefileFunc(
  function session_close (line 2303) | static void session_close(OpenSession *pSession){
  function session_close_all (line 2319) | static void session_close_all(ShellState *p){
  function session_filter (line 2335) | static int session_filter(void *pCtx, const char *zTab){
  function open_db (line 2349) | static void open_db(ShellState *p, int keepAlive){
  function resolve_backslashes (line 2390) | static void resolve_backslashes(char *z){
  function hexDigitValue (line 2438) | static int hexDigitValue(char c){
  function sqlite3_int64 (line 2448) | static sqlite3_int64 integerValue(const char *zArg){
  function booleanValue (line 2495) | static int booleanValue(char *zArg){
  function output_file_close (line 2517) | static void output_file_close(FILE *f){
  function FILE (line 2526) | static FILE *output_file_open(const char *zFile){
  function sql_trace_callback (line 2546) | static void sql_trace_callback(void *pArg, const char *z){
  function test_breakpoint (line 2559) | static void test_breakpoint(void){
  type ImportCtx (line 2567) | typedef struct ImportCtx ImportCtx;
  type ImportCtx (line 2568) | struct ImportCtx {
  function import_append_char (line 2581) | static void import_append_char(ImportCtx *p, int c){
  function tryToCloneData (line 2707) | static void tryToCloneData(
  function tryToCloneSchema (line 2820) | static void tryToCloneSchema(
  function tryToClone (line 2895) | static void tryToClone(ShellState *p, const char *zNewDb){
  function output_reset (line 2920) | static void output_reset(ShellState *p){
  function db_int (line 2935) | static int db_int(ShellState *p, const char *zSql){
  function get2byteInt (line 2949) | unsigned int get2byteInt(unsigned char *a){
  function get4byteInt (line 2952) | unsigned int get4byteInt(unsigned char *a){
  function shell_dbinfo_command (line 2961) | static int shell_dbinfo_command(ShellState *p, int nArg, char **azArg){
  function shellDatabaseError (line 3043) | static int shellDatabaseError(sqlite3 *db){
  function shellNomemError (line 3052) | static int shellNomemError(void){
  function optionMatch (line 3061) | static int optionMatch(const char *zStr, const char *zOpt){
  function do_meta_command (line 3074) | static int do_meta_command(char *zLine, ShellState *p){
  function line_contains_semicolon (line 4811) | static int line_contains_semicolon(const char *z, int N){
  function _all_whitespace (line 4820) | static int _all_whitespace(const char *z){
  function line_is_command_terminator (line 4846) | static int line_is_command_terminator(const char *zLine){
  function line_is_complete (line 4862) | static int line_is_complete(char *zSql, int nSql){
  function process_input (line 4881) | static int process_input(ShellState *p, FILE *in){
  type passwd (line 5006) | struct passwd
  function process_sqliterc (line 5065) | static void process_sqliterc(
  function usage (line 5134) | static void usage(int showDetail){
  function main_init (line 5150) | static void main_init(ShellState *data) {
  function printBold (line 5169) | static void printBold(const char *zText){
  function printBold (line 5180) | static void printBold(const char *zText){
  function wmain (line 5209) | int SQLITE_CDECL wmain(int argc, wchar_t **wargv){

FILE: code/sqlite3.c
  type sqlite3 (line 484) | typedef struct sqlite3 sqlite3;
  type SQLITE_INT64_TYPE (line 503) | typedef SQLITE_INT64_TYPE sqlite_int64;
  type sqlite_uint64 (line 504) | typedef unsigned SQLITE_INT64_TYPE sqlite_uint64;
  type __int64 (line 506) | typedef __int64 sqlite_int64;
  type sqlite_uint64 (line 507) | typedef unsigned __int64 sqlite_uint64;
  type sqlite_int64 (line 509) | typedef long long int sqlite_int64;
  type sqlite_uint64 (line 510) | typedef unsigned long long int sqlite_uint64;
  type sqlite_int64 (line 512) | typedef sqlite_int64 sqlite3_int64;
  type sqlite_uint64 (line 513) | typedef sqlite_uint64 sqlite3_uint64;
  type sqlite3_file (line 889) | typedef struct sqlite3_file sqlite3_file;
  type sqlite3_file (line 890) | struct sqlite3_file {
  type sqlite3_io_methods (line 984) | typedef struct sqlite3_io_methods sqlite3_io_methods;
  type sqlite3_io_methods (line 985) | struct sqlite3_io_methods {
  type sqlite3_mutex (line 1288) | typedef struct sqlite3_mutex sqlite3_mutex;
  type sqlite3_vfs (line 1447) | typedef struct sqlite3_vfs sqlite3_vfs;
  type sqlite3_vfs (line 1449) | struct sqlite3_vfs {
  type sqlite3_mem_methods (line 1745) | typedef struct sqlite3_mem_methods sqlite3_mem_methods;
  type sqlite3_mem_methods (line 1746) | struct sqlite3_mem_methods {
  type sqlite3_stmt (line 3429) | typedef struct sqlite3_stmt sqlite3_stmt;
  type sqlite3_value (line 3754) | typedef struct Mem sqlite3_value;
  type sqlite3_context (line 3768) | typedef struct sqlite3_context sqlite3_context;
  type sqlite3_vtab (line 5865) | typedef struct sqlite3_vtab sqlite3_vtab;
  type sqlite3_index_info (line 5866) | typedef struct sqlite3_index_info sqlite3_index_info;
  type sqlite3_vtab_cursor (line 5867) | typedef struct sqlite3_vtab_cursor sqlite3_vtab_cursor;
  type sqlite3_module (line 5868) | typedef struct sqlite3_module sqlite3_module;
  type sqlite3_module (line 5886) | struct sqlite3_module {
  type sqlite3_index_info (line 6015) | struct sqlite3_index_info {
  type sqlite3_vtab (line 6128) | struct sqlite3_vtab {
  type sqlite3_vtab_cursor (line 6152) | struct sqlite3_vtab_cursor {
  type sqlite3_blob (line 6208) | typedef struct sqlite3_blob sqlite3_blob;
  type sqlite3_mutex_methods (line 6646) | typedef struct sqlite3_mutex_methods sqlite3_mutex_methods;
  type sqlite3_mutex_methods (line 6647) | struct sqlite3_mutex_methods {
  type sqlite3_pcache (line 7158) | typedef struct sqlite3_pcache sqlite3_pcache;
  type sqlite3_pcache_page (line 7170) | typedef struct sqlite3_pcache_page sqlite3_pcache_page;
  type sqlite3_pcache_page (line 7171) | struct sqlite3_pcache_page {
  type sqlite3_pcache_methods2 (line 7335) | typedef struct sqlite3_pcache_methods2 sqlite3_pcache_methods2;
  type sqlite3_pcache_methods2 (line 7336) | struct sqlite3_pcache_methods2 {
  type sqlite3_pcache_methods (line 7358) | typedef struct sqlite3_pcache_methods sqlite3_pcache_methods;
  type sqlite3_pcache_methods (line 7359) | struct sqlite3_pcache_methods {
  type sqlite3_backup (line 7384) | typedef struct sqlite3_backup sqlite3_backup;
  type sqlite3_snapshot (line 8342) | typedef struct sqlite3_snapshot sqlite3_snapshot;
  type sqlite3_rtree_geometry (line 8483) | typedef struct sqlite3_rtree_geometry sqlite3_rtree_geometry;
  type sqlite3_rtree_query_info (line 8484) | typedef struct sqlite3_rtree_query_info sqlite3_rtree_query_info;
  type sqlite3_int64 (line 8490) | typedef sqlite3_int64 sqlite3_rtree_dbl;
  type sqlite3_rtree_dbl (line 8492) | typedef double sqlite3_rtree_dbl;
  type sqlite3_rtree_geometry (line 8513) | struct sqlite3_rtree_geometry {
  type sqlite3_rtree_query_info (line 8545) | struct sqlite3_rtree_query_info {
  type sqlite3_session (line 8596) | typedef struct sqlite3_session sqlite3_session;
  type sqlite3_changeset_iter (line 8601) | typedef struct sqlite3_changeset_iter sqlite3_changeset_iter;
  type sqlite3_changegroup (line 9311) | typedef struct sqlite3_changegroup sqlite3_changegroup;
  type Fts5ExtensionApi (line 9895) | typedef struct Fts5ExtensionApi Fts5ExtensionApi;
  type Fts5Context (line 9896) | typedef struct Fts5Context Fts5Context;
  type Fts5PhraseIter (line 9897) | typedef struct Fts5PhraseIter Fts5PhraseIter;
  type Fts5PhraseIter (line 9907) | struct Fts5PhraseIter {
  type Fts5ExtensionApi (line 10127) | struct Fts5ExtensionApi {
  type Fts5Tokenizer (line 10361) | typedef struct Fts5Tokenizer Fts5Tokenizer;
  type fts5_tokenizer (line 10362) | typedef struct fts5_tokenizer fts5_tokenizer;
  type fts5_tokenizer (line 10363) | struct fts5_tokenizer {
  type fts5_api (line 10398) | typedef struct fts5_api fts5_api;
  type fts5_api (line 10399) | struct fts5_api {
  type Hash (line 11018) | typedef struct Hash Hash;
  type HashElem (line 11019) | typedef struct HashElem HashElem;
  type Hash (line 11042) | struct Hash {
  type HashElem (line 11058) | struct HashElem {
  type sqlite_int64 (line 11445) | typedef sqlite_int64 i64;
  type sqlite_uint64 (line 11446) | typedef sqlite_uint64 u64;
  type UINT32_TYPE (line 11447) | typedef UINT32_TYPE u32;
  type UINT16_TYPE (line 11448) | typedef UINT16_TYPE u16;
  type INT16_TYPE (line 11449) | typedef INT16_TYPE i16;
  type UINT8_TYPE (line 11450) | typedef UINT8_TYPE u8;
  type INT8_TYPE (line 11451) | typedef INT8_TYPE i8;
  type u64 (line 11468) | typedef u64 tRowcnt;
  type u32 (line 11470) | typedef u32 tRowcnt;
  type INT16_TYPE (line 11496) | typedef INT16_TYPE LogEst;
  type uptr (line 11515) | typedef uintptr_t uptr;
  type u32 (line 11517) | typedef u32 uptr;
  type u64 (line 11519) | typedef u64 uptr;
  type BusyHandler (line 11679) | typedef struct BusyHandler BusyHandler;
  type BusyHandler (line 11680) | struct BusyHandler {
  type AggInfo (line 11773) | typedef struct AggInfo AggInfo;
  type AuthContext (line 11774) | typedef struct AuthContext AuthContext;
  type AutoincInfo (line 11775) | typedef struct AutoincInfo AutoincInfo;
  type Bitvec (line 11776) | typedef struct Bitvec Bitvec;
  type CollSeq (line 11777) | typedef struct CollSeq CollSeq;
  type Column (line 11778) | typedef struct Column Column;
  type Db (line 11779) | typedef struct Db Db;
  type Schema (line 11780) | typedef struct Schema Schema;
  type Expr (line 11781) | typedef struct Expr Expr;
  type ExprList (line 11782) | typedef struct ExprList ExprList;
  type ExprSpan (line 11783) | typedef struct ExprSpan ExprSpan;
  type FKey (line 11784) | typedef struct FKey FKey;
  type FuncDestructor (line 11785) | typedef struct FuncDestructor FuncDestructor;
  type FuncDef (line 11786) | typedef struct FuncDef FuncDef;
  type FuncDefHash (line 11787) | typedef struct FuncDefHash FuncDefHash;
  type IdList (line 11788) | typedef struct IdList IdList;
  type Index (line 11789) | typedef struct Index Index;
  type IndexSample (line 11790) | typedef struct IndexSample IndexSample;
  type KeyClass (line 11791) | typedef struct KeyClass KeyClass;
  type KeyInfo (line 11792) | typedef struct KeyInfo KeyInfo;
  type Lookaside (line 11793) | typedef struct Lookaside Lookaside;
  type LookasideSlot (line 11794) | typedef struct LookasideSlot LookasideSlot;
  type Module (line 11795) | typedef struct Module Module;
  type NameContext (line 11796) | typedef struct NameContext NameContext;
  type Parse (line 11797) | typedef struct Parse Parse;
  type PreUpdate (line 11798) | typedef struct PreUpdate PreUpdate;
  type PrintfArguments (line 11799) | typedef struct PrintfArguments PrintfArguments;
  type RowSet (line 11800) | typedef struct RowSet RowSet;
  type Savepoint (line 11801) | typedef struct Savepoint Savepoint;
  type Select (line 11802) | typedef struct Select Select;
  type SQLiteThread (line 11803) | typedef struct SQLiteThread SQLiteThread;
  type SelectDest (line 11804) | typedef struct SelectDest SelectDest;
  type SrcList (line 11805) | typedef struct SrcList SrcList;
  type StrAccum (line 11806) | typedef struct StrAccum StrAccum;
  type Table (line 11807) | typedef struct Table Table;
  type TableLock (line 11808) | typedef struct TableLock TableLock;
  type Token (line 11809) | typedef struct Token Token;
  type TreeView (line 11810) | typedef struct TreeView TreeView;
  type Trigger (line 11811) | typedef struct Trigger Trigger;
  type TriggerPrg (line 11812) | typedef struct TriggerPrg TriggerPrg;
  type TriggerStep (line 11813) | typedef struct TriggerStep TriggerStep;
  type UnpackedRecord (line 11814) | typedef struct UnpackedRecord UnpackedRecord;
  type VTable (line 11815) | typedef struct VTable VTable;
  type VtabCtx (line 11816) | typedef struct VtabCtx VtabCtx;
  type Walker (line 11817) | typedef struct Walker Walker;
  type WhereInfo (line 11818) | typedef struct WhereInfo WhereInfo;
  type With (line 11819) | typedef struct With With;
  type Btree (line 11866) | typedef struct Btree Btree;
  type BtCursor (line 11867) | typedef struct BtCursor BtCursor;
  type BtShared (line 11868) | typedef struct BtShared BtShared;
  type KeyInfo (line 12054) | struct KeyInfo
  type Vdbe (line 12194) | typedef struct Vdbe Vdbe;
  type Mem (line 12200) | typedef struct Mem Mem;
  type SubProgram (line 12201) | typedef struct SubProgram SubProgram;
  type VdbeOp (line 12208) | struct VdbeOp {
  type VdbeOp (line 12247) | typedef struct VdbeOp VdbeOp;
  type SubProgram (line 12253) | struct SubProgram {
  type VdbeOpList (line 12267) | struct VdbeOpList {
  type VdbeOpList (line 12273) | typedef struct VdbeOpList VdbeOpList;
  type u32 (line 12725) | typedef u32 Pgno;
  type Pager (line 12730) | typedef struct Pager Pager;
  type DbPage (line 12735) | typedef struct PgHdr DbPage;
  type PgHdr (line 12948) | typedef struct PgHdr PgHdr;
  type PCache (line 12949) | typedef struct PCache PCache;
  type PgHdr (line 12955) | struct PgHdr {
  type Db (line 13508) | struct Db {
  type Schema (line 13533) | struct Schema {
  type Lookaside (line 13596) | struct Lookaside {
  type LookasideSlot (line 13607) | struct LookasideSlot {
  type FuncDefHash (line 13619) | struct FuncDefHash {
  type sqlite3_userauth (line 13628) | typedef struct sqlite3_userauth sqlite3_userauth;
  type sqlite3_userauth (line 13629) | struct sqlite3_userauth {
  type sqlite3 (line 13665) | struct sqlite3 {
  type FuncDef (line 13898) | struct FuncDef {
  type FuncDestructor (line 13926) | struct FuncDestructor {
  type Savepoint (line 14025) | struct Savepoint {
  type Module (line 14046) | struct Module {
  type Column (line 14058) | struct Column {
  type CollSeq (line 14083) | struct CollSeq {
  type VTable (line 14182) | struct VTable {
  type Table (line 14196) | struct Table {
  type FKey (line 14309) | struct FKey {
  type KeyInfo (line 14375) | struct KeyInfo {
  type UnpackedRecord (line 14420) | struct UnpackedRecord {
  type Index (line 14466) | struct Index {
  type IndexSample (line 14523) | struct IndexSample {
  type Token (line 14539) | struct Token {
  type AggInfo (line 14557) | struct AggInfo {
  type i16 (line 14599) | typedef i16 ynVar;
  type ynVar (line 14601) | typedef int ynVar;
  type Expr (line 14667) | struct Expr {
  type ExprList (line 14793) | struct ExprList {
  type ExprSpan (line 14818) | struct ExprSpan {
  type IdList (line 14839) | struct IdList {
  type SQLITE_BITMASK_TYPE (line 14855) | typedef SQLITE_BITMASK_TYPE Bitmask;
  type u64 (line 14857) | typedef u64 Bitmask;
  type SrcList (line 14891) | struct SrcList {
  type NameContext (line 14993) | struct NameContext {
  type Select (line 15041) | struct Select {
  type SelectDest (line 15179) | struct SelectDest {
  type AutoincInfo (line 15197) | struct AutoincInfo {
  type TriggerPrg (line 15229) | struct TriggerPrg {
  type yDbMask (line 15248) | typedef unsigned int yDbMask;
  type Parse (line 15272) | struct Parse {
  type AuthContext (line 15393) | struct AuthContext {
  type Trigger (line 15445) | struct Trigger {
  type TriggerStep (line 15507) | struct TriggerStep {
  type DbFixer (line 15525) | typedef struct DbFixer DbFixer;
  type DbFixer (line 15526) | struct DbFixer {
  type StrAccum (line 15539) | struct StrAccum {
  type InitData (line 15562) | typedef struct {
  type Sqlite3Config (line 15574) | struct Sqlite3Config {
  type Walker (line 15651) | struct Walker {
  type With (line 15689) | struct With {
  type TreeView (line 15705) | struct TreeView {
  type PrintfArguments (line 15889) | struct PrintfArguments {
  type SrcList_item (line 16030) | struct SrcList_item
  type SrcList_item (line 16090) | struct SrcList_item
  type Sqlite3Config (line 16322) | struct Sqlite3Config
  type Sqlite3Config (line 16835) | struct Sqlite3Config
  function SQLITE_STDCALL (line 17347) | SQLITE_STDCALL sqlite3_compileoption_used(const char *zOptName){
  function SQLITE_API (line 17375) | SQLITE_API const char *SQLITE_STDCALL sqlite3_compileoption_get(int N){
  type Op (line 17448) | typedef struct VdbeOp Op;
  type Bool (line 17453) | typedef unsigned Bool;
  type VdbeSorter (line 17456) | typedef struct VdbeSorter VdbeSorter;
  type Explain (line 17459) | typedef struct Explain Explain;
  type AuxData (line 17462) | typedef struct AuxData AuxData;
  type VdbeCursor (line 17480) | typedef struct VdbeCursor VdbeCursor;
  type VdbeCursor (line 17481) | struct VdbeCursor {
  type VdbeFrame (line 17556) | typedef struct VdbeFrame VdbeFrame;
  type VdbeFrame (line 17557) | struct VdbeFrame {
  type Mem (line 17591) | struct Mem {
  type AuxData (line 17692) | struct AuxData {
  type sqlite3_context (line 17713) | struct sqlite3_context {
  type Explain (line 17730) | struct Explain {
  type bft (line 17741) | typedef unsigned bft;
  type ScanStatus (line 17743) | typedef struct ScanStatus ScanStatus;
  type ScanStatus (line 17744) | struct ScanStatus {
  type Vdbe (line 17760) | struct Vdbe {
  type PreUpdate (line 17838) | struct PreUpdate {
  type sqlite3_int64 (line 17973) | typedef sqlite3_int64 sqlite3StatValueType;
  type u32 (line 17975) | typedef u32 sqlite3StatValueType;
  type sqlite3StatType (line 17977) | typedef struct sqlite3StatType sqlite3StatType;
  function SQLITE_WSD (line 17978) | static SQLITE_WSD struct sqlite3StatType {
  function SQLITE_PRIVATE (line 18019) | SQLITE_PRIVATE sqlite3_int64 sqlite3StatusValue(int op){
  function SQLITE_PRIVATE (line 18039) | SQLITE_PRIVATE void sqlite3StatusUp(int op, int N){
  function SQLITE_PRIVATE (line 18050) | SQLITE_PRIVATE void sqlite3StatusDown(int op, int N){
  function SQLITE_PRIVATE (line 18064) | SQLITE_PRIVATE void sqlite3StatusHighwater(int op, int X){
  function SQLITE_STDCALL (line 18085) | SQLITE_STDCALL sqlite3_status64(
  function SQLITE_STDCALL (line 18110) | SQLITE_STDCALL sqlite3_status(int op, int *pCurrent, int *pHighwater, in...
  function SQLITE_STDCALL (line 18127) | SQLITE_STDCALL sqlite3_db_status(
  type tm (line 18359) | struct tm
  type DateTime (line 18365) | typedef struct DateTime DateTime;
  type DateTime (line 18366) | struct DateTime {
  function getDigits (line 18407) | static int getDigits(const char *zDate, const char *zFormat, ...){
  function parseTimezone (line 18461) | static int parseTimezone(const char *zDate, DateTime *p){
  function parseHhMmSs (line 18497) | static int parseHhMmSs(const char *zDate, DateTime *p){
  function computeJD (line 18539) | static void computeJD(DateTime *p){
  function parseYyyyMmDd (line 18585) | static int parseYyyyMmDd(const char *zDate, DateTime *p){
  function setDateTimeToCurrent (line 18622) | static int setDateTimeToCurrent(sqlite3_context *context, DateTime *p){
  function parseDateOrTime (line 18648) | static int parseDateOrTime(
  function computeYMD (line 18671) | static void computeYMD(DateTime *p){
  function computeHMS (line 18697) | static void computeHMS(DateTime *p){
  function computeYMD_HMS (line 18715) | static void computeYMD_HMS(DateTime *p){
  function clearYMD_HMS_TZ (line 18723) | static void clearYMD_HMS_TZ(DateTime *p){
  function osLocaltime (line 18761) | static int osLocaltime(time_t *t, struct tm *pTm){
  function sqlite3_int64 (line 18800) | static sqlite3_int64 localtimeOffset(
  function parseModifier (line 18879) | static int parseModifier(sqlite3_context *pCtx, const char *zMod, DateTi...
  function isDate (line 19089) | static int isDate(
  function juliandayFunc (line 19130) | static void juliandayFunc(
  function datetimeFunc (line 19147) | static void datetimeFunc(
  function timeFunc (line 19167) | static void timeFunc(
  function dateFunc (line 19186) | static void dateFunc(
  function strftimeFunc (line 19219) | static void strftimeFunc(
  function ctimeFunc (line 19357) | static void ctimeFunc(
  function cdateFunc (line 19371) | static void cdateFunc(
  function ctimestampFunc (line 19385) | static void ctimestampFunc(
  function currentTimeFunc (line 19407) | static void currentTimeFunc(
  function SQLITE_PRIVATE (line 19446) | SQLITE_PRIVATE void sqlite3RegisterDateTimeFunctions(void){
  function SQLITE_PRIVATE (line 19551) | SQLITE_PRIVATE void sqlite3OsClose(sqlite3_file *pId){
  function SQLITE_PRIVATE (line 19557) | SQLITE_PRIVATE int sqlite3OsRead(sqlite3_file *id, void *pBuf, int amt, ...
  function SQLITE_PRIVATE (line 19561) | SQLITE_PRIVATE int sqlite3OsWrite(sqlite3_file *id, const void *pBuf, in...
  function SQLITE_PRIVATE (line 19565) | SQLITE_PRIVATE int sqlite3OsTruncate(sqlite3_file *id, i64 size){
  function SQLITE_PRIVATE (line 19568) | SQLITE_PRIVATE int sqlite3OsSync(sqlite3_file *id, int flags){
  function SQLITE_PRIVATE (line 19572) | SQLITE_PRIVATE int sqlite3OsFileSize(sqlite3_file *id, i64 *pSize){
  function SQLITE_PRIVATE (line 19576) | SQLITE_PRIVATE int sqlite3OsLock(sqlite3_file *id, int lockType){
  function SQLITE_PRIVATE (line 19580) | SQLITE_PRIVATE int sqlite3OsUnlock(sqlite3_file *id, int lockType){
  function SQLITE_PRIVATE (line 19583) | SQLITE_PRIVATE int sqlite3OsCheckReservedLock(sqlite3_file *id, int *pRe...
  function SQLITE_PRIVATE (line 19596) | SQLITE_PRIVATE int sqlite3OsFileControl(sqlite3_file *id, int op, void *...
  function SQLITE_PRIVATE (line 19614) | SQLITE_PRIVATE void sqlite3OsFileControlHint(sqlite3_file *id, int op, v...
  function SQLITE_PRIVATE (line 19618) | SQLITE_PRIVATE int sqlite3OsSectorSize(sqlite3_file *id){
  function SQLITE_PRIVATE (line 19622) | SQLITE_PRIVATE int sqlite3OsDeviceCharacteristics(sqlite3_file *id){
  function SQLITE_PRIVATE (line 19625) | SQLITE_PRIVATE int sqlite3OsShmLock(sqlite3_file *id, int offset, int n,...
  function SQLITE_PRIVATE (line 19628) | SQLITE_PRIVATE void sqlite3OsShmBarrier(sqlite3_file *id){
  function SQLITE_PRIVATE (line 19631) | SQLITE_PRIVATE int sqlite3OsShmUnmap(sqlite3_file *id, int deleteFlag){
  function SQLITE_PRIVATE (line 19634) | SQLITE_PRIVATE int sqlite3OsShmMap(
  function SQLITE_PRIVATE (line 19647) | SQLITE_PRIVATE int sqlite3OsFetch(sqlite3_file *id, i64 iOff, int iAmt, ...
  function SQLITE_PRIVATE (line 19651) | SQLITE_PRIVATE int sqlite3OsUnfetch(sqlite3_file *id, i64 iOff, void *p){
  function SQLITE_PRIVATE (line 19656) | SQLITE_PRIVATE int sqlite3OsFetch(sqlite3_file *id, i64 iOff, int iAmt, ...
  function SQLITE_PRIVATE (line 19660) | SQLITE_PRIVATE int sqlite3OsUnfetch(sqlite3_file *id, i64 iOff, void *p){
  function SQLITE_PRIVATE (line 19669) | SQLITE_PRIVATE int sqlite3OsOpen(
  function SQLITE_PRIVATE (line 19686) | SQLITE_PRIVATE int sqlite3OsDelete(sqlite3_vfs *pVfs, const char *zPath,...
  function SQLITE_PRIVATE (line 19691) | SQLITE_PRIVATE int sqlite3OsAccess(
  function SQLITE_PRIVATE (line 19700) | SQLITE_PRIVATE int sqlite3OsFullPathname(
  function SQLITE_PRIVATE (line 19711) | SQLITE_PRIVATE void *sqlite3OsDlOpen(sqlite3_vfs *pVfs, const char *zPath){
  function SQLITE_PRIVATE (line 19714) | SQLITE_PRIVATE void sqlite3OsDlError(sqlite3_vfs *pVfs, int nByte, char ...
  function SQLITE_PRIVATE (line 19717) | SQLITE_PRIVATE void (*sqlite3OsDlSym(sqlite3_vfs *pVfs, void *pHdle, con...
  function SQLITE_PRIVATE (line 19720) | SQLITE_PRIVATE void sqlite3OsDlClose(sqlite3_vfs *pVfs, void *pHandle){
  function SQLITE_PRIVATE (line 19724) | SQLITE_PRIVATE int sqlite3OsRandomness(sqlite3_vfs *pVfs, int nByte, cha...
  function SQLITE_PRIVATE (line 19727) | SQLITE_PRIVATE int sqlite3OsSleep(sqlite3_vfs *pVfs, int nMicro){
  function SQLITE_PRIVATE (line 19730) | SQLITE_PRIVATE int sqlite3OsGetLastError(sqlite3_vfs *pVfs){
  function SQLITE_PRIVATE (line 19733) | SQLITE_PRIVATE int sqlite3OsCurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_...
  function SQLITE_PRIVATE (line 19751) | SQLITE_PRIVATE int sqlite3OsOpenMalloc(
  function SQLITE_PRIVATE (line 19773) | SQLITE_PRIVATE void sqlite3OsCloseFree(sqlite3_file *pFile){
  function SQLITE_PRIVATE (line 19785) | SQLITE_PRIVATE int sqlite3OsInit(void){
  function vfsUnlink (line 19826) | static void vfsUnlink(sqlite3_vfs *pVfs){
  function SQLITE_STDCALL (line 19848) | SQLITE_STDCALL sqlite3_vfs_register(sqlite3_vfs *pVfs, int makeDflt){
  function SQLITE_STDCALL (line 19876) | SQLITE_STDCALL sqlite3_vfs_unregister(sqlite3_vfs *pVfs){
  type BenignMallocHooks (line 19921) | typedef struct BenignMallocHooks BenignMallocHooks;
  function SQLITE_WSD (line 19922) | static SQLITE_WSD struct BenignMallocHooks {
  function SQLITE_PRIVATE (line 19947) | SQLITE_PRIVATE void sqlite3BenignMallocHooks(
  function SQLITE_PRIVATE (line 19961) | SQLITE_PRIVATE void sqlite3BeginBenignMalloc(void){
  function SQLITE_PRIVATE (line 19967) | SQLITE_PRIVATE void sqlite3EndBenignMalloc(void){
  function sqlite3MemFree (line 20009) | static void sqlite3MemFree(void *pPrior){ return; }
  function sqlite3MemSize (line 20011) | static int sqlite3MemSize(void *pPrior){ return 0; }
  function sqlite3MemRoundup (line 20012) | static int sqlite3MemRoundup(int n){ return n; }
  function sqlite3MemInit (line 20013) | static int sqlite3MemInit(void *NotUsed){ return SQLITE_OK; }
  function sqlite3MemShutdown (line 20014) | static void sqlite3MemShutdown(void *NotUsed){ return; }
  function SQLITE_PRIVATE (line 20022) | SQLITE_PRIVATE void sqlite3MemSetDefault(void){
  function sqlite3MemFree (line 20197) | static void sqlite3MemFree(void *pPrior){
  function sqlite3MemSize (line 20212) | static int sqlite3MemSize(void *pPrior){
  function sqlite3MemRoundup (line 20267) | static int sqlite3MemRoundup(int n){
  function sqlite3MemInit (line 20274) | static int sqlite3MemInit(void *NotUsed){
  function sqlite3MemShutdown (line 20310) | static void sqlite3MemShutdown(void *NotUsed){
  function SQLITE_PRIVATE (line 20321) | SQLITE_PRIVATE void sqlite3MemSetDefault(void){
  type MemBlockHdr (line 20393) | struct MemBlockHdr {
  type MemBlockHdr (line 20430) | struct MemBlockHdr
  type MemBlockHdr (line 20431) | struct MemBlockHdr
  function adjustStats (line 20467) | static void adjustStats(int iSize, int increment){
  type MemBlockHdr (line 20490) | struct MemBlockHdr
  type MemBlockHdr (line 20491) | struct MemBlockHdr
  type MemBlockHdr (line 20496) | struct MemBlockHdr
  function sqlite3MemSize (line 20514) | static int sqlite3MemSize(void *p){
  function sqlite3MemInit (line 20526) | static int sqlite3MemInit(void *NotUsed){
  function sqlite3MemShutdown (line 20540) | static void sqlite3MemShutdown(void *NotUsed){
  function sqlite3MemRoundup (line 20548) | static int sqlite3MemRoundup(int n){
  function randomFill (line 20557) | static void randomFill(char *pBuf, int nByte){
  type MemBlockHdr (line 20581) | struct MemBlockHdr
  type MemBlockHdr (line 20597) | struct MemBlockHdr
  function sqlite3MemFree (line 20639) | static void sqlite3MemFree(void *pPrior){
  type MemBlockHdr (line 20682) | struct MemBlockHdr
  function SQLITE_PRIVATE (line 20702) | SQLITE_PRIVATE void sqlite3MemSetDefault(void){
  function SQLITE_PRIVATE (line 20719) | SQLITE_PRIVATE void sqlite3MemdebugSetType(void *p, u8 eType){
  function SQLITE_PRIVATE (line 20737) | SQLITE_PRIVATE int sqlite3MemdebugHasType(void *p, u8 eType){
  function SQLITE_PRIVATE (line 20759) | SQLITE_PRIVATE int sqlite3MemdebugNoType(void *p, u8 eType){
  function SQLITE_PRIVATE (line 20777) | SQLITE_PRIVATE void sqlite3MemdebugBacktrace(int depth){
  function SQLITE_PRIVATE (line 20784) | SQLITE_PRIVATE void sqlite3MemdebugBacktraceCallback(void (*xBacktrace)(...
  function SQLITE_PRIVATE (line 20791) | SQLITE_PRIVATE void sqlite3MemdebugSettitle(const char *zTitle){
  function SQLITE_PRIVATE (line 20801) | SQLITE_PRIVATE void sqlite3MemdebugSync(){
  function SQLITE_PRIVATE (line 20814) | SQLITE_PRIVATE void sqlite3MemdebugDump(const char *zFilename){
  function SQLITE_PRIVATE (line 20856) | SQLITE_PRIVATE int sqlite3MemdebugMallocCount(){
  type Mem3Block (line 20949) | typedef struct Mem3Block Mem3Block;
  type Mem3Block (line 20950) | struct Mem3Block {
  function SQLITE_WSD (line 20969) | static SQLITE_WSD struct Mem3Global {
  function memsys3UnlinkFromList (line 21016) | static void memsys3UnlinkFromList(u32 i, u32 *pRoot){
  function memsys3Unlink (line 21036) | static void memsys3Unlink(u32 i){
  function memsys3LinkIntoList (line 21056) | static void memsys3LinkIntoList(u32 i, u32 *pRoot){
  function memsys3Link (line 21070) | static void memsys3Link(u32 i){
  function memsys3Enter (line 21091) | static void memsys3Enter(void){
  function memsys3Leave (line 21097) | static void memsys3Leave(void){
  function memsys3OutOfMemory (line 21104) | static void memsys3OutOfMemory(int nByte){
  function memsys3Merge (line 21184) | static void memsys3Merge(u32 *pRoot){
  function memsys3FreeUnsafe (line 21305) | static void memsys3FreeUnsafe(void *pOld){
  function memsys3Size (line 21346) | static int memsys3Size(void *p){
  function memsys3Roundup (line 21357) | static int memsys3Roundup(int n){
  function memsys3Free (line 21380) | static void memsys3Free(void *pPrior){
  function memsys3Init (line 21421) | static int memsys3Init(void *NotUsed){
  function memsys3Shutdown (line 21446) | static void memsys3Shutdown(void *NotUsed){
  function SQLITE_PRIVATE (line 21458) | SQLITE_PRIVATE void sqlite3Memsys3Dump(const char *zFilename){
  function SQLITE_PRIVATE (line 21542) | SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetMemsys3(void){
  type Mem5Link (line 21626) | typedef struct Mem5Link Mem5Link;
  type Mem5Link (line 21627) | struct Mem5Link {
  function SQLITE_WSD (line 21651) | static SQLITE_WSD struct Mem5Global {
  function memsys5Unlink (line 21708) | static void memsys5Unlink(int i, int iLogsize){
  function memsys5Link (line 21730) | static void memsys5Link(int i, int iLogsize){
  function memsys5Enter (line 21749) | static void memsys5Enter(void){
  function memsys5Leave (line 21752) | static void memsys5Leave(void){
  function memsys5Size (line 21760) | static int memsys5Size(void *p){
  function memsys5FreeUnsafe (line 21849) | static void memsys5FreeUnsafe(void *pOld){
  function memsys5Free (line 21931) | static void memsys5Free(void *pPrior){
  function memsys5Roundup (line 21980) | static int memsys5Roundup(int n){
  function memsys5Log (line 21997) | static int memsys5Log(int iValue){
  function memsys5Init (line 22009) | static int memsys5Init(void *NotUsed){
  function memsys5Shutdown (line 22067) | static void memsys5Shutdown(void *NotUsed){
  function SQLITE_PRIVATE (line 22078) | SQLITE_PRIVATE void sqlite3Memsys5Dump(const char *zFilename){
  function SQLITE_PRIVATE (line 22121) | SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetMemsys5(void){
  function SQLITE_PRIVATE (line 22170) | SQLITE_PRIVATE int sqlite3MutexInit(void){
  function SQLITE_PRIVATE (line 22211) | SQLITE_PRIVATE int sqlite3MutexEnd(void){
  function SQLITE_PRIVATE (line 22236) | SQLITE_PRIVATE sqlite3_mutex *sqlite3MutexAlloc(int id){
  function SQLITE_STDCALL (line 22248) | SQLITE_STDCALL sqlite3_mutex_free(sqlite3_mutex *p){
  function SQLITE_STDCALL (line 22259) | SQLITE_STDCALL sqlite3_mutex_enter(sqlite3_mutex *p){
  function SQLITE_STDCALL (line 22270) | SQLITE_STDCALL sqlite3_mutex_try(sqlite3_mutex *p){
  function SQLITE_STDCALL (line 22285) | SQLITE_STDCALL sqlite3_mutex_leave(sqlite3_mutex *p){
  function SQLITE_STDCALL (line 22297) | SQLITE_STDCALL sqlite3_mutex_held(sqlite3_mutex *p){
  function SQLITE_STDCALL (line 22301) | SQLITE_STDCALL sqlite3_mutex_notheld(sqlite3_mutex *p){
  function noopMutexInit (line 22348) | static int noopMutexInit(void){ return SQLITE_OK; }
  function noopMutexEnd (line 22349) | static int noopMutexEnd(void){ return SQLITE_OK; }
  function sqlite3_mutex (line 22350) | static sqlite3_mutex *noopMutexAlloc(int id){
  function noopMutexFree (line 22354) | static void noopMutexFree(sqlite3_mutex *p){ UNUSED_PARAMETER(p); return; }
  function noopMutexEnter (line 22355) | static void noopMutexEnter(sqlite3_mutex *p){ UNUSED_PARAMETER(p); retur...
  function noopMutexTry (line 22356) | static int noopMutexTry(sqlite3_mutex *p){
  function noopMutexLeave (line 22360) | static void noopMutexLeave(sqlite3_mutex *p){ UNUSED_PARAMETER(p); retur...
  function SQLITE_PRIVATE (line 22362) | SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3NoopMutex(void){
  type sqlite3_debug_mutex (line 22390) | typedef struct sqlite3_debug_mutex {
  function debugMutexHeld (line 22399) | static int debugMutexHeld(sqlite3_mutex *pX){
  function debugMutexNotheld (line 22403) | static int debugMutexNotheld(sqlite3_mutex *pX){
  function debugMutexInit (line 22411) | static int debugMutexInit(void){ return SQLITE_OK; }
  function debugMutexEnd (line 22412) | static int debugMutexEnd(void){ return SQLITE_OK; }
  function sqlite3_mutex (line 22419) | static sqlite3_mutex *debugMutexAlloc(int id){
  function debugMutexFree (line 22450) | static void debugMutexFree(sqlite3_mutex *pX){
  function debugMutexEnter (line 22473) | static void debugMutexEnter(sqlite3_mutex *pX){
  function debugMutexTry (line 22478) | static int debugMutexTry(sqlite3_mutex *pX){
  function debugMutexLeave (line 22491) | static void debugMutexLeave(sqlite3_mutex *pX){
  function SQLITE_PRIVATE (line 22498) | SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3NoopMutex(void){
  function SQLITE_PRIVATE (line 22521) | SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void){
  type sqlite3_mutex (line 22569) | struct sqlite3_mutex {
  function pthreadMutexHeld (line 22605) | static int pthreadMutexHeld(sqlite3_mutex *p){
  function pthreadMutexNotheld (line 22608) | static int pthreadMutexNotheld(sqlite3_mutex *p){
  function SQLITE_PRIVATE (line 22618) | SQLITE_PRIVATE void sqlite3MemoryBarrier(void){
  function pthreadMutexInit (line 22629) | static int pthreadMutexInit(void){ return SQLITE_OK; }
  function pthreadMutexEnd (line 22630) | static int pthreadMutexEnd(void){ return SQLITE_OK; }
  function sqlite3_mutex (line 22680) | static sqlite3_mutex *pthreadMutexAlloc(int iType){
  function pthreadMutexFree (line 22745) | static void pthreadMutexFree(sqlite3_mutex *p){
  function pthreadMutexEnter (line 22772) | static void pthreadMutexEnter(sqlite3_mutex *p){
  function pthreadMutexTry (line 22814) | static int pthreadMutexTry(sqlite3_mutex *p){
  function pthreadMutexLeave (line 22871) | static void pthreadMutexLeave(sqlite3_mutex *p){
  function SQLITE_PRIVATE (line 22894) | SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void){
  function sqlite_uint64 (line 23012) | __inline__ sqlite_uint64 sqlite3Hwtime(void){
  function sqlite_uint64 (line 23020) | __declspec(naked) __inline sqlite_uint64 __cdecl sqlite3Hwtime(void){
  function sqlite_uint64 (line 23031) | __inline__ sqlite_uint64 sqlite3Hwtime(void){
  function sqlite_uint64 (line 23039) | __inline__ sqlite_uint64 sqlite3Hwtime(void){
  function sqlite3Hwtime (line 23063) | sqlite3Hwtime(void){ return ((sqlite_uint64)0); }
  function local_ioerr (line 23101) | static void local_ioerr(){
  type sqlite3_mutex (line 23245) | struct sqlite3_mutex {
  function winMutexHeld (line 23274) | static int winMutexHeld(sqlite3_mutex *p){
  function winMutexNotheld2 (line 23278) | static int winMutexNotheld2(sqlite3_mutex *p, DWORD tid){
  function winMutexNotheld (line 23282) | static int winMutexNotheld(sqlite3_mutex *p){
  function SQLITE_PRIVATE (line 23293) | SQLITE_PRIVATE void sqlite3MemoryBarrier(void){
  function winMutexInit (line 23336) | static int winMutexInit(void){
  function winMutexEnd (line 23358) | static int winMutexEnd(void){
  function sqlite3_mutex (line 23421) | static sqlite3_mutex *winMutexAlloc(int iType){
  function winMutexFree (line 23469) | static void winMutexFree(sqlite3_mutex *p){
  function winMutexEnter (line 23493) | static void winMutexEnter(sqlite3_mutex *p){
  function winMutexTry (line 23516) | static int winMutexTry(sqlite3_mutex *p){
  function winMutexLeave (line 23566) | static void winMutexLeave(sqlite3_mutex *p){
  function SQLITE_PRIVATE (line 23588) | SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void){
  function SQLITE_STDCALL (line 23634) | SQLITE_STDCALL sqlite3_release_memory(int n){
  type ScratchFreeslot (line 23650) | typedef struct ScratchFreeslot {
  function SQLITE_WSD (line 23657) | static SQLITE_WSD struct Mem0Global {
  function SQLITE_PRIVATE (line 23683) | SQLITE_PRIVATE sqlite3_mutex *sqlite3MallocMutex(void){
  function SQLITE_STDCALL (line 23693) | SQLITE_STDCALL sqlite3_memory_alarm(
  function SQLITE_STDCALL (line 23709) | SQLITE_STDCALL sqlite3_soft_heap_limit64(sqlite3_int64 n){
  function SQLITE_STDCALL (line 23731) | SQLITE_STDCALL sqlite3_soft_heap_limit(int n){
  function SQLITE_PRIVATE (line 23739) | SQLITE_PRIVATE int sqlite3MallocInit(void){
  function SQLITE_PRIVATE (line 23783) | SQLITE_PRIVATE int sqlite3HeapNearlyFull(void){
  function SQLITE_PRIVATE (line 23790) | SQLITE_PRIVATE void sqlite3MallocEnd(void){
  function SQLITE_STDCALL (line 23800) | SQLITE_STDCALL sqlite3_memory_used(void){
  function SQLITE_STDCALL (line 23811) | SQLITE_STDCALL sqlite3_memory_highwater(int resetFlag){
  function sqlite3MallocAlarm (line 23820) | static void sqlite3MallocAlarm(int nByte){
  function mallocWithAlarm (line 23831) | static int mallocWithAlarm(int n, void **pp){
  function SQLITE_PRIVATE (line 23866) | SQLITE_PRIVATE void *sqlite3Malloc(u64 n){
  function SQLITE_API (line 23891) | SQLITE_API void *SQLITE_STDCALL sqlite3_malloc(int n){
  function SQLITE_API (line 23897) | SQLITE_API void *SQLITE_STDCALL sqlite3_malloc64(sqlite3_uint64 n){
  function SQLITE_PRIVATE (line 23923) | SQLITE_PRIVATE void *sqlite3ScratchMalloc(int n){
  function SQLITE_PRIVATE (line 23960) | SQLITE_PRIVATE void sqlite3ScratchFree(void *p){
  function isLookaside (line 24007) | static int isLookaside(sqlite3 *db, void *p){
  function SQLITE_PRIVATE (line 24018) | SQLITE_PRIVATE int sqlite3MallocSize(void *p){
  function SQLITE_PRIVATE (line 24022) | SQLITE_PRIVATE int sqlite3DbMallocSize(sqlite3 *db, void *p){
  function SQLITE_STDCALL (line 24040) | SQLITE_STDCALL sqlite3_msize(void *p){
  function SQLITE_STDCALL (line 24049) | SQLITE_STDCALL sqlite3_free(void *p){
  function SQLITE_NOINLINE (line 24068) | static SQLITE_NOINLINE void measureAllocationSize(sqlite3 *db, void *p){
  function SQLITE_PRIVATE (line 24076) | SQLITE_PRIVATE void sqlite3DbFree(sqlite3 *db, void *p){
  function SQLITE_PRIVATE (line 24106) | SQLITE_PRIVATE void *sqlite3Realloc(void *pOld, u64 nBytes){
  function SQLITE_API (line 24158) | SQLITE_API void *SQLITE_STDCALL sqlite3_realloc(void *pOld, int n){
  function SQLITE_API (line 24165) | SQLITE_API void *SQLITE_STDCALL sqlite3_realloc64(void *pOld, sqlite3_ui...
  function SQLITE_PRIVATE (line 24176) | SQLITE_PRIVATE void *sqlite3MallocZero(u64 n){
  function SQLITE_PRIVATE (line 24188) | SQLITE_PRIVATE void *sqlite3DbMallocZero(sqlite3 *db, u64 n){
  function SQLITE_NOINLINE (line 24200) | static SQLITE_NOINLINE void *dbMallocRawFinish(sqlite3 *db, u64 n){
  function SQLITE_PRIVATE (line 24232) | SQLITE_PRIVATE void *sqlite3DbMallocRaw(sqlite3 *db, u64 n){
  function SQLITE_PRIVATE (line 24239) | SQLITE_PRIVATE void *sqlite3DbMallocRawNN(sqlite3 *db, u64 n){
  function SQLITE_PRIVATE (line 24281) | SQLITE_PRIVATE void *sqlite3DbRealloc(sqlite3 *db, void *p, u64 n){
  function SQLITE_NOINLINE (line 24288) | static SQLITE_NOINLINE void *dbReallocFinish(sqlite3 *db, void *p, u64 n){
  function SQLITE_PRIVATE (line 24318) | SQLITE_PRIVATE void *sqlite3DbReallocOrFree(sqlite3 *db, void *p, u64 n){
  function SQLITE_PRIVATE (line 24334) | SQLITE_PRIVATE char *sqlite3DbStrDup(sqlite3 *db, const char *z){
  function SQLITE_PRIVATE (line 24348) | SQLITE_PRIVATE char *sqlite3DbStrNDup(sqlite3 *db, const char *z, u64 n){
  function SQLITE_PRIVATE (line 24366) | SQLITE_PRIVATE void sqlite3SetString(char **pz, sqlite3 *db, const char ...
  function SQLITE_PRIVATE (line 24377) | SQLITE_PRIVATE void sqlite3OomFault(sqlite3 *db){
  function SQLITE_PRIVATE (line 24394) | SQLITE_PRIVATE void sqlite3OomClear(sqlite3 *db){
  function SQLITE_NOINLINE (line 24406) | static SQLITE_NOINLINE int apiOomError(sqlite3 *db){
  function SQLITE_PRIVATE (line 24424) | SQLITE_PRIVATE int sqlite3ApiExit(sqlite3* db, int rc){
  type etByte (line 24481) | typedef unsigned char etByte;
  type et_info (line 24487) | typedef struct et_info {   /* Information about each format field */
  function et_getdigit (line 24559) | static char et_getdigit(LONGDOUBLE_TYPE *val, int *cnt){
  function setStrAccumError (line 24575) | static void setStrAccumError(StrAccum *p, u8 eError){
  function sqlite3_int64 (line 24584) | static sqlite3_int64 getIntArg(PrintfArguments *p){
  function getDoubleArg (line 24588) | static double getDoubleArg(PrintfArguments *p){
  function SQLITE_PRIVATE (line 24610) | SQLITE_PRIVATE void sqlite3VXPrintf(
  function sqlite3StrAccumEnlarge (line 25193) | static int sqlite3StrAccumEnlarge(StrAccum *p, int N){
  function SQLITE_PRIVATE (line 25245) | SQLITE_PRIVATE void sqlite3AppendChar(StrAccum *p, int N, char c){
  function enlargeAndAppend (line 25262) | static void SQLITE_NOINLINE enlargeAndAppend(StrAccum *p, const char *z,...
  function SQLITE_PRIVATE (line 25275) | SQLITE_PRIVATE void sqlite3StrAccumAppend(StrAccum *p, const char *z, in...
  function SQLITE_PRIVATE (line 25292) | SQLITE_PRIVATE void sqlite3StrAccumAppendAll(StrAccum *p, const char *z){
  function SQLITE_PRIVATE (line 25302) | SQLITE_PRIVATE char *sqlite3StrAccumFinish(StrAccum *p){
  function SQLITE_PRIVATE (line 25322) | SQLITE_PRIVATE void sqlite3StrAccumReset(StrAccum *p){
  function SQLITE_PRIVATE (line 25345) | SQLITE_PRIVATE void sqlite3StrAccumInit(StrAccum *p, sqlite3 *db, char *...
  function SQLITE_PRIVATE (line 25359) | SQLITE_PRIVATE char *sqlite3VMPrintf(sqlite3 *db, const char *zFormat, v...
  function SQLITE_PRIVATE (line 25379) | SQLITE_PRIVATE char *sqlite3MPrintf(sqlite3 *db, const char *zFormat, ...){
  function SQLITE_API (line 25392) | SQLITE_API char *SQLITE_STDCALL sqlite3_vmprintf(const char *zFormat, va...
  function SQLITE_API (line 25416) | SQLITE_API char *SQLITE_CDECL sqlite3_mprintf(const char *zFormat, ...){
  function SQLITE_API (line 25441) | SQLITE_API char *SQLITE_STDCALL sqlite3_vsnprintf(int n, char *zBuf, con...
  function SQLITE_API (line 25455) | SQLITE_API char *SQLITE_CDECL sqlite3_snprintf(int n, char *zBuf, const ...
  function renderLogMsg (line 25478) | static void renderLogMsg(int iErrCode, const char *zFormat, va_list ap){
  function SQLITE_CDECL (line 25491) | SQLITE_CDECL sqlite3_log(int iErrCode, const char *zFormat, ...){
  function SQLITE_PRIVATE (line 25506) | SQLITE_PRIVATE void sqlite3DebugPrintf(const char *zFormat, ...){
  function SQLITE_PRIVATE (line 25525) | SQLITE_PRIVATE void sqlite3XPrintf(StrAccum *p, const char *zFormat, ...){
  function TreeView (line 25560) | static TreeView *sqlite3TreeViewPush(TreeView *p, u8 moreToFollow){
  function sqlite3TreeViewPop (line 25576) | static void sqlite3TreeViewPop(TreeView *p){
  function sqlite3TreeViewLine (line 25586) | static void sqlite3TreeViewLine(TreeView *p, const char *zFormat, ...){
  function sqlite3TreeViewItem (line 25610) | static void sqlite3TreeViewItem(TreeView *p, const char *zLabel,u8 moreF...
  function SQLITE_PRIVATE (line 25618) | SQLITE_PRIVATE void sqlite3TreeViewWith(TreeView *pView, const With *pWi...
  function SQLITE_PRIVATE (line 25658) | SQLITE_PRIVATE void sqlite3TreeViewSelect(TreeView *pView, const Select ...
  function SQLITE_PRIVATE (line 25766) | SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pEx...
  function SQLITE_PRIVATE (line 26000) | SQLITE_PRIVATE void sqlite3TreeViewExprList(
  function SQLITE_WSD (line 26053) | static SQLITE_WSD struct sqlite3PrngType {
  function SQLITE_STDCALL (line 26062) | SQLITE_STDCALL sqlite3_randomness(int N, void *pBuf){
  function SQLITE_PRIVATE (line 26149) | SQLITE_PRIVATE void sqlite3PrngSaveState(void){
  function SQLITE_PRIVATE (line 26156) | SQLITE_PRIVATE void sqlite3PrngRestoreState(void){
  type SQLiteThread (line 26208) | struct SQLiteThread {
  function SQLITE_PRIVATE (line 26217) | SQLITE_PRIVATE int sqlite3ThreadCreate(
  function SQLITE_PRIVATE (line 26254) | SQLITE_PRIVATE int sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){
  type SQLiteThread (line 26280) | struct SQLiteThread {
  function sqlite3ThreadProc (line 26289) | static unsigned __stdcall sqlite3ThreadProc(
  function SQLITE_PRIVATE (line 26312) | SQLITE_PRIVATE int sqlite3ThreadCreate(
  function SQLITE_PRIVATE (line 26350) | SQLITE_PRIVATE int sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){
  type SQLiteThread (line 26385) | struct SQLiteThread {
  function SQLITE_PRIVATE (line 26392) | SQLITE_PRIVATE int sqlite3ThreadCreate(
  function SQLITE_PRIVATE (line 26416) | SQLITE_PRIVATE int sqlite3ThreadJoin(SQLiteThread *p, void **ppOut){
  function SQLITE_PRIVATE (line 26609) | SQLITE_PRIVATE u32 sqlite3Utf8Read(
  function sqlite3VdbeMemTranslate (line 26645) | int sqlite3VdbeMemTranslate(Mem *pMem, u8 desiredEnc){
  function SQLITE_PRIVATE (line 26788) | SQLITE_PRIVATE int sqlite3VdbeMemHandleBom(Mem *pMem){
  function SQLITE_PRIVATE (line 26826) | SQLITE_PRIVATE int sqlite3Utf8CharLen(const char *zIn, int nByte){
  function SQLITE_PRIVATE (line 26856) | SQLITE_PRIVATE int sqlite3Utf8To8(unsigned char *zIn){
  function SQLITE_PRIVATE (line 26880) | SQLITE_PRIVATE char *sqlite3Utf16to8(sqlite3 *db, const void *z, int nBy...
  function SQLITE_PRIVATE (line 26901) | SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *zIn, int nChar){
  function SQLITE_PRIVATE (line 26926) | SQLITE_PRIVATE void sqlite3UtfSelfTest(void){
  function SQLITE_PRIVATE (line 27004) | SQLITE_PRIVATE void sqlite3Coverage(int x){
  function SQLITE_PRIVATE (line 27022) | SQLITE_PRIVATE int sqlite3FaultSim(int iTest){
  function SQLITE_PRIVATE (line 27035) | SQLITE_PRIVATE int sqlite3IsNaN(double x){
  function SQLITE_PRIVATE (line 27083) | SQLITE_PRIVATE int sqlite3Strlen30(const char *z){
  function SQLITE_PRIVATE (line 27095) | SQLITE_PRIVATE char *sqlite3ColumnType(Column *pCol, char *zDflt){
  function SQLITE_NOINLINE (line 27105) | static SQLITE_NOINLINE void  sqlite3ErrorFinish(sqlite3 *db, int err_code){
  function SQLITE_PRIVATE (line 27115) | SQLITE_PRIVATE void sqlite3Error(sqlite3 *db, int err_code){
  function SQLITE_PRIVATE (line 27125) | SQLITE_PRIVATE void sqlite3SystemError(sqlite3 *db, int rc){
  function SQLITE_PRIVATE (line 27154) | SQLITE_PRIVATE void sqlite3ErrorWithMsg(sqlite3 *db, int err_code, const...
  function SQLITE_PRIVATE (line 27187) | SQLITE_PRIVATE void sqlite3ErrorMsg(Parse *pParse, const char *zFormat, ...
  function SQLITE_PRIVATE (line 27221) | SQLITE_PRIVATE void sqlite3Dequote(char *z){
  function SQLITE_PRIVATE (line 27247) | SQLITE_PRIVATE void sqlite3TokenInit(Token *p, char *z){
  function SQLITE_STDCALL (line 27265) | SQLITE_STDCALL sqlite3_stricmp(const char *zLeft, const char *zRight){
  function SQLITE_PRIVATE (line 27273) | SQLITE_PRIVATE int sqlite3StrICmp(const char *zLeft, const char *zRight){
  function SQLITE_STDCALL (line 27286) | SQLITE_STDCALL sqlite3_strnicmp(const char *zLeft, const char *zRight, i...
  function SQLITE_PRIVATE (line 27321) | SQLITE_PRIVATE int sqlite3AtoF(const char *z, double *pResult, int lengt...
  function compare2pow63 (line 27511) | static int compare2pow63(const char *zNum, int incr){
  function SQLITE_PRIVATE (line 27547) | SQLITE_PRIVATE int sqlite3Atoi64(const char *zNum, i64 *pNum, int length...
  function SQLITE_PRIVATE (line 27633) | SQLITE_PRIVATE int sqlite3DecOrHexToI64(const char *z, i64 *pOut){
  function SQLITE_PRIVATE (line 27663) | SQLITE_PRIVATE int sqlite3GetInt32(const char *zNum, int *pValue){
  function SQLITE_PRIVATE (line 27721) | SQLITE_PRIVATE int sqlite3Atoi(const char *z){
  function putVarint64 (line 27756) | static int SQLITE_NOINLINE putVarint64(unsigned char *p, u64 v){
  function SQLITE_PRIVATE (line 27780) | SQLITE_PRIVATE int sqlite3PutVarint(unsigned char *p, u64 v){
  function SQLITE_PRIVATE (line 27810) | SQLITE_PRIVATE u8 sqlite3GetVarint(const unsigned char *p, u64 *v){
  function SQLITE_PRIVATE (line 27981) | SQLITE_PRIVATE u8 sqlite3GetVarint32(const unsigned char *p, u32 *v){
  function SQLITE_PRIVATE (line 28104) | SQLITE_PRIVATE int sqlite3VarintLen(u64 v){
  function SQLITE_PRIVATE (line 28114) | SQLITE_PRIVATE u32 sqlite3Get4byte(const u8 *p){
  function SQLITE_PRIVATE (line 28134) | SQLITE_PRIVATE void sqlite3Put4byte(unsigned char *p, u32 v){
  function SQLITE_PRIVATE (line 28160) | SQLITE_PRIVATE u8 sqlite3HexToInt(int h){
  function SQLITE_PRIVATE (line 28178) | SQLITE_PRIVATE void *sqlite3HexToBlob(sqlite3 *db, const char *z, int n){
  function logBadConnection (line 28199) | static void logBadConnection(const char *zType){
  function SQLITE_PRIVATE (line 28220) | SQLITE_PRIVATE int sqlite3SafetyCheckOk(sqlite3 *db){
  function SQLITE_PRIVATE (line 28237) | SQLITE_PRIVATE int sqlite3SafetyCheckSickOrOk(sqlite3 *db){
  function SQLITE_PRIVATE (line 28257) | SQLITE_PRIVATE int sqlite3AddInt64(i64 *pA, i64 iB){
  function SQLITE_PRIVATE (line 28273) | SQLITE_PRIVATE int sqlite3SubInt64(i64 *pA, i64 iB){
  function SQLITE_PRIVATE (line 28286) | SQLITE_PRIVATE int sqlite3MulInt64(i64 *pA, i64 iB){
  function SQLITE_PRIVATE (line 28321) | SQLITE_PRIVATE int sqlite3AbsInt32(int x){
  function SQLITE_PRIVATE (line 28345) | SQLITE_PRIVATE void sqlite3FileSuffix3(const char *zBaseFilename, char *z){
  function SQLITE_PRIVATE (line 28364) | SQLITE_PRIVATE LogEst sqlite3LogEstAdd(LogEst a, LogEst b){
  function SQLITE_PRIVATE (line 28391) | SQLITE_PRIVATE LogEst sqlite3LogEst(u64 x){
  function SQLITE_PRIVATE (line 28409) | SQLITE_PRIVATE LogEst sqlite3LogEstFromDouble(double x){
  function SQLITE_PRIVATE (line 28430) | SQLITE_PRIVATE u64 sqlite3LogEstToInt(LogEst x){
  function SQLITE_PRIVATE (line 28472) | SQLITE_PRIVATE void sqlite3HashInit(Hash *pNew){
  function SQLITE_PRIVATE (line 28484) | SQLITE_PRIVATE void sqlite3HashClear(Hash *pH){
  function strHash (line 28504) | static unsigned int strHash(const char *z){
  function insertElement (line 28517) | static void insertElement(
  function rehash (line 28551) | static int rehash(Hash *pH, unsigned int new_size){
  function HashElem (line 28591) | static HashElem *findElementWithHash(
  function removeElementGivenHash (line 28625) | static void removeElementGivenHash(
  function SQLITE_PRIVATE (line 28660) | SQLITE_PRIVATE void *sqlite3HashFind(const Hash *pH, const char *pKey){
  function SQLITE_PRIVATE (line 28684) | SQLITE_PRIVATE void *sqlite3HashInsert(Hash *pH, const char *pKey, void ...
  function SQLITE_PRIVATE (line 28730) | SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){
  type unixShm (line 29080) | typedef struct unixShm unixShm;
  type unixShmNode (line 29081) | typedef struct unixShmNode unixShmNode;
  type unixInodeInfo (line 29082) | typedef struct unixInodeInfo unixInodeInfo;
  type UnixUnusedFd (line 29083) | typedef struct UnixUnusedFd UnixUnusedFd;
  type UnixUnusedFd (line 29091) | struct UnixUnusedFd {
  type unixFile (line 29101) | typedef struct unixFile unixFile;
  type unixFile (line 29102) | struct unixFile {
  function sqlite_uint64 (line 29256) | __inline__ sqlite_uint64 sqlite3Hwtime(void){
  function sqlite_uint64 (line 29264) | __declspec(naked) __inline sqlite_uint64 __cdecl sqlite3Hwtime(void){
  function sqlite_uint64 (line 29275) | __inline__ sqlite_uint64 sqlite3Hwtime(void){
  function sqlite_uint64 (line 29283) | __inline__ sqlite_uint64 sqlite3Hwtime(void){
  function sqlite3Hwtime (line 29307) | sqlite3Hwtime(void){ return ((sqlite_uint64)0); }
  function local_ioerr (line 29345) | static void local_ioerr(){
  function posixOpen (line 29436) | static int posixOpen(const char *zFile, int flags, int mode){
  type unix_syscall (line 29450) | struct unix_syscall {
  type stat (line 29468) | struct stat
  type stat (line 29481) | struct stat
  type stat (line 29598) | struct stat
  function robustFchown (line 29608) | static int robustFchown(int fd, uid_t uid, gid_t gid){
  function unixSetSystemCall (line 29622) | static int unixSetSystemCall(
  function sqlite3_syscall_ptr (line 29665) | static sqlite3_syscall_ptr unixGetSystemCall(
  function robust_open (line 29725) | static int robust_open(const char *z, int f, mode_t m){
  function unixEnterMutex (line 29776) | static void unixEnterMutex(void){
  function unixLeaveMutex (line 29779) | static void unixLeaveMutex(void){
  function unixMutexHeld (line 29783) | static int unixMutexHeld(void) {
  function lockTrace (line 29816) | static int lockTrace(int fd, int op, struct flock *p){
  function robust_ftruncate (line 29874) | static int robust_ftruncate(int h, sqlite3_int64 sz){
  function sqliteErrorFromPosixError (line 29899) | static int sqliteErrorFromPosixError(int posixError, int sqliteIOErr) {
  type vxworksFileId (line 29941) | struct vxworksFileId {
  type vxworksFileId (line 29953) | struct vxworksFileId
  function vxworksSimplifyName (line 29968) | static int vxworksSimplifyName(char *z, int n){
  type vxworksFileId (line 30002) | struct vxworksFileId
  type vxworksFileId (line 30003) | struct vxworksFileId
  type vxworksFileId (line 30004) | struct vxworksFileId
  function vxworksReleaseFileId (line 30044) | static void vxworksReleaseFileId(struct vxworksFileId *pId){
  type unixFileId (line 30156) | struct unixFileId {
  type unixInodeInfo (line 30174) | struct unixInodeInfo {
  function unixLogErrorAtLine (line 30216) | static int unixLogErrorAtLine(
  function robust_close (line 30281) | static void robust_close(unixFile *pFile, int h, int lineno){
  function storeLastErrno (line 30292) | static void storeLastErrno(unixFile *pFile, int error){
  function closePendingFds (line 30299) | static void closePendingFds(unixFile *pFile){
  function releaseInodeInfo (line 30317) | static void releaseInodeInfo(unixFile *pFile){
  function findInodeInfo (line 30351) | static int findInodeInfo(
  function fileHasMoved (line 30434) | static int fileHasMoved(unixFile *pFile){
  function verifyDbFile (line 30454) | static void verifyDbFile(unixFile *pFile){
  function unixCheckReservedLock (line 30487) | static int unixCheckReservedLock(sqlite3_file *id, int *pResOut){
  function unixFileLock (line 30547) | static int unixFileLock(unixFile *pFile, struct flock *pLock){
  function unixLock (line 30597) | static int unixLock(sqlite3_file *id, int eFileLock){
  function setPendingFd (line 30824) | static void setPendingFd(unixFile *pFile){
  function posixUnlock (line 30846) | static int posixUnlock(sqlite3_file *id, int eFileLock, int handleNFSUnl...
  function unixUnlock (line 31006) | static int unixUnlock(sqlite3_file *id, int eFileLock){
  function closeUnixFile (line 31028) | static int closeUnixFile(sqlite3_file *id){
  function unixClose (line 31063) | static int unixClose(sqlite3_file *id){
  function nolockCheckReservedLock (line 31108) | static int nolockCheckReservedLock(sqlite3_file *NotUsed, int *pResOut){
  function nolockLock (line 31113) | static int nolockLock(sqlite3_file *NotUsed, int NotUsed2){
  function nolockUnlock (line 31117) | static int nolockUnlock(sqlite3_file *NotUsed, int NotUsed2){
  function nolockClose (line 31125) | static int nolockClose(sqlite3_file *id) {
  function dotlockCheckReservedLock (line 31170) | static int dotlockCheckReservedLock(sqlite3_file *id, int *pResOut) {
  function dotlockLock (line 31211) | static int dotlockLock(sqlite3_file *id, int eFileLock) {
  function dotlockUnlock (line 31261) | static int dotlockUnlock(sqlite3_file *id, int eFileLock) {
  function dotlockClose (line 31304) | static int dotlockClose(sqlite3_file *id) {
  function robust_flock (line 31334) | static int robust_flock(int fd, int op){
  function flockCheckReservedLock (line 31350) | static int flockCheckReservedLock(sqlite3_file *id, int *pResOut){
  function flockLock (line 31430) | static int flockLock(sqlite3_file *id, int eFileLock) {
  function flockUnlock (line 31474) | static int flockUnlock(sqlite3_file *id, int eFileLock) {
  function flockClose (line 31508) | static int flockClose(sqlite3_file *id) {
  function semXCheckReservedLock (line 31537) | static int semXCheckReservedLock(sqlite3_file *id, int *pResOut) {
  function semXLock (line 31604) | static int semXLock(sqlite3_file *id, int eFileLock) {
  function semXUnlock (line 31637) | static int semXUnlock(sqlite3_file *id, int eFileLock) {
  function semXClose (line 31674) | static int semXClose(sqlite3_file *id) {
  type afpLockingContext (line 31709) | typedef struct afpLockingContext afpLockingContext;
  type afpLockingContext (line 31710) | struct afpLockingContext {
  type ByteRangeLockPB2 (line 31715) | struct ByteRangeLockPB2
  function afpSetLock (line 31733) | static int afpSetLock(
  function afpCheckReservedLock (line 31779) | static int afpCheckReservedLock(sqlite3_file *id, int *pResOut){
  function afpLock (line 31849) | static int afpLock(sqlite3_file *id, int eFileLock){
  function afpUnlock (line 32031) | static int afpUnlock(sqlite3_file *id, int eFileLock) {
  function afpClose (line 32134) | static int afpClose(sqlite3_file *id) {
  function nfsUnlock (line 32176) | static int nfsUnlock(sqlite3_file *id, int eFileLock){
  function seekAndRead (line 32212) | static int seekAndRead(unixFile *id, sqlite3_int64 offset, void *pBuf, i...
  function unixRead (line 32261) | static int unixRead(
  function seekAndWriteFd (line 32320) | static int seekAndWriteFd(
  function seekAndWrite (line 32366) | static int seekAndWrite(unixFile *id, i64 offset, const void *pBuf, int ...
  function unixWrite (line 32375) | static int unixWrite(
  function full_fsync (line 32510) | static int full_fsync(int fd, int fullSync, int dataOnly){
  function openDirectory (line 32606) | static int openDirectory(const char *zFilename, int *pFd){
  function unixSync (line 32643) | static int unixSync(sqlite3_file *id, int flags){
  function unixTruncate (line 32693) | static int unixTruncate(sqlite3_file *id, i64 nByte){
  function unixFileSize (line 32743) | static int unixFileSize(sqlite3_file *id, i64 *pSize){
  function fcntlSizeHint (line 32781) | static int fcntlSizeHint(unixFile *pFile, i64 nByte){
  function unixModeBit (line 32850) | static void unixModeBit(unixFile *pFile, unsigned char mask, int *pArg){
  function unixFileControl (line 32866) | static int unixFileControl(sqlite3_file *id, int op, void *pArg){
  function unixSectorSize (line 32962) | static int unixSectorSize(sqlite3_file *NotUsed){
  function unixSectorSize (line 32974) | static int unixSectorSize(sqlite3_file *id){
  function unixDeviceCharacteristics (line 33061) | static int unixDeviceCharacteristics(sqlite3_file *id){
  function unixGetpagesize (line 33082) | static int unixGetpagesize(void){
  type unixShmNode (line 33125) | struct unixShmNode {
  type unixShm (line 33156) | struct unixShm {
  function unixShmSystemLock (line 33177) | static int unixShmSystemLock(
  function unixShmRegionPerMap (line 33256) | static int unixShmRegionPerMap(void){
  function unixShmPurge (line 33270) | static void unixShmPurge(unixFile *pFd){
  function unixOpenSharedMemory (line 33330) | static int unixOpenSharedMemory(unixFile *pDbFd){
  function unixShmMap (line 33479) | static int unixShmMap(
  function unixShmLock (line 33617) | static int unixShmLock(
  function unixShmBarrier (line 33729) | static void unixShmBarrier(
  function unixShmUnmap (line 33745) | static int unixShmUnmap(
  function unixUnmapfile (line 33801) | static void unixUnmapfile(unixFile *pFd){
  function unixRemapfile (line 33826) | static void unixRemapfile(
  function unixMapfile (line 33918) | static int unixMapfile(unixFile *pFd, i64 nMap){
  function unixFetch (line 33955) | static int unixFetch(sqlite3_file *fd, i64 iOff, int nAmt, void **pp){
  function unixUnfetch (line 33986) | static int unixUnfetch(sqlite3_file *fd, i64 iOff, void *p){
  function sqlite3_io_methods (line 34206) | static const sqlite3_io_methods *autolockIoFinderImpl(
  function sqlite3_io_methods (line 34270) | static const sqlite3_io_methods *vxworksIoFinderImpl(
  type sqlite3_io_methods (line 34303) | typedef const sqlite3_io_methods *(*finder_type)(const char*,unixFile*);
  function fillInUnixFile (line 34316) | static int fillInUnixFile(
  type stat (line 34513) | struct stat
  function unixGetTempname (line 34537) | static int unixGetTempname(int nBuf, char *zBuf){
  function UnixUnusedFd (line 34587) | static UnixUnusedFd *findReusableFd(const char *zPath, int flags){
  function findCreateFileMode (line 34650) | static int findCreateFileMode(
  function unixOpen (line 34730) | static int unixOpen(
  function unixDelete (line 34986) | static int unixDelete(
  function unixAccess (line 35034) | static int unixAccess(
  function mkFullPathname (line 35060) | static int mkFullPathname(
  function unixFullPathname (line 35093) | static int unixFullPathname(
  function unixDlError (line 35195) | static void unixDlError(sqlite3_vfs *NotUsed, int nBuf, char *zBufOut){
  function unixDlClose (line 35228) | static void unixDlClose(sqlite3_vfs *NotUsed, void *pHandle){
  function unixRandomness (line 35242) | static int unixRandomness(sqlite3_vfs *NotUsed, int nBuf, char *zBuf){
  function unixSleep (line 35289) | static int unixSleep(sqlite3_vfs *NotUsed, int microseconds){
  function unixCurrentTimeInt64 (line 35329) | static int unixCurrentTimeInt64(sqlite3_vfs *NotUsed, sqlite3_int64 *piN...
  function unixCurrentTime (line 35361) | static int unixCurrentTime(sqlite3_vfs *NotUsed, double *prNow){
  function unixGetLastError (line 35379) | static int unixGetLastError(sqlite3_vfs *NotUsed, int NotUsed2, char *No...
  type proxyLockingContext (line 35550) | typedef struct proxyLockingContext proxyLockingContext;
  type proxyLockingContext (line 35551) | struct proxyLockingContext {
  function proxyGetLockPath (line 35568) | static int proxyGetLockPath(const char *dbPath, char *lPath, size_t maxL...
  function proxyCreateLockPath (line 35609) | static int proxyCreateLockPath(const char *lockPath){
  function proxyCreateUnixFile (line 35649) | static int proxyCreateUnixFile(
  type timespec (line 35740) | struct timespec
  function proxyGetHostID (line 35746) | static int proxyGetHostID(unsigned char *pHostID, int *pError){
  function proxyBreakConchLock (line 35786) | static int proxyBreakConchLock(unixFile *pFile, uuid_t myHostID){
  function proxyConchLock (line 35846) | static int proxyConchLock(unixFile *pFile, uuid_t myHostID, int lockType){
  function proxyTakeConch (line 35924) | static int proxyTakeConch(unixFile *pFile){
  function proxyReleaseConch (line 36146) | static int proxyReleaseConch(unixFile *pFile){
  function proxyCreateConchPathname (line 36176) | static int proxyCreateConchPathname(char *dbPath, char **pConchPath){
  function switchLockProxyPath (line 36213) | static int switchLockProxyPath(unixFile *pFile, const char *path) {
  function proxyGetDbPathForUnixFile (line 36249) | static int proxyGetDbPathForUnixFile(unixFile *pFile, char *dbPath){
  function proxyTransformUnixFile (line 36280) | static int proxyTransformUnixFile(unixFile *pFile, const char *path) {
  function proxyFileControl (line 36367) | static int proxyFileControl(sqlite3_file *id, int op, void *pArg){
  function proxyCheckReservedLock (line 36440) | static int proxyCheckReservedLock(sqlite3_file *id, int *pResOut) {
  function proxyLock (line 36479) | static int proxyLock(sqlite3_file *id, int eFileLock) {
  function proxyUnlock (line 36503) | static int proxyUnlock(sqlite3_file *id, int eFileLock) {
  function proxyClose (line 36522) | static int proxyClose(sqlite3_file *id) {
  function SQLITE_STDCALL (line 36584) | SQLITE_STDCALL sqlite3_os_init(void){
  function SQLITE_STDCALL (line 36683) | SQLITE_STDCALL sqlite3_os_end(void){
  function sqlite_uint64 (line 36785) | __inline__ sqlite_uint64 sqlite3Hwtime(void){
  function sqlite_uint64 (line 36793) | __declspec(naked) __inline sqlite_uint64 __cdecl sqlite3Hwtime(void){
  function sqlite_uint64 (line 36804) | __inline__ sqlite_uint64 sqlite3Hwtime(void){
  function sqlite_uint64 (line 36812) | __inline__ sqlite_uint64 sqlite3Hwtime(void){
  function sqlite3Hwtime (line 36836) | sqlite3Hwtime(void){ return ((sqlite_uint64)0); }
  function local_ioerr (line 36874) | static void local_ioerr(){
  type winShm (line 37129) | typedef struct winShm winShm;
  type winShmNode (line 37130) | typedef struct winShmNode winShmNode;
  type winceLock (line 37138) | typedef struct winceLock {
  type winFile (line 37150) | typedef struct winFile winFile;
  type winFile (line 37151) | struct winFile {
  type winMemData (line 37275) | typedef struct winMemData winMemData;
  type winMemData (line 37276) | struct winMemData {
  type winMemData (line 37292) | struct winMemData
  type win_syscall (line 37361) | struct win_syscall {
  function winSetSystemCall (line 38022) | static int winSetSystemCall(
  function sqlite3_syscall_ptr (line 38065) | static sqlite3_syscall_ptr winGetSystemCall(
  function SQLITE_STDCALL (line 38107) | SQLITE_STDCALL sqlite3_win32_compact_heap(LPUINT pnLargest){
  function SQLITE_STDCALL (line 38147) | SQLITE_STDCALL sqlite3_win32_reset_heap(){
  function SQLITE_STDCALL (line 38192) | SQLITE_STDCALL sqlite3_win32_write_debug(const char *zBuf, int nBuf){
  function SQLITE_STDCALL (line 38238) | SQLITE_STDCALL sqlite3_win32_sleep(DWORD milliseconds){
  function SQLITE_PRIVATE (line 38253) | SQLITE_PRIVATE DWORD sqlite3Win32Wait(HANDLE hObject){
  function SQLITE_STDCALL (line 38287) | SQLITE_STDCALL sqlite3_win32_is_nt(void){
  function winMemFree (line 38349) | static void winMemFree(void *pPrior){
  function winMemSize (line 38397) | static int winMemSize(void *p){
  function winMemRoundup (line 38421) | static int winMemRoundup(int n){
  function winMemInit (line 38428) | static int winMemInit(void *pAppData){
  function winMemShutdown (line 38477) | static void winMemShutdown(void *pAppData){
  function SQLITE_PRIVATE (line 38508) | SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetWin32(void){
  function SQLITE_PRIVATE (line 38522) | SQLITE_PRIVATE void sqlite3MemSetDefault(void){
  function LPWSTR (line 38532) | static LPWSTR winUtf8ToUnicode(const char *zText){
  function LPWSTR (line 38585) | static LPWSTR winMbcsToUnicode(const char *zText, int useAnsi){
  function SQLITE_STDCALL (line 38675) | SQLITE_STDCALL sqlite3_win32_utf8_to_unicode(const char *zText){
  function SQLITE_API (line 38691) | SQLITE_API char *SQLITE_STDCALL sqlite3_win32_unicode_to_utf8(LPCWSTR zW...
  function SQLITE_API (line 38707) | SQLITE_API char *SQLITE_STDCALL sqlite3_win32_mbcs_to_utf8(const char *z...
  function SQLITE_API (line 38723) | SQLITE_API char *SQLITE_STDCALL sqlite3_win32_mbcs_to_utf8_v2(const char...
  function SQLITE_API (line 38739) | SQLITE_API char *SQLITE_STDCALL sqlite3_win32_utf8_to_mbcs(const char *z...
  function SQLITE_API (line 38755) | SQLITE_API char *SQLITE_STDCALL sqlite3_win32_utf8_to_mbcs_v2(const char...
  function SQLITE_STDCALL (line 38775) | SQLITE_STDCALL sqlite3_win32_set_directory(DWORD type, LPCWSTR zValue){
  function winGetLastErrorMsg (line 38810) | static int winGetLastErrorMsg(DWORD lastErrno, int nBuf, char *zBuf){
  function winLogErrorAtLine (line 38901) | static int winLogErrorAtLine(
  function winRetryIoerr (line 38971) | static int winRetryIoerr(int *pnRetry, DWORD *pError){
  function winLogIoerr (line 39000) | static void winLogIoerr(int nRetry, int lineno){
  type tm (line 39020) | struct tm
  type tm (line 39022) | struct tm
  function winceMutexAcquire (line 39052) | static void winceMutexAcquire(HANDLE h){
  function winceCreateLock (line 39067) | static int winceCreateLock(const char *zFilename, winFile *pFile){
  function winceDestroyLock (line 39161) | static void winceDestroyLock(winFile *pFile){
  function BOOL (line 39195) | static BOOL winceLockFile(
  function BOOL (line 39261) | static BOOL winceUnlockFile(
  function BOOL (line 39330) | static BOOL winLockFile(
  function BOOL (line 39362) | static BOOL winUnlockFile(
  function winSeekFile (line 39407) | static int winSeekFile(winFile *pFile, sqlite3_int64 iOffset){
  function winClose (line 39480) | static int winClose(sqlite3_file *id){
  function winTruncate (line 39720) | static int winTruncate(sqlite3_file *id, sqlite3_int64 nByte){
  function winSync (line 39777) | static int winSync(sqlite3_file *id, int flags){
  function winFileSize (line 39862) | static int winFileSize(sqlite3_file *id, sqlite3_int64 *pSize){
  function winGetReadLock (line 39940) | static int winGetReadLock(winFile *pFile){
  function winUnlockReadLock (line 39975) | static int winUnlockReadLock(winFile *pFile){
  function winLock (line 40022) | static int winLock(sqlite3_file *id, int locktype){
  function winCheckReservedLock (line 40165) | static int winCheckReservedLock(sqlite3_file *id, int *pResOut){
  function winUnlock (line 40201) | static int winUnlock(sqlite3_file *id, int locktype){
  function winModeBit (line 40240) | static void winModeBit(winFile *pFile, unsigned char mask, int *pArg){
  function winFileControl (line 40258) | static int winFileControl(sqlite3_file *id, int op, void *pArg){
  function winSectorSize (line 40379) | static int winSectorSize(sqlite3_file *id){
  function winDeviceCharacteristics (line 40387) | static int winDeviceCharacteristics(sqlite3_file *id){
  function winShmEnterMutex (line 40416) | static void winShmEnterMutex(void){
  function winShmLeaveMutex (line 40419) | static void winShmLeaveMutex(void){
  function winShmMutexHeld (line 40423) | static int winShmMutexHeld(void) {
  type winShmNode (line 40451) | struct winShmNode {
  type winShm (line 40492) | struct winShm {
  function winShmSystemLock (line 40515) | static int winShmSystemLock(
  function winShmPurge (line 40563) | static void winShmPurge(sqlite3_vfs *pVfs, int deleteFlag){
  function winOpenSharedMemory (line 40612) | static int winOpenSharedMemory(winFile *pDbFd){
  function winShmUnmap (line 40725) | static int winShmUnmap(
  function winShmLock (line 40766) | static int winShmLock(
  function winShmBarrier (line 40875) | static void winShmBarrier(
  function winShmMap (line 40903) | static int winShmMap(
  function winUnmapfile (line 41043) | static int winUnmapfile(winFile *pFile){
  function winMapfile (line 41093) | static int winMapfile(winFile *pFd, sqlite3_int64 nByte){
  function winFetch (line 41192) | static int winFetch(sqlite3_file *fd, i64 iOff, int nAmt, void **pp){
  function winUnfetch (line 41233) | static int winUnfetch(sqlite3_file *fd, i64 iOff, void *p){
  function winMakeEndInDirSep (line 41351) | static int winMakeEndInDirSep(int nBuf, char *zBuf){
  function winGetTempname (line 41371) | static int winGetTempname(sqlite3_vfs *pVfs, char **pzBuf){
  function winIsDir (line 41602) | static int winIsDir(const void *zConverted){
  function winOpen (line 41629) | static int winOpen(
  function winDelete (line 41920) | static int winDelete(
  function winAccess (line 42028) | static int winAccess(
  function BOOL (line 42106) | static BOOL winIsDriveLetterAndColon(
  function BOOL (line 42118) | static BOOL winIsVerbatimPathname(
  function winFullPathname (line 42154) | static int winFullPathname(
  function winDlError (line 42378) | static void winDlError(sqlite3_vfs *pVfs, int nBuf, char *zBufOut){
  function winDlClose (line 42390) | static void winDlClose(sqlite3_vfs *pVfs, void *pHandle){
  type EntropyGatherer (line 42403) | typedef struct EntropyGatherer EntropyGatherer;
  type EntropyGatherer (line 42404) | struct EntropyGatherer {
  function xorMemory (line 42413) | static void xorMemory(EntropyGatherer *p, unsigned char *x, int sz){
  function winRandomness (line 42427) | static int winRandomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf){
  function winSleep (line 42487) | static int winSleep(sqlite3_vfs *pVfs, int microsec){
  function winCurrentTimeInt64 (line 42512) | static int winCurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_int64 *piNow){
  function winCurrentTime (line 42555) | static int winCurrentTime(sqlite3_vfs *pVfs, double *prNow){
  function winGetLastError (line 42595) | static int winGetLastError(sqlite3_vfs *pVfs, int nBuf, char *zBuf){
  function SQLITE_STDCALL (line 42605) | SQLITE_STDCALL sqlite3_os_init(void){
  function SQLITE_STDCALL (line 42680) | SQLITE_STDCALL sqlite3_os_end(void){
  type Bitvec (line 42787) | struct Bitvec {
  function SQLITE_PRIVATE (line 42808) | SQLITE_PRIVATE Bitvec *sqlite3BitvecCreate(u32 iSize){
  function SQLITE_PRIVATE (line 42823) | SQLITE_PRIVATE int sqlite3BitvecTestNotNull(Bitvec *p, u32 i){
  function SQLITE_PRIVATE (line 42846) | SQLITE_PRIVATE int sqlite3BitvecTest(Bitvec *p, u32 i){
  function SQLITE_PRIVATE (line 42862) | SQLITE_PRIVATE int sqlite3BitvecSet(Bitvec *p, u32 i){
  function SQLITE_PRIVATE (line 42933) | SQLITE_PRIVATE void sqlite3BitvecClear(Bitvec *p, u32 i, void *pBuf){
  function SQLITE_PRIVATE (line 42970) | SQLITE_PRIVATE void sqlite3BitvecDestroy(Bitvec *p){
  function SQLITE_PRIVATE (line 42985) | SQLITE_PRIVATE u32 sqlite3BitvecSize(Bitvec *p){
  function SQLITE_PRIVATE (line 43030) | SQLITE_PRIVATE int sqlite3BitvecBuiltinTest(int sz, int *aOp){
  type PCache (line 43148) | struct PCache {
  function pcacheDump (line 43176) | void pcacheDump(PCache *pCache){
  function SQLITE_PRIVATE (line 43215) | SQLITE_PRIVATE int sqlite3PcachePageSanity(PgHdr *pPg){
  function pcacheManageDirtyList (line 43265) | static void pcacheManageDirtyList(PgHdr *pPage, u8 addRemove){
  function pcacheUnpin (line 43338) | static void pcacheUnpin(PgHdr *p){
  function numberOfCachePages (line 43350) | static int numberOfCachePages(PCache *p){
  function SQLITE_PRIVATE (line 43368) | SQLITE_PRIVATE int sqlite3PcacheInitialize(void){
  function SQLITE_PRIVATE (line 43377) | SQLITE_PRIVATE void sqlite3PcacheShutdown(void){
  function SQLITE_PRIVATE (line 43387) | SQLITE_PRIVATE int sqlite3PcacheSize(void){ return sizeof(PCache); }
  function SQLITE_PRIVATE (line 43395) | SQLITE_PRIVATE int sqlite3PcacheOpen(
  function SQLITE_PRIVATE (line 43420) | SQLITE_PRIVATE int sqlite3PcacheSetPageSize(PCache *pCache, int szPage){
  function SQLITE_PRIVATE (line 43464) | SQLITE_PRIVATE sqlite3_pcache_page *sqlite3PcacheFetch(
  function SQLITE_PRIVATE (line 43506) | SQLITE_PRIVATE int sqlite3PcacheFetchStress(
  function SQLITE_NOINLINE (line 43562) | static SQLITE_NOINLINE PgHdr *pcacheFetchFinishWithInit(
  function SQLITE_PRIVATE (line 43588) | SQLITE_PRIVATE PgHdr *sqlite3PcacheFetchFinish(
  function SQLITE_NOINLINE (line 43611) | SQLITE_NOINLINE sqlite3PcacheRelease(PgHdr *p){
  function SQLITE_PRIVATE (line 43630) | SQLITE_PRIVATE void sqlite3PcacheRef(PgHdr *p){
  function SQLITE_PRIVATE (line 43642) | SQLITE_PRIVATE void sqlite3PcacheDrop(PgHdr *p){
  function SQLITE_PRIVATE (line 43656) | SQLITE_PRIVATE void sqlite3PcacheMakeDirty(PgHdr *p){
  function SQLITE_PRIVATE (line 43675) | SQLITE_PRIVATE void sqlite3PcacheMakeClean(PgHdr *p){
  function SQLITE_PRIVATE (line 43693) | SQLITE_PRIVATE void sqlite3PcacheCleanAll(PCache *pCache){
  function SQLITE_PRIVATE (line 43704) | SQLITE_PRIVATE void sqlite3PcacheClearWritable(PCache *pCache){
  function SQLITE_PRIVATE (line 43716) | SQLITE_PRIVATE void sqlite3PcacheClearSyncFlags(PCache *pCache){
  function SQLITE_PRIVATE (line 43727) | SQLITE_PRIVATE void sqlite3PcacheMove(PgHdr *p, Pgno newPgno){
  function SQLITE_PRIVATE (line 43749) | SQLITE_PRIVATE void sqlite3PcacheTruncate(PCache *pCache, Pgno pgno){
  function SQLITE_PRIVATE (line 43782) | SQLITE_PRIVATE void sqlite3PcacheClose(PCache *pCache){
  function SQLITE_PRIVATE (line 43791) | SQLITE_PRIVATE void sqlite3PcacheClear(PCache *pCache){
  function PgHdr (line 43799) | static PgHdr *pcacheMergeDirtyList(PgHdr *pA, PgHdr *pB){
  function PgHdr (line 43834) | static PgHdr *pcacheSortDirtyList(PgHdr *pIn){
  function SQLITE_PRIVATE (line 43868) | SQLITE_PRIVATE PgHdr *sqlite3PcacheDirtyList(PCache *pCache){
  function SQLITE_PRIVATE (line 43882) | SQLITE_PRIVATE int sqlite3PcacheRefCount(PCache *pCache){
  function SQLITE_PRIVATE (line 43889) | SQLITE_PRIVATE int sqlite3PcachePageRefcount(PgHdr *p){
  function SQLITE_PRIVATE (line 43896) | SQLITE_PRIVATE int sqlite3PcachePagecount(PCache *pCache){
  function SQLITE_PRIVATE (line 43905) | SQLITE_PRIVATE int sqlite3PcacheGetCachesize(PCache *pCache){
  function SQLITE_PRIVATE (line 43913) | SQLITE_PRIVATE void sqlite3PcacheSetCachesize(PCache *pCache, int mxPage){
  function SQLITE_PRIVATE (line 43925) | SQLITE_PRIVATE int sqlite3PcacheSetSpillsize(PCache *p, int mxPage){
  function SQLITE_PRIVATE (line 43942) | SQLITE_PRIVATE void sqlite3PcacheShrink(PCache *pCache){
  function SQLITE_PRIVATE (line 43951) | SQLITE_PRIVATE int sqlite3HeaderSizePcache(void){ return ROUND8(sizeof(P...
  function SQLITE_PRIVATE (line 43957) | SQLITE_PRIVATE int sqlite3PCachePercentDirty(PCache *pCache){
  function SQLITE_PRIVATE (line 43971) | SQLITE_PRIVATE void sqlite3PcacheIterateDirty(PCache *pCache, void (*xIt...
  type PCache1 (line 44065) | typedef struct PCache1 PCache1;
  type PgHdr1 (line 44066) | typedef struct PgHdr1 PgHdr1;
  type PgFreeslot (line 44067) | typedef struct PgFreeslot PgFreeslot;
  type PGroup (line 44068) | typedef struct PGroup PGroup;
  type PgHdr1 (line 44076) | struct PgHdr1 {
  type PGroup (line 44110) | struct PGroup {
  type PCache1 (line 44127) | struct PCache1 {
  type PgFreeslot (line 44158) | struct PgFreeslot {
  function SQLITE_WSD (line 44165) | static SQLITE_WSD struct PCacheGlobal {
  function SQLITE_PRIVATE (line 44224) | SQLITE_PRIVATE void sqlite3PCacheBufferSetup(void *pBuf, int sz, int n){
  function pcache1InitBulk (line 44249) | static int pcache1InitBulk(PCache1 *pCache){
  function pcache1Free (line 44330) | static void pcache1Free(void *p){
  function pcache1MemSize (line 44363) | static int pcache1MemSize(void *p){
  function PgHdr1 (line 44380) | static PgHdr1 *pcache1AllocPage(PCache1 *pCache, int benignMalloc){
  function pcache1FreePage (line 44430) | static void pcache1FreePage(PgHdr1 *p){
  function SQLITE_PRIVATE (line 44454) | SQLITE_PRIVATE void *sqlite3PageMalloc(int sz){
  function SQLITE_PRIVATE (line 44461) | SQLITE_PRIVATE void sqlite3PageFree(void *p){
  function pcache1UnderMemoryPressure (line 44482) | static int pcache1UnderMemoryPressure(PCache1 *pCache){
  function pcache1ResizeHash (line 44499) | static void pcache1ResizeHash(PCache1 *p){
  function PgHdr1 (line 44540) | static PgHdr1 *pcache1PinPage(PgHdr1 *pPage){
  function pcache1RemoveFromHash (line 44568) | static void pcache1RemoveFromHash(PgHdr1 *pPage, int freeFlag){
  function pcache1EnforceMaxPage (line 44586) | static void pcache1EnforceMaxPage(PCache1 *pCache){
  function pcache1TruncateUnsafe (line 44611) | static void pcache1TruncateUnsafe(
  function pcache1Init (line 44642) | static int pcache1Init(void *NotUsed){
  function pcache1Shutdown (line 44695) | static void pcache1Shutdown(void *NotUsed){
  function sqlite3_pcache (line 44709) | static sqlite3_pcache *pcache1Create(int szPage, int szExtra, int bPurge...
  function pcache1Cachesize (line 44756) | static void pcache1Cachesize(sqlite3_pcache *p, int nMax){
  function pcache1Shrink (line 44775) | static void pcache1Shrink(sqlite3_pcache *p){
  function pcache1Pagecount (line 44792) | static int pcache1Pagecount(sqlite3_pcache *p){
  function SQLITE_NOINLINE (line 44810) | static SQLITE_NOINLINE PgHdr1 *pcache1FetchStage2(
  function PgHdr1 (line 44938) | static PgHdr1 *pcache1FetchNoMutex(
  function PgHdr1 (line 44968) | static PgHdr1 *pcache1FetchWithMutex(
  function sqlite3_pcache_page (line 44983) | static sqlite3_pcache_page *pcache1Fetch(
  function pcache1Unpin (line 45014) | static void pcache1Unpin(
  function pcache1Rekey (line 45050) | static void pcache1Rekey(
  function pcache1Truncate (line 45090) | static void pcache1Truncate(sqlite3_pcache *p, unsigned int iLimit){
  function pcache1Destroy (line 45105) | static void pcache1Destroy(sqlite3_pcache *p){
  function SQLITE_PRIVATE (line 45128) | SQLITE_PRIVATE void sqlite3PCacheSetDefault(void){
  function SQLITE_PRIVATE (line 45150) | SQLITE_PRIVATE int sqlite3HeaderSizePcache1(void){ return ROUND8(sizeof(...
  function SQLITE_PRIVATE (line 45156) | SQLITE_PRIVATE sqlite3_mutex *sqlite3Pcache1Mutex(void){
  function SQLITE_PRIVATE (line 45170) | SQLITE_PRIVATE int sqlite3PcacheReleaseMemory(int nReq){
  function SQLITE_PRIVATE (line 45200) | SQLITE_PRIVATE void sqlite3PcacheStats(
  type RowSetEntry (line 45306) | struct RowSetEntry {
  type RowSetChunk (line 45318) | struct RowSetChunk {
  type RowSet (line 45328) | struct RowSet {
  function SQLITE_PRIVATE (line 45358) | SQLITE_PRIVATE RowSet *sqlite3RowSetInit(sqlite3 *db, void *pSpace, unsi...
  function SQLITE_PRIVATE (line 45379) | SQLITE_PRIVATE void sqlite3RowSetClear(RowSet *p){
  type RowSetEntry (line 45401) | struct RowSetEntry
  type RowSetChunk (line 45406) | struct RowSetChunk
  function SQLITE_PRIVATE (line 45426) | SQLITE_PRIVATE void sqlite3RowSetInsert(RowSet *p, i64 rowid){
  type RowSetEntry (line 45457) | struct RowSetEntry
  type RowSetEntry (line 45458) | struct RowSetEntry
  type RowSetEntry (line 45459) | struct RowSetEntry
  type RowSetEntry (line 45461) | struct RowSetEntry
  type RowSetEntry (line 45462) | struct RowSetEntry
  type RowSetEntry (line 45494) | struct RowSetEntry
  type RowSetEntry (line 45494) | struct RowSetEntry
  type RowSetEntry (line 45496) | struct RowSetEntry
  function rowSetTreeToList (line 45522) | static void rowSetTreeToList(
  type RowSetEntry (line 45557) | struct RowSetEntry
  type RowSetEntry (line 45558) | struct RowSetEntry
  type RowSetEntry (line 45561) | struct RowSetEntry
  type RowSetEntry (line 45562) | struct RowSetEntry
  type RowSetEntry (line 45593) | struct RowSetEntry
  type RowSetEntry (line 45593) | struct RowSetEntry
  type RowSetEntry (line 45595) | struct RowSetEntry
  type RowSetEntry (line 45596) | struct RowSetEntry
  function SQLITE_PRIVATE (line 45625) | SQLITE_PRIVATE int sqlite3RowSetNext(RowSet *p, i64 *pRowid){
  function SQLITE_PRIVATE (line 45659) | SQLITE_PRIVATE int sqlite3RowSetTest(RowSet *pRowSet, int iBatch, sqlite...
  type Wal (line 45801) | typedef struct Wal Wal;
  type PagerSavepoint (line 46317) | typedef struct PagerSavepoint PagerSavepoint;
  type PagerSavepoint (line 46318) | struct PagerSavepoint {
  type Pager (line 46492) | struct Pager {
  function pagerUseWal (line 46692) | static int pagerUseWal(Pager *pPager){
  function assert_pager_state (line 46712) | static int assert_pager_state(Pager *p){
  function subjRequiresPage (line 46902) | static int subjRequiresPage(PgHdr *pPg){
  function pageInJournal (line 46920) | static int pageInJournal(Pager *pPager, PgHdr *pPg){
  function read32bits (line 46932) | static int read32bits(sqlite3_file *fd, i64 offset, u32 *pRes){
  function write32bits (line 46951) | static int write32bits(sqlite3_file *fd, i64 offset, u32 val){
  function pagerUnlockDb (line 46966) | static int pagerUnlockDb(Pager *pPager, int eLock){
  function pagerLockDb (line 46993) | static int pagerLockDb(Pager *pPager, int eLock){
  function jrnlBufferSize (line 47025) | static int jrnlBufferSize(Pager *pPager){
  function u32 (line 47059) | static u32 pager_datahash(int nByte, unsigned char *pData){
  function u32 (line 47067) | static u32 pager_pagehash(PgHdr *pPage){
  function pager_set_pagehash (line 47070) | static void pager_set_pagehash(PgHdr *pPage){
  function checkPage (line 47080) | static void checkPage(PgHdr *pPg){
  function readMasterJournal (line 47118) | static int readMasterJournal(sqlite3_file *pJrnl, char *zMaster, u32 nMa...
  function i64 (line 47172) | static i64 journalHdrOffset(Pager *pPager){
  function zeroJournalHdr (line 47205) | static int zeroJournalHdr(Pager *pPager, int doTruncate){
  function writeJournalHdr (line 47255) | static int writeJournalHdr(Pager *pPager){
  function readJournalHdr (line 47373) | static int readJournalHdr(
  function writeMasterJournal (line 47498) | static int writeMasterJournal(Pager *pPager, const char *zMaster){
  function pager_reset (line 47566) | static void pager_reset(Pager *pPager){
  function SQLITE_PRIVATE (line 47575) | SQLITE_PRIVATE u32 sqlite3PagerDataVersion(Pager *pPager){
  function releaseAllSavepoints (line 47585) | static void releaseAllSavepoints(Pager *pPager){
  function addToSavepointBitvecs (line 47604) | static int addToSavepointBitvecs(Pager *pPager, Pgno pgno){
  function pager_unlock (line 47636) | static void pager_unlock(Pager *pPager){
  function pager_error (line 47733) | static int pager_error(Pager *pPager, int rc){
  function pagerFlushOnCommit (line 47766) | static int pagerFlushOnCommit(Pager *pPager, int bCommit){
  function pager_end_transaction (line 47826) | static int pager_end_transaction(Pager *pPager, int hasMaster, int bComm...
  function pagerUnlockAndRollback (line 47972) | static void pagerUnlockAndRollback(Pager *pPager){
  function u32 (line 48006) | static u32 pager_cksum(Pager *pPager, const u8 *aData){
  function pagerReportSize (line 48021) | static void pagerReportSize(Pager *pPager){
  function SQLITE_PRIVATE (line 48037) | SQLITE_PRIVATE void sqlite3PagerAlignReserve(Pager *pDest, Pager *pSrc){
  function pager_playback_one_page (line 48082) | static int pager_playback_one_page(
  function pager_delmaster (line 48327) | static int pager_delmaster(Pager *pPager, const char *zMaster){
  function pager_truncate (line 48437) | static int pager_truncate(Pager *pPager, Pgno nPage){
  function SQLITE_PRIVATE (line 48473) | SQLITE_PRIVATE int sqlite3SectorSize(sqlite3_file *pFile){
  function setSectorSize (line 48507) | static void setSectorSize(Pager *pPager){
  function pager_playback (line 48580) | static int pager_playback(Pager *pPager, int isHot){
  function readDbPage (line 48788) | static int readDbPage(PgHdr *pPg, u32 iFrame){
  function pager_write_changecounter (line 48850) | static void pager_write_changecounter(PgHdr *pPg){
  function pagerUndoCallback (line 48877) | static int pagerUndoCallback(void *pCtx, Pgno iPg){
  function pagerRollbackWal (line 48916) | static int pagerRollbackWal(Pager *pPager){
  function pagerWalFrames (line 48948) | static int pagerWalFrames(
  function pagerBeginReadTransaction (line 49015) | static int pagerBeginReadTransaction(Pager *pPager){
  function pagerPagecount (line 49048) | static int pagerPagecount(Pager *pPager, Pgno *pnPage){
  function pagerOpenWalIfPresent (line 49108) | static int pagerOpenWalIfPresent(Pager *pPager){
  function pagerPlaybackSavepoint (line 49177) | static int pagerPlaybackSavepoint(Pager *pPager, PagerSavepoint *pSavepo...
  function SQLITE_PRIVATE (line 49289) | SQLITE_PRIVATE void sqlite3PagerSetCachesize(Pager *pPager, int mxPage){
  function SQLITE_PRIVATE (line 49297) | SQLITE_PRIVATE int sqlite3PagerSetSpillsize(Pager *pPager, int mxPage){
  function pagerFixMaplimit (line 49304) | static void pagerFixMaplimit(Pager *pPager){
  function SQLITE_PRIVATE (line 49319) | SQLITE_PRIVATE void sqlite3PagerSetMmapLimit(Pager *pPager, sqlite3_int6...
  function SQLITE_PRIVATE (line 49327) | SQLITE_PRIVATE void sqlite3PagerShrink(Pager *pPager){
  function SQLITE_PRIVATE (line 49383) | SQLITE_PRIVATE void sqlite3PagerSetFlags(
  function pagerOpentemp (line 49446) | static int pagerOpentemp(
  function SQLITE_PRIVATE (line 49485) | SQLITE_PRIVATE void sqlite3PagerSetBusyhandler(
  function SQLITE_PRIVATE (line 49531) | SQLITE_PRIVATE int sqlite3PagerSetPagesize(Pager *pPager, u32 *pPageSize...
  function SQLITE_PRIVATE (line 49594) | SQLITE_PRIVATE void *sqlite3PagerTempSpace(Pager *pPager){
  function SQLITE_PRIVATE (line 49605) | SQLITE_PRIVATE int sqlite3PagerMaxPageCount(Pager *pPager, int mxPage){
  function disable_simulated_io_errors (line 49626) | void disable_simulated_io_errors(void){
  function enable_simulated_io_errors (line 49630) | void enable_simulated_io_errors(void){
  function SQLITE_PRIVATE (line 49652) | SQLITE_PRIVATE int sqlite3PagerReadFileheader(Pager *pPager, int N, unsi...
  function SQLITE_PRIVATE (line 49680) | SQLITE_PRIVATE void sqlite3PagerPagecount(Pager *pPager, int *pnPage){
  function pager_wait_on_lock (line 49701) | static int pager_wait_on_lock(Pager *pPager, int locktype){
  function assertTruncateConstraintCb (line 49743) | static void assertTruncateConstraintCb(PgHdr *pPg){
  function assertTruncateConstraint (line 49747) | static void assertTruncateConstraint(Pager *pPager){
  function SQLITE_PRIVATE (line 49765) | SQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager *pPager, Pgno nPage){
  function pagerSyncHotJournal (line 49796) | static int pagerSyncHotJournal(Pager *pPager){
  function pagerAcquireMapPage (line 49817) | static int pagerAcquireMapPage(
  function pagerReleaseMapPage (line 49859) | static void pagerReleaseMapPage(PgHdr *pPg){
  function pagerFreeMapHdrs (line 49872) | static void pagerFreeMapHdrs(Pager *pPager){
  function SQLITE_PRIVATE (line 49896) | SQLITE_PRIVATE int sqlite3PagerClose(Pager *pPager){
  function SQLITE_PRIVATE (line 49953) | SQLITE_PRIVATE Pgno sqlite3PagerPagenumber(DbPage *pPg){
  function SQLITE_PRIVATE (line 49961) | SQLITE_PRIVATE void sqlite3PagerRef(DbPage *pPg){
  function syncJournal (line 50000) | static int syncJournal(Pager *pPager, int newHdr){
  function pager_write_pagelist (line 50143) | static int pager_write_pagelist(Pager *pPager, PgHdr *pList){
  function openSubJournal (line 50235) | static int openSubJournal(Pager *pPager){
  function subjournalPage (line 50261) | static int subjournalPage(PgHdr *pPg){
  function subjournalPageIfRequired (line 50298) | static int subjournalPageIfRequired(PgHdr *pPg){
  function pagerStress (line 50325) | static int pagerStress(void *p, PgHdr *pPg){
  function SQLITE_PRIVATE (line 50394) | SQLITE_PRIVATE int sqlite3PagerFlush(Pager *pPager){
  function SQLITE_PRIVATE (line 50441) | SQLITE_PRIVATE int sqlite3PagerOpen(
  function databaseIsUnmoved (line 50734) | static int databaseIsUnmoved(Pager *pPager){
  function hasHotJournal (line 50785) | static int hasHotJournal(Pager *pPager, int *pExists){
  function SQLITE_PRIVATE (line 50905) | SQLITE_PRIVATE int sqlite3PagerSharedLock(Pager *pPager){
  function pagerUnlockIfUnused (line 51127) | static void pagerUnlockIfUnused(Pager *pPager){
  function SQLITE_PRIVATE (line 51183) | SQLITE_PRIVATE int sqlite3PagerGet(
  function SQLITE_PRIVATE (line 51366) | SQLITE_PRIVATE DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno){
  function SQLITE_PRIVATE (line 51385) | SQLITE_PRIVATE void sqlite3PagerUnrefNotNull(DbPage *pPg){
  function SQLITE_PRIVATE (line 51396) | SQLITE_PRIVATE void sqlite3PagerUnref(DbPage *pPg){
  function pager_open_journal (line 51422) | static int pager_open_journal(Pager *pPager){
  function SQLITE_PRIVATE (line 51511) | SQLITE_PRIVATE int sqlite3PagerBegin(Pager *pPager, int exFlag, int subj...
  function SQLITE_NOINLINE (line 51580) | static SQLITE_NOINLINE int pagerAddPageToRollbackJournal(PgHdr *pPg){
  function pager_write (line 51637) | static int pager_write(PgHdr *pPg){
  function SQLITE_NOINLINE (line 51729) | static SQLITE_NOINLINE int pagerWriteLargeSector(PgHdr *pPg){
  function SQLITE_PRIVATE (line 51823) | SQLITE_PRIVATE int sqlite3PagerWrite(PgHdr *pPg){
  function SQLITE_PRIVATE (line 51847) | SQLITE_PRIVATE int sqlite3PagerIswriteable(DbPage *pPg){
  function SQLITE_PRIVATE (line 51872) | SQLITE_PRIVATE void sqlite3PagerDontWrite(PgHdr *pPg){
  function pager_incr_changecounter (line 51906) | static int pager_incr_changecounter(Pager *pPager, int isDirectMode){
  function SQLITE_PRIVATE (line 51989) | SQLITE_PRIVATE int sqlite3PagerSync(Pager *pPager, const char *zMaster){
  function SQLITE_PRIVATE (line 52015) | SQLITE_PRIVATE int sqlite3PagerExclusiveLock(Pager *pPager){
  function SQLITE_PRIVATE (line 52057) | SQLITE_PRIVATE int sqlite3PagerCommitPhaseOne(
  function SQLITE_PRIVATE (line 52234) | SQLITE_PRIVATE int sqlite3PagerCommitPhaseTwo(Pager *pPager){
  function SQLITE_PRIVATE (line 52300) | SQLITE_PRIVATE int sqlite3PagerRollback(Pager *pPager){
  function SQLITE_PRIVATE (line 52349) | SQLITE_PRIVATE u8 sqlite3PagerIsreadonly(Pager *pPager){
  function SQLITE_PRIVATE (line 52357) | SQLITE_PRIVATE int sqlite3PagerRefcount(Pager *pPager){
  function SQLITE_PRIVATE (line 52366) | SQLITE_PRIVATE int sqlite3PagerMemUsed(Pager *pPager){
  function SQLITE_PRIVATE (line 52377) | SQLITE_PRIVATE int sqlite3PagerPageRefcount(DbPage *pPage){
  function SQLITE_PRIVATE (line 52385) | SQLITE_PRIVATE int *sqlite3PagerStats(Pager *pPager){
  function SQLITE_PRIVATE (line 52409) | SQLITE_PRIVATE void sqlite3PagerCacheStat(Pager *pPager, int eStat, int ...
  function SQLITE_PRIVATE (line 52429) | SQLITE_PRIVATE int sqlite3PagerIsMemdb(Pager *pPager){
  function SQLITE_NOINLINE (line 52443) | static SQLITE_NOINLINE int pagerOpenSavepoint(Pager *pPager, int nSavepo...
  function SQLITE_PRIVATE (line 52488) | SQLITE_PRIVATE int sqlite3PagerOpenSavepoint(Pager *pPager, int nSavepoi...
  function SQLITE_PRIVATE (line 52530) | SQLITE_PRIVATE int sqlite3PagerSavepoint(Pager *pPager, int op, int iSav...
  function SQLITE_PRIVATE (line 52587) | SQLITE_PRIVATE const char *sqlite3PagerFilename(Pager *pPager, int nullI...
  function SQLITE_PRIVATE (line 52594) | SQLITE_PRIVATE sqlite3_vfs *sqlite3PagerVfs(Pager *pPager){
  function SQLITE_PRIVATE (line 52603) | SQLITE_PRIVATE sqlite3_file *sqlite3PagerFile(Pager *pPager){
  function SQLITE_PRIVATE (line 52611) | SQLITE_PRIVATE sqlite3_file *sqlite3PagerJrnlFile(Pager *pPager){
  function SQLITE_PRIVATE (line 52622) | SQLITE_PRIVATE const char *sqlite3PagerJournalname(Pager *pPager){
  function SQLITE_PRIVATE (line 52630) | SQLITE_PRIVATE void sqlite3PagerSetCodec(
  function SQLITE_PRIVATE (line 52644) | SQLITE_PRIVATE void *sqlite3PagerGetCodec(Pager *pPager){
  function SQLITE_PRIVATE (line 52655) | SQLITE_PRIVATE void *sqlite3PagerCodec(PgHdr *pPg){
  function SQLITE_PRIVATE (line 52664) | SQLITE_PRIVATE int sqlite3PagerState(Pager *pPager){
  function SQLITE_PRIVATE (line 52695) | SQLITE_PRIVATE int sqlite3PagerMovepage(Pager *pPager, DbPage *pPg, Pgno...
  function SQLITE_PRIVATE (line 52829) | SQLITE_PRIVATE void sqlite3PagerRekey(DbPage *pPg, Pgno iNew, u16 flags){
  function SQLITE_PRIVATE (line 52838) | SQLITE_PRIVATE void *sqlite3PagerGetData(DbPage *pPg){
  function SQLITE_PRIVATE (line 52847) | SQLITE_PRIVATE void *sqlite3PagerGetExtra(DbPage *pPg){
  function SQLITE_PRIVATE (line 52861) | SQLITE_PRIVATE int sqlite3PagerLockingMode(Pager *pPager, int eMode){
  function SQLITE_PRIVATE (line 52894) | SQLITE_PRIVATE int sqlite3PagerSetJournalMode(Pager *pPager, int eMode){
  function SQLITE_PRIVATE (line 52992) | SQLITE_PRIVATE int sqlite3PagerGetJournalMode(Pager *pPager){
  function SQLITE_PRIVATE (line 53001) | SQLITE_PRIVATE int sqlite3PagerOkToChangeJournalMode(Pager *pPager){
  function SQLITE_PRIVATE (line 53014) | SQLITE_PRIVATE i64 sqlite3PagerJournalSizeLimit(Pager *pPager, i64 iLimit){
  function SQLITE_PRIVATE (line 53028) | SQLITE_PRIVATE sqlite3_backup **sqlite3PagerBackupPtr(Pager *pPager){
  function SQLITE_PRIVATE (line 53036) | SQLITE_PRIVATE void sqlite3PagerClearCache(Pager *pPager){
  function SQLITE_PRIVATE (line 53050) | SQLITE_PRIVATE int sqlite3PagerCheckpoint(Pager *pPager, int eMode, int ...
  function SQLITE_PRIVATE (line 53063) | SQLITE_PRIVATE int sqlite3PagerWalCallback(Pager *pPager){
  function SQLITE_PRIVATE (line 53071) | SQLITE_PRIVATE int sqlite3PagerWalSupported(Pager *pPager){
  function pagerExclusiveLock (line 53081) | static int pagerExclusiveLock(Pager *pPager){
  function pagerOpenWal (line 53101) | static int pagerOpenWal(Pager *pPager){
  function SQLITE_PRIVATE (line 53146) | SQLITE_PRIVATE int sqlite3PagerOpenWal(
  function SQLITE_PRIVATE (line 53185) | SQLITE_PRIVATE int sqlite3PagerCloseWal(Pager *pPager){
  function SQLITE_PRIVATE (line 53228) | SQLITE_PRIVATE int sqlite3PagerSnapshotGet(Pager *pPager, sqlite3_snapsh...
  function SQLITE_PRIVATE (line 53241) | SQLITE_PRIVATE int sqlite3PagerSnapshotOpen(Pager *pPager, sqlite3_snaps...
  function SQLITE_PRIVATE (line 53261) | SQLITE_PRIVATE int sqlite3PagerWalFramesize(Pager *pPager){
  type WalIndexHdr (line 53558) | typedef struct WalIndexHdr WalIndexHdr;
  type WalIterator (line 53559) | typedef struct WalIterator WalIterator;
  type WalCkptInfo (line 53560) | typedef struct WalCkptInfo WalCkptInfo;
  type WalIndexHdr (line 53576) | struct WalIndexHdr {
  type WalCkptInfo (line 53649) | struct WalCkptInfo {
  type Wal (line 53698) | struct Wal {
  type u16 (line 53748) | typedef u16 ht_slot;
  type WalIterator (line 53765) | struct WalIterator {
  function walIndexPage (line 53810) | static int walIndexPage(Wal *pWal, int iPage, volatile u32 **ppPage){
  function WalCkptInfo (line 53852) | static volatile WalCkptInfo *walCkptInfo(Wal *pWal){
  function WalIndexHdr (line 53860) | static volatile WalIndexHdr *walIndexHdr(Wal *pWal){
  function walChecksumBytes (line 53886) | static void walChecksumBytes(
  function walShmBarrier (line 53924) | static void walShmBarrier(Wal *pWal){
  function walIndexWriteHdr (line 53935) | static void walIndexWriteHdr(Wal *pWal){
  function walEncodeFrame (line 53961) | static void walEncodeFrame(
  function walDecodeFrame (line 53992) | static int walDecodeFrame(
  function walLockShared (line 54071) | static int walLockShared(Wal *pWal, int lockIdx){
  function walUnlockShared (line 54081) | static void walUnlockShared(Wal *pWal, int lockIdx){
  function walLockExclusive (line 54087) | static int walLockExclusive(Wal *pWal, int lockIdx, int n){
  function walUnlockExclusive (line 54097) | static void walUnlockExclusive(Wal *pWal, int lockIdx, int n){
  function walHash (line 54110) | static int walHash(u32 iPage){
  function walNextHash (line 54115) | static int walNextHash(int iPriorHash){
  function walHashGet (line 54133) | static int walHashGet(
  function walFramePage (line 54171) | static int walFramePage(u32 iFrame){
  function u32 (line 54185) | static u32 walFramePgno(Wal *pWal, u32 iFrame){
  function walCleanupHash (line 54205) | static void walCleanupHash(Wal *pWal){
  function walIndexAppend (line 54267) | static int walIndexAppend(Wal *pWal, u32 iFrame, u32 iPage){
  function walIndexRecover (line 54356) | static int walIndexRecover(Wal *pWal){
  function walIndexClose (line 54523) | static void walIndexClose(Wal *pWal, int isDelete){
  function SQLITE_PRIVATE (line 54550) | SQLITE_PRIVATE int sqlite3WalOpen(
  function SQLITE_PRIVATE (line 54624) | SQLITE_PRIVATE void sqlite3WalLimit(Wal *pWal, i64 iLimit){
  function walIteratorNext (line 54638) | static int walIteratorNext(
  function walMerge (line 54691) | static void walMerge(
  function walMergesort (line 54748) | static void walMergesort(
  function walIteratorFree (line 54811) | static void walIteratorFree(WalIterator *p){
  function walIteratorInit (line 54827) | static int walIteratorInit(Wal *pWal, WalIterator **pp){
  function walBusyLock (line 54909) | static int walBusyLock(
  function walPagesize (line 54927) | static int walPagesize(Wal *pWal){
  function walRestartHdr (line 54948) | static void walRestartHdr(Wal *pWal, u32 salt1){
  function walCheckpoint (line 54995) | static int walCheckpoint(
  function walLimitSize (line 55176) | static void walLimitSize(Wal *pWal, i64 nMax){
  function SQLITE_PRIVATE (line 55193) | SQLITE_PRIVATE int sqlite3WalClose(
  function walIndexTryHdr (line 55272) | static int walIndexTryHdr(Wal *pWal, int *pChanged){
  function walIndexReadHdr (line 55330) | static int walIndexReadHdr(Wal *pWal, int *pChanged){
  function walTryBeginRead (line 55447) | static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int cnt){
  function SQLITE_PRIVATE (line 55660) | SQLITE_PRIVATE int sqlite3WalBeginReadTransaction(Wal *pWal, int *pChang...
  function SQLITE_PRIVATE (line 55746) | SQLITE_PRIVATE void sqlite3WalEndReadTransaction(Wal *pWal){
  function SQLITE_PRIVATE (line 55762) | SQLITE_PRIVATE int sqlite3WalFindFrame(
  function SQLITE_PRIVATE (line 55864) | SQLITE_PRIVATE int sqlite3WalReadFrame(
  function SQLITE_PRIVATE (line 55884) | SQLITE_PRIVATE Pgno sqlite3WalDbsize(Wal *pWal){
  function SQLITE_PRIVATE (line 55905) | SQLITE_PRIVATE int sqlite3WalBeginWriteTransaction(Wal *pWal){
  function SQLITE_PRIVATE (line 55943) | SQLITE_PRIVATE int sqlite3WalEndWriteTransaction(Wal *pWal){
  function SQLITE_PRIVATE (line 55965) | SQLITE_PRIVATE int sqlite3WalUndo(Wal *pWal, int (*xUndo)(void *, Pgno),...
  function SQLITE_PRIVATE (line 56005) | SQLITE_PRIVATE void sqlite3WalSavepoint(Wal *pWal, u32 *aWalData){
  function SQLITE_PRIVATE (line 56019) | SQLITE_PRIVATE int sqlite3WalSavepointUndo(Wal *pWal, u32 *aWalData){
  function walRestartLog (line 56056) | static int walRestartLog(Wal *pWal){
  type WalWriter (line 56103) | typedef struct WalWriter {
  function walWriteToLog (line 56119) | static int walWriteToLog(
  function walWriteOneFrame (line 56144) | static int walWriteOneFrame(
  function walRewriteChecksums (line 56174) | static int walRewriteChecksums(Wal *pWal, u32 iLast){
  function SQLITE_PRIVATE (line 56223) | SQLITE_PRIVATE int sqlite3WalFrames(
  function SQLITE_PRIVATE (line 56458) | SQLITE_PRIVATE int sqlite3WalCheckpoint(
  function SQLITE_PRIVATE (line 56567) | SQLITE_PRIVATE int sqlite3WalCallback(Wal *pWal){
  function SQLITE_PRIVATE (line 56600) | SQLITE_PRIVATE int sqlite3WalExclusiveMode(Wal *pWal, int op){
  function SQLITE_PRIVATE (line 56642) | SQLITE_PRIVATE int sqlite3WalHeapMemory(Wal *pWal){
  function SQLITE_PRIVATE (line 56651) | SQLITE_PRIVATE int sqlite3WalSnapshotGet(Wal *pWal, sqlite3_snapshot **p...
  function SQLITE_PRIVATE (line 56670) | SQLITE_PRIVATE void sqlite3WalSnapshotOpen(Wal *pWal, sqlite3_snapshot *...
  function SQLITE_STDCALL (line 56678) | SQLITE_STDCALL sqlite3_snapshot_cmp(sqlite3_snapshot *p1, sqlite3_snapsh...
  function SQLITE_PRIVATE (line 56698) | SQLITE_PRIVATE int sqlite3WalFramesize(Wal *pWal){
  function SQLITE_PRIVATE (line 56706) | SQLITE_PRIVATE sqlite3_file *sqlite3WalFile(Wal *pWal){
  type MemPage (line 56964) | typedef struct MemPage MemPage;
  type BtLock (line 56965) | typedef struct BtLock BtLock;
  type CellInfo (line 56966) | typedef struct CellInfo CellInfo;
  type MemPage (line 57006) | struct MemPage {
  type BtLock (line 57050) | struct BtLock {
  type Btree (line 57082) | struct Btree {
  type BtShared (line 57145) | struct BtShared {
  type CellInfo (line 57199) | struct CellInfo {
  type BtCursor (line 57237) | struct BtCursor {
  type IntegrityCk (line 57403) | typedef struct IntegrityCk IntegrityCk;
  type IntegrityCk (line 57404) | struct IntegrityCk {
  function lockBtreeMutex (line 57453) | static void lockBtreeMutex(Btree *p){
  function unlockBtreeMutex (line 57467) | static void SQLITE_NOINLINE unlockBtreeMutex(Btree *p){
  function SQLITE_PRIVATE (line 57497) | SQLITE_PRIVATE void sqlite3BtreeEnter(Btree *p){
  function btreeLockCarefully (line 57531) | static void SQLITE_NOINLINE btreeLockCarefully(Btree *p){
  function SQLITE_PRIVATE (line 57569) | SQLITE_PRIVATE void sqlite3BtreeLeave(Btree *p){
  function SQLITE_PRIVATE (line 57587) | SQLITE_PRIVATE int sqlite3BtreeHoldsMutex(Btree *p){
  function SQLITE_PRIVATE (line 57612) | SQLITE_PRIVATE void sqlite3BtreeEnterAll(sqlite3 *db){
  function SQLITE_PRIVATE (line 57621) | SQLITE_PRIVATE void sqlite3BtreeLeaveAll(sqlite3 *db){
  function SQLITE_PRIVATE (line 57638) | SQLITE_PRIVATE int sqlite3BtreeHoldsAllMutexes(sqlite3 *db){
  function SQLITE_PRIVATE (line 57667) | SQLITE_PRIVATE int sqlite3SchemaMutexHeld(sqlite3 *db, int iDb, Schema *...
  function SQLITE_PRIVATE (line 57691) | SQLITE_PRIVATE void sqlite3BtreeEnter(Btree *p){
  function SQLITE_PRIVATE (line 57694) | SQLITE_PRIVATE void sqlite3BtreeEnterAll(sqlite3 *db){
  function SQLITE_PRIVATE (line 57713) | SQLITE_PRIVATE void sqlite3BtreeEnterCursor(BtCursor *pCur){
  function SQLITE_PRIVATE (line 57717) | SQLITE_PRIVATE void sqlite3BtreeLeaveCursor(BtCursor *pCur){
  function SQLITE_STDCALL (line 57815) | SQLITE_STDCALL sqlite3_enable_shared_cache(int enable){
  function hasSharedCacheTableLock (line 57866) | static int hasSharedCacheTableLock(
  function hasReadConflicts (line 57953) | static int hasReadConflicts(Btree *pBtree, Pgno iRoot){
  function querySharedCacheTableLock (line 57973) | static int querySharedCacheTableLock(Btree *p, Pgno iTab, u8 eLock){
  function setSharedCacheTableLock (line 58045) | static int setSharedCacheTableLock(Btree *p, Pgno iTable, u8 eLock){
  function clearAllSharedCacheTableLocks (line 58109) | static void clearAllSharedCacheTableLocks(Btree *p){
  function downgradeAllSharedCacheTableLocks (line 58153) | static void downgradeAllSharedCacheTableLocks(Btree *p){
  function cursorHoldsMutex (line 58176) | static int cursorHoldsMutex(BtCursor *p){
  function cursorOwnsBtShared (line 58179) | static int cursorOwnsBtShared(BtCursor *p){
  function invalidateAllOverflowCache (line 58195) | static void invalidateAllOverflowCache(BtShared *pBt){
  function invalidateIncrblobCursors (line 58217) | static void invalidateIncrblobCursors(
  function btreeSetHasContent (line 58276) | static int btreeSetHasContent(BtShared *pBt, Pgno pgno){
  function btreeGetHasContent (line 58298) | static int btreeGetHasContent(BtShared *pBt, Pgno pgno){
  function btreeClearHasContent (line 58307) | static void btreeClearHasContent(BtShared *pBt){
  function btreeReleaseAllCursorPages (line 58315) | static void btreeReleaseAllCursorPages(BtCursor *pCur){
  function saveCursorKey (line 58337) | static int saveCursorKey(BtCursor *pCur){
  function saveCursorPosition (line 58375) | static int saveCursorPosition(BtCursor *pCur){
  function saveAllCursors (line 58422) | static int saveAllCursors(BtShared *pBt, Pgno iRoot, BtCursor *pExcept){
  function saveCursorsOnList (line 58439) | static int SQLITE_NOINLINE saveCursorsOnList(
  function SQLITE_PRIVATE (line 58464) | SQLITE_PRIVATE void sqlite3BtreeClearCursor(BtCursor *pCur){
  function btreeMoveto (line 58476) | static int btreeMoveto(
  function btreeRestoreCursorPosition (line 58516) | static int btreeRestoreCursorPosition(BtCursor *pCur){
  function SQLITE_PRIVATE (line 58555) | SQLITE_PRIVATE int sqlite3BtreeCursorHasMoved(BtCursor *pCur){
  function SQLITE_PRIVATE (line 58572) | SQLITE_PRIVATE int sqlite3BtreeCursorRestore(BtCursor *pCur, int *pDiffe...
  function SQLITE_PRIVATE (line 58597) | SQLITE_PRIVATE void sqlite3BtreeCursorHint(BtCursor *pCur, int eHintType...
  function SQLITE_PRIVATE (line 58605) | SQLITE_PRIVATE void sqlite3BtreeCursorHintFlags(BtCursor *pCur, unsigned...
  function Pgno (line 58621) | static Pgno ptrmapPageno(BtShared *pBt, Pgno pgno){
  function ptrmapPut (line 58645) | static void ptrmapPut(BtShared *pBt, Pgno key, u8 eType, Pgno parent, in...
  function ptrmapGet (line 58697) | static int ptrmapGet(BtShared *pBt, Pgno key, u8 *pEType, Pgno *pPgno){
  function SQLITE_NOINLINE (line 58756) | static SQLITE_NOINLINE void btreeParseCellAdjustSizeForOverflow(
  function btreeParseCellPtrNoPayload (line 58801) | static void btreeParseCellPtrNoPayload(
  function btreeParseCellPtr (line 58818) | static void btreeParseCellPtr(
  function btreeParseCellPtrIndex (line 58886) | static void btreeParseCellPtrIndex(
  function btreeParseCell (line 58923) | static void btreeParseCell(
  function u16 (line 58943) | static u16 cellSizePtr(MemPage *pPage, u8 *pCell){
  function u16 (line 58991) | static u16 cellSizePtrNoPayload(MemPage *pPage, u8 *pCell){
  function u16 (line 59017) | static u16 cellSize(MemPage *pPage, int iCell){
  function ptrmapPutOvflPtr (line 59028) | static void ptrmapPutOvflPtr(MemPage *pPage, u8 *pCell, int *pRC){
  function defragmentPage (line 59052) | static int defragmentPage(MemPage *pPage){
  function u8 (line 59142) | static u8 *pageFindSlot(MemPage *pPg, int nByte, int *pRc){
  function allocateSpace (line 59205) | static int allocateSpace(MemPage *pPage, int nByte, int *pIdx){
  function freeSpace (line 59295) | static int freeSpace(MemPage *pPage, u16 iStart, u16 iSize){
  function decodeFlags (line 59394) | static int decodeFlags(MemPage *pPage, int flagByte){
  function btreeInitPage (line 59452) | static int btreeInitPage(MemPage *pPage){
  function zeroPage (line 59583) | static void zeroPage(MemPage *pPage, int flags){
  function MemPage (line 59620) | static MemPage *btreePageFromDbPage(DbPage *pDbPage, Pgno pgno, BtShared...
  function btreeGetPage (line 59644) | static int btreeGetPage(
  function MemPage (line 59666) | static MemPage *btreePageLookup(BtShared *pBt, Pgno pgno){
  function Pgno (line 59680) | static Pgno btreePagecount(BtShared *pBt){
  function SQLITE_PRIVATE (line 59683) | SQLITE_PRIVATE u32 sqlite3BtreeLastPage(Btree *p){
  function getAndInitPage (line 59702) | static int getAndInitPage(
  function releasePageNotNull (line 59756) | static void releasePageNotNull(MemPage *pPage){
  function releasePage (line 59765) | static void releasePage(MemPage *pPage){
  function btreeGetUnusedPage (line 59778) | static int btreeGetUnusedPage(
  function pageReinit (line 59807) | static void pageReinit(DbPage *pData){
  function btreeInvokeBusyHandler (line 59829) | static int btreeInvokeBusyHandler(void *pArg){
  function SQLITE_PRIVATE (line 59857) | SQLITE_PRIVATE int sqlite3BtreeOpen(
  function removeFromSharingList (line 60141) | static int removeFromSharingList(BtShared *pBt){
  function allocateTempSpace (line 60180) | static void allocateTempSpace(BtShared *pBt){
  function freeTempSpace (line 60209) | static void freeTempSpace(BtShared *pBt){
  function SQLITE_PRIVATE (line 60220) | SQLITE_PRIVATE int sqlite3BtreeClose(Btree *p){
  function SQLITE_PRIVATE (line 60282) | SQLITE_PRIVATE int sqlite3BtreeSetCacheSize(Btree *p, int mxPage){
  function SQLITE_PRIVATE (line 60301) | SQLITE_PRIVATE int sqlite3BtreeSetSpillSize(Btree *p, int mxPage){
  function SQLITE_PRIVATE (line 60316) | SQLITE_PRIVATE int sqlite3BtreeSetMmapLimit(Btree *p, sqlite3_int64 szMm...
  function SQLITE_PRIVATE (line 60335) | SQLITE_PRIVATE int sqlite3BtreeSetPagerFlags(
  function SQLITE_PRIVATE (line 60368) | SQLITE_PRIVATE int sqlite3BtreeSetPageSize(Btree *p, int pageSize, int n...
  function SQLITE_PRIVATE (line 60401) | SQLITE_PRIVATE int sqlite3BtreeGetPageSize(Btree *p){
  function SQLITE_PRIVATE (line 60416) | SQLITE_PRIVATE int sqlite3BtreeGetReserveNoMutex(Btree *p){
  function SQLITE_PRIVATE (line 60432) | SQLITE_PRIVATE int sqlite3BtreeGetOptimalReserve(Btree *p){
  function SQLITE_PRIVATE (line 60449) | SQLITE_PRIVATE int sqlite3BtreeMaxPageCount(Btree *p, int mxPage){
  function SQLITE_PRIVATE (line 60462) | SQLITE_PRIVATE int sqlite3BtreeSecureDelete(Btree *p, int newFlag){
  function SQLITE_PRIVATE (line 60481) | SQLITE_PRIVATE int sqlite3BtreeSetAutoVacuum(Btree *p, int autoVacuum){
  function SQLITE_PRIVATE (line 60505) | SQLITE_PRIVATE int sqlite3BtreeGetAutoVacuum(Btree *p){
  function lockBtree (line 60531) | static int lockBtree(BtShared *pBt){
  function countValidCursors (line 60726) | static int countValidCursors(BtShared *pBt, int wrOnly){
  function unlockBtreeIfUnused (line 60745) | static void unlockBtreeIfUnused(BtShared *pBt){
  function newDatabase (line 60762) | static int newDatabase(BtShared *pBt){
  function SQLITE_PRIVATE (line 60806) | SQLITE_PRIVATE int sqlite3BtreeNewDb(Btree *p){
  function SQLITE_PRIVATE (line 60850) | SQLITE_PRIVATE int sqlite3BtreeBeginTrans(Btree *p, int wrflag){
  function setChildPtrmaps (line 60997) | static int setChildPtrmaps(MemPage *pPage){
  function modifyPagePointer (line 61047) | static int modifyPagePointer(MemPage *pPage, Pgno iFrom, Pgno iTo, u8 eT...
  function relocatePage (line 61109) | static int relocatePage(
  function incrVacuumStep (line 61202) | static int incrVacuumStep(BtShared *pBt, Pgno nFin, Pgno iLastPg, int bC...
  function Pgno (line 61298) | static Pgno finalDbSize(BtShared *pBt, Pgno nOrig, Pgno nFree){
  function SQLITE_PRIVATE (line 61324) | SQLITE_PRIVATE int sqlite3BtreeIncrVacuum(Btree *p){
  function autoVacuumCommit (line 61366) | static int autoVacuumCommit(BtShared *pBt){
  function SQLITE_PRIVATE (line 61445) | SQLITE_PRIVATE int sqlite3BtreeCommitPhaseOne(Btree *p, const char *zMas...
  function btreeEndTransaction (line 61472) | static void btreeEndTransaction(Btree *p){
  function SQLITE_PRIVATE (line 61534) | SQLITE_PRIVATE int sqlite3BtreeCommitPhaseTwo(Btree *p, int bCleanup){
  function SQLITE_PRIVATE (line 61566) | SQLITE_PRIVATE int sqlite3BtreeCommit(Btree *p){
  function SQLITE_PRIVATE (line 61603) | SQLITE_PRIVATE int sqlite3BtreeTripAllCursors(Btree *pBtree, int errCode...
  function SQLITE_PRIVATE (line 61646) | SQLITE_PRIVATE int sqlite3BtreeRollback(Btree *p, int tripCode, int writ...
  function SQLITE_PRIVATE (line 61715) | SQLITE_PRIVATE int sqlite3BtreeBeginStmt(Btree *p, int iStatement){
  function SQLITE_PRIVATE (line 61746) | SQLITE_PRIVATE int sqlite3BtreeSavepoint(Btree *p, int op, int iSavepoint){
  function btreeCursor (line 61813) | static int btreeCursor(
  function SQLITE_PRIVATE (line 61873) | SQLITE_PRIVATE int sqlite3BtreeCursor(
  function SQLITE_PRIVATE (line 61899) | SQLITE_PRIVATE int sqlite3BtreeCursorSize(void){
  function SQLITE_PRIVATE (line 61911) | SQLITE_PRIVATE void sqlite3BtreeCursorZero(BtCursor *p){
  function SQLITE_PRIVATE (line 61919) | SQLITE_PRIVATE int sqlite3BtreeCloseCursor(BtCursor *pCur){
  function assertCellInfo (line 61959) | static void assertCellInfo(BtCursor *pCur){
  function SQLITE_NOINLINE (line 61969) | static SQLITE_NOINLINE void getCellInfo(BtCursor *pCur){
  function SQLITE_PRIVATE (line 61985) | SQLITE_PRIVATE int sqlite3BtreeCursorIsValid(BtCursor *pCur){
  function SQLITE_PRIVATE (line 62002) | SQLITE_PRIVATE int sqlite3BtreeKeySize(BtCursor *pCur, i64 *pSize){
  function SQLITE_PRIVATE (line 62022) | SQLITE_PRIVATE int sqlite3BtreeDataSize(BtCursor *pCur, u32 *pSize){
  function getOverflowPage (line 62052) | static int getOverflowPage(
  function copyPayload (line 62120) | static int copyPayload(
  function accessPayload (line 62171) | static int accessPayload(
  function SQLITE_PRIVATE (line 62382) | SQLITE_PRIVATE int sqlite3BtreeKey(BtCursor *pCur, u32 offset, u32 amt, ...
  function SQLITE_PRIVATE (line 62399) | SQLITE_PRIVATE int sqlite3BtreeData(BtCursor *pCur, u32 offset, u32 amt,...
  function SQLITE_PRIVATE (line 62472) | SQLITE_PRIVATE const void *sqlite3BtreeKeyFetch(BtCursor *pCur, u32 *pAmt){
  function SQLITE_PRIVATE (line 62475) | SQLITE_PRIVATE const void *sqlite3BtreeDataFetch(BtCursor *pCur, u32 *pA...
  function moveToChild (line 62489) | static int moveToChild(BtCursor *pCur, u32 newPgno){
  function assertParentIndex (line 62515) | static void assertParentIndex(MemPage *pParent, int iIdx, Pgno iChild){
  function moveToParent (line 62537) | static void moveToParent(BtCursor *pCur){
  function moveToRoot (line 62574) | static int moveToRoot(BtCursor *pCur){
  function moveToLeftmost (line 62652) | static int moveToLeftmost(BtCursor *pCur){
  function moveToRightmost (line 62677) | static int moveToRightmost(BtCursor *pCur){
  function SQLITE_PRIVATE (line 62700) | SQLITE_PRIVATE int sqlite3BtreeFirst(BtCursor *pCur, int *pRes){
  function SQLITE_PRIVATE (line 62723) | SQLITE_PRIVATE int sqlite3BtreeLast(BtCursor *pCur, int *pRes){
  function SQLITE_PRIVATE (line 62794) | SQLITE_PRIVATE int sqlite3BtreeMovetoUnpacked(
  function SQLITE_PRIVATE (line 63018) | SQLITE_PRIVATE int sqlite3BtreeEof(BtCursor *pCur){
  function SQLITE_NOINLINE (line 63047) | static SQLITE_NOINLINE int btreeNext(BtCursor *pCur, int *pRes){
  function SQLITE_PRIVATE (line 63114) | SQLITE_PRIVATE int sqlite3BtreeNext(BtCursor *pCur, int *pRes){
  function SQLITE_NOINLINE (line 63157) | static SQLITE_NOINLINE int btreePrevious(BtCursor *pCur, int *pRes){
  function SQLITE_PRIVATE (line 63216) | SQLITE_PRIVATE int sqlite3BtreePrevious(BtCursor *pCur, int *pRes){
  function allocateBtreePage (line 63256) | static int allocateBtreePage(
  function freePage2 (line 63578) | static int freePage2(BtShared *pBt, MemPage *pMemPage, Pgno iPage){
  function freePage (line 63706) | static void freePage(MemPage *pPage, int *pRC){
  function clearCell (line 63717) | static int clearCell(
  function fillInCell (line 63798) | static int fillInCell(
  function dropCell (line 63986) | static void dropCell(MemPage *pPage, int idx, int sz, int *pRC){
  function insertCell (line 64040) | static void insertCell(
  type CellArray (line 64131) | typedef struct CellArray CellArray;
  type CellArray (line 64132) | struct CellArray {
  function populateCellCache (line 64143) | static void populateCellCache(CellArray *p, int idx, int N){
  function SQLITE_NOINLINE (line 64161) | static SQLITE_NOINLINE u16 computeCellSize(CellArray *p, int N){
  function u16 (line 64167) | static u16 cachedCellSize(CellArray *p, int N){
  function rebuildPage (line 64186) | static int rebuildPage(
  function pageInsertArray (line 64255) | static int pageInsertArray(
  function pageFreeArray (line 64301) | static int pageFreeArray(
  function editPage (line 64358) | static int editPage(
  function balance_quick (line 64492) | static int balance_quick(MemPage *pParent, MemPage *pPage, u8 *pSpace){
  function ptrmapCheckPages (line 64581) | static int ptrmapCheckPages(MemPage **apPage, int nPage){
  function copyNodeContent (line 64634) | static void copyNodeContent(MemPage *pFrom, MemPage *pTo, int *pRC){
  function balance_nonroot (line 64715) | static int balance_nonroot(
  function balance_deeper (line 65479) | static int balance_deeper(MemPage *pRoot, MemPage **ppChild){
  function balance (line 65536) | static int balance(BtCursor *pCur){
  function SQLITE_PRIVATE (line 65675) | SQLITE_PRIVATE int sqlite3BtreeInsert(
  function SQLITE_PRIVATE (line 65842) | SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){
  function btreeCreateTable (line 66005) | static int btreeCreateTable(Btree *p, int *piTable, int createTabFlags){
  function SQLITE_PRIVATE (line 66148) | SQLITE_PRIVATE int sqlite3BtreeCreateTable(Btree *p, int *piTable, int f...
  function clearDatabasePage (line 66160) | static int clearDatabasePage(
  function SQLITE_PRIVATE (line 66227) | SQLITE_PRIVATE int sqlite3BtreeClearTable(Btree *p, int iTable, int *pnC...
  function SQLITE_PRIVATE (line 66251) | SQLITE_PRIVATE int sqlite3BtreeClearTableOfCursor(BtCursor *pCur){
  function btreeDropTable (line 66275) | static int btreeDropTable(Btree *p, Pgno iTable, int *piMoved){
  function SQLITE_PRIVATE (line 66377) | SQLITE_PRIVATE int sqlite3BtreeDropTable(Btree *p, int iTable, int *piMo...
  function SQLITE_PRIVATE (line 66406) | SQLITE_PRIVATE void sqlite3BtreeGetMeta(Btree *p, int idx, u32 *pMeta){
  function SQLITE_PRIVATE (line 66436) | SQLITE_PRIVATE int sqlite3BtreeUpdateMeta(Btree *p, int idx, u32 iMeta){
  function SQLITE_PRIVATE (line 66469) | SQLITE_PRIVATE int sqlite3BtreeCount(BtCursor *pCur, i64 *pnEntry){
  function SQLITE_PRIVATE (line 66539) | SQLITE_PRIVATE Pager *sqlite3BtreePager(Btree *p){
  function checkAppendMsg (line 66547) | static void checkAppendMsg(
  function getPageReferenced (line 66577) | static int getPageReferenced(IntegrityCk *pCheck, Pgno iPg){
  function setPageReferenced (line 66585) | static void setPageReferenced(IntegrityCk *pCheck, Pgno iPg){
  function checkRef (line 66599) | static int checkRef(IntegrityCk *pCheck, Pgno iPage){
  function checkPtrmap (line 66619) | static void checkPtrmap(
  function checkList (line 66648) | static void checkList(
  function btreeHeapInsert (line 66740) | static void btreeHeapInsert(u32 *aHeap, u32 x){
  function btreeHeapPull (line 66750) | static int btreeHeapPull(u32 *aHeap, u32 *pOut){
  function checkTreePage (line 66784) | static int checkTreePage(
  function SQLITE_PRIVATE (line 67048) | SQLITE_PRIVATE char *sqlite3BtreeIntegrityCheck(
  function SQLITE_PRIVATE (line 67167) | SQLITE_PRIVATE const char *sqlite3BtreeGetFilename(Btree *p){
  function SQLITE_PRIVATE (line 67180) | SQLITE_PRIVATE const char *sqlite3BtreeGetJournalname(Btree *p){
  function SQLITE_PRIVATE (line 67188) | SQLITE_PRIVATE int sqlite3BtreeIsInTrans(Btree *p){
  function SQLITE_PRIVATE (line 67202) | SQLITE_PRIVATE int sqlite3BtreeCheckpoint(Btree *p, int eMode, int *pnLo...
  function SQLITE_PRIVATE (line 67221) | SQLITE_PRIVATE int sqlite3BtreeIsInReadTrans(Btree *p){
  function SQLITE_PRIVATE (line 67227) | SQLITE_PRIVATE int sqlite3BtreeIsInBackup(Btree *p){
  function SQLITE_PRIVATE (line 67253) | SQLITE_PRIVATE void *sqlite3BtreeSchema(Btree *p, int nBytes, void(*xFre...
  function SQLITE_PRIVATE (line 67269) | SQLITE_PRIVATE int sqlite3BtreeSchemaLocked(Btree *p){
  function SQLITE_PRIVATE (line 67286) | SQLITE_PRIVATE int sqlite3BtreeLockTable(Btree *p, int iTab, u8 isWriteL...
  function SQLITE_PRIVATE (line 67316) | SQLITE_PRIVATE int sqlite3BtreePutData(BtCursor *pCsr, u32 offset, u32 a...
  function SQLITE_PRIVATE (line 67364) | SQLITE_PRIVATE void sqlite3BtreeIncrblobCursor(BtCursor *pCur){
  function SQLITE_PRIVATE (line 67375) | SQLITE_PRIVATE int sqlite3BtreeSetVersion(Btree *pBtree, int iVersion){
  function SQLITE_PRIVATE (line 67410) | SQLITE_PRIVATE int sqlite3BtreeCursorHasHint(BtCursor *pCsr, unsigned in...
  function SQLITE_PRIVATE (line 67417) | SQLITE_PRIVATE int sqlite3BtreeIsReadonly(Btree *p){
  function SQLITE_PRIVATE (line 67424) | SQLITE_PRIVATE int sqlite3HeaderSizeBtree(void){ return ROUND8(sizeof(Me...
  function SQLITE_PRIVATE (line 67430) | SQLITE_PRIVATE int sqlite3BtreeSharable(Btree *p){
  type sqlite3_backup (line 67457) | struct sqlite3_backup {
  function Btree (line 67518) | static Btree *findBtree(sqlite3 *pErrorDb, sqlite3 *pDb, const char *zDb){
  function setDestPgsz (line 67555) | static int setDestPgsz(sqlite3_backup *p){
  function checkReadTransaction (line 67567) | static int checkReadTransaction(sqlite3 *db, Btree *p){
  function isFatalError (line 67661) | static int isFatalError(int rc){
  function backupOnePage (line 67670) | static int backupOnePage(
  function backupTruncateFile (line 67766) | static int backupTruncateFile(sqlite3_file *pFile, i64 iSize){
  function attachBackupObject (line 67779) | static void attachBackupObject(sqlite3_backup *p){
  function SQLITE_STDCALL (line 67791) | SQLITE_STDCALL sqlite3_backup_step(sqlite3_backup *p, int nPage){
  function SQLITE_STDCALL (line 68035) | SQLITE_STDCALL sqlite3_backup_finish(sqlite3_backup *p){
  function SQLITE_STDCALL (line 68087) | SQLITE_STDCALL sqlite3_backup_remaining(sqlite3_backup *p){
  function SQLITE_STDCALL (line 68101) | SQLITE_STDCALL sqlite3_backup_pagecount(sqlite3_backup *p){
  function SQLITE_NOINLINE (line 68123) | static SQLITE_NOINLINE void backupUpdate(
  function SQLITE_PRIVATE (line 68148) | SQLITE_PRIVATE void sqlite3BackupUpdate(sqlite3_backup *pBackup, Pgno iP...
  function SQLITE_PRIVATE (line 68163) | SQLITE_PRIVATE void sqlite3BackupRestart(sqlite3_backup *pBackup){
  function SQLITE_PRIVATE (line 68180) | SQLITE_PRIVATE int sqlite3BtreeCopyFile(Btree *pTo, Btree *pFrom){
  function SQLITE_PRIVATE (line 68264) | SQLITE_PRIVATE int sqlite3VdbeCheckMemInvariants(Mem *p){
  function SQLITE_PRIVATE (line 68317) | SQLITE_PRIVATE int sqlite3VdbeChangeEncoding(Mem *pMem, int desiredEnc){
  function sqlite3VdbeMemGrow (line 68352) | int sqlite3VdbeMemGrow(Mem *pMem, int n, int bPreserve){
  function SQLITE_PRIVATE (line 68409) | SQLITE_PRIVATE int sqlite3VdbeMemClearAndResize(Mem *pMem, int szNew){
  function SQLITE_PRIVATE (line 68427) | SQLITE_PRIVATE int sqlite3VdbeMemMakeWriteable(Mem *pMem){
  function SQLITE_PRIVATE (line 68454) | SQLITE_PRIVATE int sqlite3VdbeMemExpandBlob(Mem *pMem){
  function SQLITE_NOINLINE (line 68482) | static SQLITE_NOINLINE int vdbeMemAddTerminator(Mem *pMem){
  function SQLITE_PRIVATE (line 68495) | SQLITE_PRIVATE int sqlite3VdbeMemNulTerminate(Mem *pMem){
  function SQLITE_PRIVATE (line 68520) | SQLITE_PRIVATE int sqlite3VdbeMemStringify(Mem *pMem, u8 enc, u8 bForce){
  function SQLITE_PRIVATE (line 68564) | SQLITE_PRIVATE int sqlite3VdbeMemFinalize(Mem *pMem, FuncDef *pFunc){
  function SQLITE_NOINLINE (line 68596) | static SQLITE_NOINLINE void vdbeMemClearExternAndSetNull(Mem *p){
  function SQLITE_NOINLINE (line 68626) | static SQLITE_NOINLINE void vdbeMemClear(Mem *p){
  function SQLITE_PRIVATE (line 68647) | SQLITE_PRIVATE void sqlite3VdbeMemRelease(Mem *p){
  function i64 (line 68659) | static i64 doubleToInt64(double r){
  function SQLITE_PRIVATE (line 68695) | SQLITE_PRIVATE i64 sqlite3VdbeIntValue(Mem *pMem){
  function SQLITE_PRIVATE (line 68720) | SQLITE_PRIVATE double sqlite3VdbeRealValue(Mem *pMem){
  function SQLITE_PRIVATE (line 68742) | SQLITE_PRIVATE void sqlite3VdbeIntegerAffinity(Mem *pMem){
  function SQLITE_PRIVATE (line 68770) | SQLITE_PRIVATE int sqlite3VdbeMemIntegerify(Mem *pMem){
  function SQLITE_PRIVATE (line 68784) | SQLITE_PRIVATE int sqlite3VdbeMemRealify(Mem *pMem){
  function SQLITE_PRIVATE (line 68801) | SQLITE_PRIVATE int sqlite3VdbeMemNumerify(Mem *pMem){
  function SQLITE_PRIVATE (line 68825) | SQLITE_PRIVATE void sqlite3VdbeMemCast(Mem *pMem, u8 aff, u8 encoding){
  function SQLITE_PRIVATE (line 68867) | SQLITE_PRIVATE void sqlite3VdbeMemInit(Mem *pMem, sqlite3 *db, u16 flags){
  function SQLITE_PRIVATE (line 68887) | SQLITE_PRIVATE void sqlite3VdbeMemSetNull(Mem *pMem){
  function SQLITE_PRIVATE (line 68894) | SQLITE_PRIVATE void sqlite3ValueSetNull(sqlite3_value *p){
  function SQLITE_PRIVATE (line 68902) | SQLITE_PRIVATE void sqlite3VdbeMemSetZeroBlob(Mem *pMem, int n){
  function SQLITE_NOINLINE (line 68917) | static SQLITE_NOINLINE void vdbeReleaseAndSetInt64(Mem *pMem, i64 val){
  function SQLITE_PRIVATE (line 68927) | SQLITE_PRIVATE void sqlite3VdbeMemSetInt64(Mem *pMem, i64 val){
  function SQLITE_PRIVATE (line 68941) | SQLITE_PRIVATE void sqlite3VdbeMemSetDouble(Mem *pMem, double val){
  function SQLITE_PRIVATE (line 68954) | SQLITE_PRIVATE void sqlite3VdbeMemSetRowSet(Mem *pMem){
  function SQLITE_PRIVATE (line 68976) | SQLITE_PRIVATE int sqlite3VdbeMemTooBig(Mem *p){
  function SQLITE_PRIVATE (line 68997) | SQLITE_PRIVATE void sqlite3VdbeMemAboutToChange(Vdbe *pVdbe, Mem *pMem){
  function SQLITE_NOINLINE (line 69017) | static SQLITE_NOINLINE void vdbeClrCopy(Mem *pTo, const Mem *pFrom, int ...
  function SQLITE_PRIVATE (line 69022) | SQLITE_PRIVATE void sqlite3VdbeMemShallowCopy(Mem *pTo, const Mem *pFrom...
  function SQLITE_PRIVATE (line 69038) | SQLITE_PRIVATE int sqlite3VdbeMemCopy(Mem *pTo, const Mem *pFrom){
  function SQLITE_PRIVATE (line 69061) | SQLITE_PRIVATE void sqlite3VdbeMemMove(Mem *pTo, Mem *pFrom){
  function SQLITE_PRIVATE (line 69087) | SQLITE_PRIVATE int sqlite3VdbeMemSetStr(
  function SQLITE_NOINLINE (line 69187) | static SQLITE_NOINLINE int vdbeMemFromBtreeResize(
  function SQLITE_PRIVATE (line 69213) | SQLITE_PRIVATE int sqlite3VdbeMemFromBtree(
  function SQLITE_NOINLINE (line 69253) | static SQLITE_NOINLINE const void *valueToText(sqlite3_value* pVal, u8 e...
  function SQLITE_PRIVATE (line 69297) | SQLITE_PRIVATE const void *sqlite3ValueText(sqlite3_value* pVal, u8 enc){
  function SQLITE_PRIVATE (line 69314) | SQLITE_PRIVATE sqlite3_value *sqlite3ValueNew(sqlite3 *db){
  type ValueNewStat4Ctx (line 69327) | struct ValueNewStat4Ctx {
  function sqlite3_value (line 69345) | static sqlite3_value *valueNew(sqlite3 *db, struct ValueNewStat4Ctx *p){
  function valueFromFunction (line 69407) | static int valueFromFunction(
  function valueFromExpr (line 69501) | static int valueFromExpr(
  function SQLITE_PRIVATE (line 69636) | SQLITE_PRIVATE int sqlite3ValueFromExpr(
  function recordFunc (line 69655) | static void recordFunc(
  function SQLITE_PRIVATE (line 69689) | SQLITE_PRIVATE void sqlite3AnalyzeFunctions(void){
  function stat4ValueFromExpr (line 69714) | static int stat4ValueFromExpr(
  function SQLITE_PRIVATE (line 69788) | SQLITE_PRIVATE int sqlite3Stat4ProbeSetValue(
  function SQLITE_PRIVATE (line 69822) | SQLITE_PRIVATE int sqlite3Stat4ValueFromExpr(
  function SQLITE_PRIVATE (line 69839) | SQLITE_PRIVATE int sqlite3Stat4Column(
  function SQLITE_PRIVATE (line 69884) | SQLITE_PRIVATE void sqlite3Stat4ProbeFree(UnpackedRecord *pRec){
  function SQLITE_PRIVATE (line 69902) | SQLITE_PRIVATE void sqlite3ValueSetStr(
  function SQLITE_PRIVATE (line 69915) | SQLITE_PRIVATE void sqlite3ValueFree(sqlite3_value *v){
  function SQLITE_NOINLINE (line 69926) | static SQLITE_NOINLINE int valueBytes(sqlite3_value *pVal, u8 enc){
  function SQLITE_PRIVATE (line 69929) | SQLITE_PRIVATE int sqlite3ValueBytes(sqlite3_value *pVal, u8 enc){
  function SQLITE_PRIVATE (line 69968) | SQLITE_PRIVATE Vdbe *sqlite3VdbeCreate(Parse *pParse){
  function SQLITE_PRIVATE (line 69992) | SQLITE_PRIVATE void sqlite3VdbeError(Vdbe *p, const char *zFormat, ...){
  function SQLITE_PRIVATE (line 70003) | SQLITE_PRIVATE void sqlite3VdbeSetSql(Vdbe *p, const char *z, int n, int...
  function SQLITE_API (line 70017) | SQLITE_API const char *SQLITE_STDCALL sqlite3_sql(sqlite3_stmt *pStmt){
  function SQLITE_PRIVATE (line 70025) | SQLITE_PRIVATE void sqlite3VdbeSwap(Vdbe *pA, Vdbe *pB){
  function growOpArray (line 70054) | static int growOpArray(Vdbe *v, int nOp){
  function test_addop_breakpoint (line 70088) | static void test_addop_breakpoint(void){
  function SQLITE_NOINLINE (line 70110) | static SQLITE_NOINLINE int growOp3(Vdbe *p, int op, int p1, int p2, int ...
  function SQLITE_PRIVATE (line 70116) | SQLITE_PRIVATE int sqlite3VdbeAddOp3(Vdbe *p, int op, int p1, int p2, in...
  function SQLITE_PRIVATE (line 70162) | SQLITE_PRIVATE int sqlite3VdbeAddOp0(Vdbe *p, int op){
  function SQLITE_PRIVATE (line 70165) | SQLITE_PRIVATE int sqlite3VdbeAddOp1(Vdbe *p, int op, int p1){
  function SQLITE_PRIVATE (line 70168) | SQLITE_PRIVATE int sqlite3VdbeAddOp2(Vdbe *p, int op, int p1, int p2){
  function SQLITE_PRIVATE (line 70174) | SQLITE_PRIVATE int sqlite3VdbeGoto(Vdbe *p, int iDest){
  function SQLITE_PRIVATE (line 70181) | SQLITE_PRIVATE int sqlite3VdbeLoadString(Vdbe *p, int iDest, const char ...
  function SQLITE_PRIVATE (line 70193) | SQLITE_PRIVATE void sqlite3VdbeMultiLoad(Vdbe *p, int iDest, const char ...
  function SQLITE_PRIVATE (line 70213) | SQLITE_PRIVATE int sqlite3VdbeAddOp4(
  function SQLITE_PRIVATE (line 70231) | SQLITE_PRIVATE int sqlite3VdbeAddOp4Dup8(
  function SQLITE_PRIVATE (line 70253) | SQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe *p, int iDb, char *...
  function SQLITE_PRIVATE (line 70262) | SQLITE_PRIVATE int sqlite3VdbeAddOp4Int(
  function SQLITE_PRIVATE (line 70277) | SQLITE_PRIVATE void sqlite3VdbeEndCoroutine(Vdbe *v, int regYield){
  function SQLITE_PRIVATE (line 70304) | SQLITE_PRIVATE int sqlite3VdbeMakeLabel(Vdbe *v){
  function SQLITE_PRIVATE (line 70323) | SQLITE_PRIVATE void sqlite3VdbeResolveLabel(Vdbe *v, int x){
  function SQLITE_PRIVATE (line 70338) | SQLITE_PRIVATE void sqlite3VdbeRunOnlyOnce(Vdbe *p){
  function SQLITE_PRIVATE (line 70345) | SQLITE_PRIVATE void sqlite3VdbeReusable(Vdbe *p){
  type VdbeOpIter (line 70367) | typedef struct VdbeOpIter VdbeOpIter;
  type VdbeOpIter (line 70368) | struct VdbeOpIter {
  function Op (line 70375) | static Op *opIterNext(VdbeOpIter *p){
  function SQLITE_PRIVATE (line 70440) | SQLITE_PRIVATE int sqlite3VdbeAssertMayAbort(Vdbe *v, int mayAbort){
  function resolveP2Values (line 70500) | static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){
  function SQLITE_PRIVATE (line 70584) | SQLITE_PRIVATE int sqlite3VdbeCurrentAddr(Vdbe *p){
  function SQLITE_PRIVATE (line 70598) | SQLITE_PRIVATE void sqlite3VdbeVerifyNoMallocRequired(Vdbe *p, int N){
  function SQLITE_PRIVATE (line 70614) | SQLITE_PRIVATE VdbeOp *sqlite3VdbeTakeOpArray(Vdbe *p, int *pnOp, int *p...
  function SQLITE_PRIVATE (line 70634) | SQLITE_PRIVATE VdbeOp *sqlite3VdbeAddOpList(
  function SQLITE_PRIVATE (line 70682) | SQLITE_PRIVATE void sqlite3VdbeScanStatus(
  function SQLITE_PRIVATE (line 70710) | SQLITE_PRIVATE void sqlite3VdbeChangeOpcode(Vdbe *p, u32 addr, u8 iNewOp...
  function SQLITE_PRIVATE (line 70713) | SQLITE_PRIVATE void sqlite3VdbeChangeP1(Vdbe *p, u32 addr, int val){
  function SQLITE_PRIVATE (line 70716) | SQLITE_PRIVATE void sqlite3VdbeChangeP2(Vdbe *p, u32 addr, int val){
  function SQLITE_PRIVATE (line 70719) | SQLITE_PRIVATE void sqlite3VdbeChangeP3(Vdbe *p, u32 addr, int val){
  function SQLITE_PRIVATE (line 70722) | SQLITE_PRIVATE void sqlite3VdbeChangeP5(Vdbe *p, u8 p5){
  function SQLITE_PRIVATE (line 70730) | SQLITE_PRIVATE void sqlite3VdbeJumpHere(Vdbe *p, int addr){
  function freeEphemeralFunction (line 70740) | static void freeEphemeralFunction(sqlite3 *db, FuncDef *pDef){
  function freeP4 (line 70751) | static void freeP4(sqlite3 *db, int p4type, void *p4){
  function vdbeFreeOpArray (line 70805) | static void vdbeFreeOpArray(sqlite3 *db, Op *aOp, int nOp){
  function SQLITE_PRIVATE (line 70823) | SQLITE_PRIVATE void sqlite3VdbeLinkSubProgram(Vdbe *pVdbe, SubProgram *p){
  function SQLITE_PRIVATE (line 70831) | SQLITE_PRIVATE int sqlite3VdbeChangeToNoop(Vdbe *p, int addr){
  function SQLITE_PRIVATE (line 70847) | SQLITE_PRIVATE int sqlite3VdbeDeletePriorOpcode(Vdbe *p, u8 op){
  function vdbeChangeP4Full (line 70872) | static void SQLITE_NOINLINE vdbeChangeP4Full(
  function SQLITE_PRIVATE (line 70891) | SQLITE_PRIVATE void sqlite3VdbeChangeP4(Vdbe *p, int addr, const char *z...
  function SQLITE_PRIVATE (line 70929) | SQLITE_PRIVATE void sqlite3VdbeSetP4KeyInfo(Parse *pParse, Index *pIdx){
  function vdbeVComment (line 70944) | static void vdbeVComment(Vdbe *p, const char *zFormat, va_list ap){
  function SQLITE_PRIVATE (line 70953) | SQLITE_PRIVATE void sqlite3VdbeComment(Vdbe *p, const char *zFormat, ...){
  function SQLITE_PRIVATE (line 70961) | SQLITE_PRIVATE void sqlite3VdbeNoopComment(Vdbe *p, const char *zFormat,...
  function SQLITE_PRIVATE (line 70976) | SQLITE_PRIVATE void sqlite3VdbeSetLineNumber(Vdbe *v, int iLine){
  function SQLITE_PRIVATE (line 70994) | SQLITE_PRIVATE VdbeOp *sqlite3VdbeGetOp(Vdbe *p, int addr){
  function translateP (line 71015) | static int translateP(char c, const Op *pOp){
  function displayComment (line 71036) | static int displayComment(
  function displayP4Expr (line 71105) | static void displayP4Expr(StrAccum *p, Expr *pExpr){
  function SQLITE_PRIVATE (line 71303) | SQLITE_PRIVATE void sqlite3VdbeUsesBtree(Vdbe *p, int i){
  function SQLITE_PRIVATE (line 71334) | SQLITE_PRIVATE void sqlite3VdbeEnter(Vdbe *p){
  function SQLITE_NOINLINE (line 71355) | static SQLITE_NOINLINE void vdbeLeave(Vdbe *p){
  function SQLITE_PRIVATE (line 71369) | SQLITE_PRIVATE void sqlite3VdbeLeave(Vdbe *p){
  function SQLITE_PRIVATE (line 71379) | SQLITE_PRIVATE void sqlite3VdbePrintOp(FILE *pOut, int pc, Op *pOp){
  function releaseMemArray (line 71405) | static void releaseMemArray(Mem *p, int N){
  function SQLITE_PRIVATE (line 71451) | SQLITE_PRIVATE void sqlite3VdbeFrameDelete(VdbeFrame *p){
  function SQLITE_PRIVATE (line 71479) | SQLITE_PRIVATE int sqlite3VdbeList(
  function SQLITE_PRIVATE (line 71658) | SQLITE_PRIVATE void sqlite3VdbePrintSql(Vdbe *p){
  function SQLITE_PRIVATE (line 71677) | SQLITE_PRIVATE void sqlite3VdbeIOTraceSql(Vdbe *p){
  type ReusableSpace (line 71707) | struct ReusableSpace {
  type ReusableSpace (line 71728) | struct ReusableSpace
  function SQLITE_PRIVATE (line 71750) | SQLITE_PRIVATE void sqlite3VdbeRewind(Vdbe *p){
  function SQLITE_PRIVATE (line 71803) | SQLITE_PRIVATE void sqlite3VdbeMakeReady(
  function SQLITE_PRIVATE (line 71912) | SQLITE_PRIVATE void sqlite3VdbeFreeCursor(Vdbe *p, VdbeCursor *pCx){
  function closeCursorsInFrame (line 71949) | static void closeCursorsInFrame(Vdbe *p){
  function SQLITE_PRIVATE (line 71967) | SQLITE_PRIVATE int sqlite3VdbeFrameRestore(VdbeFrame *pFrame){
  function closeAllCursors (line 71998) | static void closeAllCursors(Vdbe *p){
  function Cleanup (line 72025) | static void Cleanup(Vdbe *p){
  function SQLITE_PRIVATE (line 72049) | SQLITE_PRIVATE void sqlite3VdbeSetNumCols(Vdbe *p, int nResColumn){
  function SQLITE_PRIVATE (line 72077) | SQLITE_PRIVATE int sqlite3VdbeSetColName(
  function vdbeCommit (line 72105) | static int vdbeCommit(sqlite3 *db, Vdbe *p){
  function checkActiveVdbeCnt (line 72367) | static void checkActiveVdbeCnt(sqlite3 *db){
  function SQLITE_PRIVATE (line 72399) | SQLITE_PRIVATE int sqlite3VdbeCloseStatement(Vdbe *p, int eOp){
  function SQLITE_PRIVATE (line 72465) | SQLITE_PRIVATE int sqlite3VdbeCheckFk(Vdbe *p, int deferred){
  function SQLITE_PRIVATE (line 72492) | SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe *p){
  function SQLITE_PRIVATE (line 72694) | SQLITE_PRIVATE void sqlite3VdbeResetStepResult(Vdbe *p){
  function SQLITE_PRIVATE (line 72706) | SQLITE_PRIVATE int sqlite3VdbeTransferError(Vdbe *p){
  function vdbeInvokeSqllog (line 72728) | static void vdbeInvokeSqllog(Vdbe *v){
  function SQLITE_PRIVATE (line 72755) | SQLITE_PRIVATE int sqlite3VdbeReset(Vdbe *p){
  function SQLITE_PRIVATE (line 72835) | SQLITE_PRIVATE int sqlite3VdbeFinalize(Vdbe *p){
  function SQLITE_PRIVATE (line 72861) | SQLITE_PRIVATE void sqlite3VdbeDeleteAuxData(sqlite3 *db, AuxData **pp, ...
  function SQLITE_PRIVATE (line 72887) | SQLITE_PRIVATE void sqlite3VdbeClearObject(sqlite3 *db, Vdbe *p){
  function SQLITE_PRIVATE (line 72915) | SQLITE_PRIVATE void sqlite3VdbeDelete(Vdbe *p){
  function handleDeferredMoveto (line 72941) | static int SQLITE_NOINLINE handleDeferredMoveto(VdbeCursor *p){
  function handleMovedCursor (line 72967) | static int SQLITE_NOINLINE handleMovedCursor(VdbeCursor *p){
  function SQLITE_PRIVATE (line 72982) | SQLITE_PRIVATE int sqlite3VdbeCursorRestore(VdbeCursor *p){
  function SQLITE_PRIVATE (line 73003) | SQLITE_PRIVATE int sqlite3VdbeCursorMoveto(VdbeCursor **pp, int *piCol){
  function SQLITE_PRIVATE (line 73067) | SQLITE_PRIVATE u32 sqlite3VdbeSerialType(Mem *pMem, int file_format, u32...
  function SQLITE_PRIVATE (line 73139) | SQLITE_PRIVATE u32 sqlite3VdbeSerialTypeLen(u32 serial_type){
  function SQLITE_PRIVATE (line 73148) | SQLITE_PRIVATE u8 sqlite3VdbeOneByteSerialTypeLen(u8 serial_type){
  function u64 (line 73188) | static u64 floatSwap(u64 in){
  function SQLITE_PRIVATE (line 73219) | SQLITE_PRIVATE u32 sqlite3VdbeSerialPut(u8 *buf, Mem *pMem, u32 serial_t...
  function u32 (line 73273) | static u32 SQLITE_NOINLINE serialGet(
  function SQLITE_PRIVATE (line 73309) | SQLITE_PRIVATE u32 sqlite3VdbeSerialGet(
  function SQLITE_PRIVATE (line 73408) | SQLITE_PRIVATE UnpackedRecord *sqlite3VdbeAllocUnpackedRecord(
  function SQLITE_PRIVATE (line 73445) | SQLITE_PRIVATE void sqlite3VdbeRecordUnpack(
  function vdbeRecordCompareDebug (line 73492) | static int vdbeRecordCompareDebug(
  function vdbeAssertFieldCountWithinLimits (line 73597) | static void vdbeAssertFieldCountWithinLimits(
  function vdbeCompareMemString (line 73627) | static int vdbeCompareMemString(
  function SQLITE_NOINLINE (line 73664) | static SQLITE_NOINLINE int sqlite3BlobCompare(const Mem *pB1, const Mem ...
  function sqlite3IntFloatCompare (line 73675) | static int sqlite3IntFloatCompare(i64 i, double r){
  function SQLITE_PRIVATE (line 73708) | SQLITE_PRIVATE int sqlite3MemCompare(const Mem *pMem1, const Mem *pMem2,...
  function i64 (line 73794) | static i64 vdbeRecordDecodeInt(u32 serial_type, const u8 *aKey){
  function SQLITE_PRIVATE (line 73849) | SQLITE_PRIVATE int sqlite3VdbeRecordCompareWithSkip(
  function SQLITE_PRIVATE (line 74028) | SQLITE_PRIVATE int sqlite3VdbeRecordCompare(
  function vdbeRecordCompareInt (line 74045) | static int vdbeRecordCompareInt(
  function vdbeRecordCompareString (line 74138) | static int vdbeRecordCompareString(
  function SQLITE_PRIVATE (line 74199) | SQLITE_PRIVATE RecordCompare sqlite3VdbeFindCompare(UnpackedRecord *p){
  function SQLITE_PRIVATE (line 74245) | SQLITE_PRIVATE int sqlite3VdbeIdxRowid(sqlite3 *db, BtCursor *pCur, i64 ...
  function SQLITE_PRIVATE (line 74323) | SQLITE_PRIVATE int sqlite3VdbeIdxKeyCompare(
  function SQLITE_PRIVATE (line 74359) | SQLITE_PRIVATE void sqlite3VdbeSetChanges(sqlite3 *db, int nChange){
  function SQLITE_PRIVATE (line 74369) | SQLITE_PRIVATE void sqlite3VdbeCountChanges(Vdbe *v){
  function SQLITE_PRIVATE (line 74383) | SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3 *db){
  function SQLITE_PRIVATE (line 74393) | SQLITE_PRIVATE sqlite3 *sqlite3VdbeDb(Vdbe *v){
  function SQLITE_PRIVATE (line 74405) | SQLITE_PRIVATE sqlite3_value *sqlite3VdbeGetBoundValue(Vdbe *v, int iVar...
  function SQLITE_PRIVATE (line 74426) | SQLITE_PRIVATE void sqlite3VdbeSetVarmask(Vdbe *v, int iVar){
  function SQLITE_PRIVATE (line 74441) | SQLITE_PRIVATE void sqlite3VtabImportErrmsg(Vdbe *p, sqlite3_vtab *pVtab){
  function vdbeFreeUnpacked (line 74462) | static void vdbeFreeUnpacked(sqlite3 *db, UnpackedRecord *p){
  function SQLITE_PRIVATE (line 74481) | SQLITE_PRIVATE void sqlite3VdbePreUpdateHook(
  function SQLITE_STDCALL (line 74565) | SQLITE_STDCALL sqlite3_expired(sqlite3_stmt *pStmt){
  function vdbeSafety (line 74576) | static int vdbeSafety(Vdbe *p){
  function vdbeSafetyNotNull (line 74584) | static int vdbeSafetyNotNull(Vdbe *p){
  function SQLITE_NOINLINE (line 74598) | static SQLITE_NOINLINE void invokeProfileCallback(sqlite3 *db, Vdbe *p){
  function SQLITE_STDCALL (line 74627) | SQLITE_STDCALL sqlite3_finalize(sqlite3_stmt *pStmt){
  function SQLITE_STDCALL (line 74654) | SQLITE_STDCALL sqlite3_reset(sqlite3_stmt *pStmt){
  function SQLITE_STDCALL (line 74675) | SQLITE_STDCALL sqlite3_clear_bindings(sqlite3_stmt *pStmt){
  function SQLITE_API (line 74699) | SQLITE_API const void *SQLITE_STDCALL sqlite3_value_blob(sqlite3_value *...
  function SQLITE_STDCALL (line 74712) | SQLITE_STDCALL sqlite3_value_bytes(sqlite3_value *pVal){
  function SQLITE_STDCALL (line 74715) | SQLITE_STDCALL sqlite3_value_bytes16(sqlite3_value *pVal){
  function SQLITE_STDCALL (line 74718) | SQLITE_STDCALL sqlite3_value_double(sqlite3_value *pVal){
  function SQLITE_STDCALL (line 74721) | SQLITE_STDCALL sqlite3_value_int(sqlite3_value *pVal){
  function SQLITE_STDCALL (line 74724) | SQLITE_STDCALL sqlite3_value_int64(sqlite3_value *pVal){
  function SQLITE_STDCALL (line 74727) | SQLITE_STDCALL sqlite3_value_subtype(sqlite3_value *pVal){
  function SQLITE_API (line 74735) | SQLITE_API const void *SQLITE_STDCALL sqlite3_value_text16(sqlite3_value...
  function SQLITE_API (line 74738) | SQLITE_API const void *SQLITE_STDCALL sqlite3_value_text16be(sqlite3_val...
  function SQLITE_API (line 74741) | SQLITE_API const void *SQLITE_STDCALL sqlite3_value_text16le(sqlite3_val...
  function SQLITE_STDCALL (line 74749) | SQLITE_STDCALL sqlite3_value_type(sqlite3_value* pVal){
  function SQLITE_STDCALL (line 74812) | SQLITE_STDCALL sqlite3_value_free(sqlite3_value *pOld){
  function setResultStrOrError (line 74828) | static void setResultStrOrError(
  function invokeValueDestructor (line 74839) | static int invokeValueDestructor(
  function SQLITE_STDCALL (line 74855) | SQLITE_STDCALL sqlite3_result_blob(
  function SQLITE_STDCALL (line 74865) | SQLITE_STDCALL sqlite3_result_blob64(
  function SQLITE_STDCALL (line 74879) | SQLITE_STDCALL sqlite3_result_double(sqlite3_context *pCtx, double rVal){
  function SQLITE_STDCALL (line 74883) | SQLITE_STDCALL sqlite3_result_error(sqlite3_context *pCtx, const char *z...
  function SQLITE_STDCALL (line 74890) | SQLITE_STDCALL sqlite3_result_error16(sqlite3_context *pCtx, const void ...
  function SQLITE_STDCALL (line 74897) | SQLITE_STDCALL sqlite3_result_int(sqlite3_context *pCtx, int iVal){
  function SQLITE_STDCALL (line 74901) | SQLITE_STDCALL sqlite3_result_int64(sqlite3_context *pCtx, i64 iVal){
  function SQLITE_STDCALL (line 74905) | SQLITE_STDCALL sqlite3_result_null(sqlite3_context *pCtx){
  function SQLITE_STDCALL (line 74909) | SQLITE_STDCALL sqlite3_result_subtype(sqlite3_context *pCtx, unsigned in...
  function SQLITE_STDCALL (line 74915) | SQLITE_STDCALL sqlite3_result_text(
  function SQLITE_STDCALL (line 74924) | SQLITE_STDCALL sqlite3_result_text64(
  function SQLITE_STDCALL (line 74941) | SQLITE_STDCALL sqlite3_result_text16(
  function SQLITE_STDCALL (line 74950) | SQLITE_STDCALL sqlite3_result_text16be(
  function SQLITE_STDCALL (line 74959) | SQLITE_STDCALL sqlite3_result_text16le(
  function SQLITE_STDCALL (line 74969) | SQLITE_STDCALL sqlite3_result_value(sqlite3_context *pCtx, sqlite3_value...
  function SQLITE_STDCALL (line 74973) | SQLITE_STDCALL sqlite3_result_zeroblob(sqlite3_context *pCtx, int n){
  function SQLITE_STDCALL (line 74977) | SQLITE_STDCALL sqlite3_result_zeroblob64(sqlite3_context *pCtx, u64 n){
  function SQLITE_STDCALL (line 74986) | SQLITE_STDCALL sqlite3_result_error_code(sqlite3_context *pCtx, int errC...
  function SQLITE_STDCALL (line 74999) | SQLITE_STDCALL sqlite3_result_error_toobig(sqlite3_context *pCtx){
  function SQLITE_STDCALL (line 75008) | SQLITE_STDCALL sqlite3_result_error_nomem(sqlite3_context *pCtx){
  function doWalCallbacks (line 75020) | static int doWalCallbacks(sqlite3 *db){
  function sqlite3Step (line 75050) | static int sqlite3Step(Vdbe *p){
  function SQLITE_STDCALL (line 75179) | SQLITE_STDCALL sqlite3_step(sqlite3_stmt *pStmt){
  function SQLITE_API (line 75230) | SQLITE_API void *SQLITE_STDCALL sqlite3_user_data(sqlite3_context *p){
  function SQLITE_API (line 75245) | SQLITE_API sqlite3 *SQLITE_STDCALL sqlite3_context_db_handle(sqlite3_con...
  function SQLITE_PRIVATE (line 75257) | SQLITE_PRIVATE sqlite3_int64 sqlite3StmtCurrentTime(sqlite3_context *p){
  function SQLITE_PRIVATE (line 75281) | SQLITE_PRIVATE void sqlite3InvalidFunction(
  function SQLITE_NOINLINE (line 75299) | static SQLITE_NOINLINE void *createAggContext(sqlite3_context *p, int nB...
  function SQLITE_API (line 75321) | SQLITE_API void *SQLITE_STDCALL sqlite3_aggregate_context(sqlite3_contex...
  function SQLITE_API (line 75336) | SQLITE_API void *SQLITE_STDCALL sqlite3_get_auxdata(sqlite3_context *pCt...
  function SQLITE_STDCALL (line 75357) | SQLITE_STDCALL sqlite3_set_auxdata(
  function SQLITE_STDCALL (line 75412) | SQLITE_STDCALL sqlite3_aggregate_count(sqlite3_context *p){
  function SQLITE_STDCALL (line 75421) | SQLITE_STDCALL sqlite3_column_count(sqlite3_stmt *pStmt){
  function SQLITE_STDCALL (line 75430) | SQLITE_STDCALL sqlite3_data_count(sqlite3_stmt *pStmt){
  function Mem (line 75479) | static Mem *columnMem(sqlite3_stmt *pStmt, int i){
  function columnMallocFailure (line 75515) | static void columnMallocFailure(sqlite3_stmt *pStmt)
  function SQLITE_API (line 75533) | SQLITE_API const void *SQLITE_STDCALL sqlite3_column_blob(sqlite3_stmt *...
  function SQLITE_STDCALL (line 75543) | SQLITE_STDCALL sqlite3_column_bytes(sqlite3_stmt *pStmt, int i){
  function SQLITE_STDCALL (line 75548) | SQLITE_STDCALL sqlite3_column_bytes16(sqlite3_stmt *pStmt, int i){
  function SQLITE_STDCALL (line 75553) | SQLITE_STDCALL sqlite3_column_double(sqlite3_stmt *pStmt, int i){
  function SQLITE_STDCALL (line 75558) | SQLITE_STDCALL sqlite3_column_int(sqlite3_stmt *pStmt, int i){
  function SQLITE_STDCALL (line 75563) | SQLITE_STDCALL sqlite3_column_int64(sqlite3_stmt *pStmt, int i){
  function SQLITE_API (line 75583) | SQLITE_API const void *SQLITE_STDCALL sqlite3_column_text16(sqlite3_stmt...
  function SQLITE_STDCALL (line 75589) | SQLITE_STDCALL sqlite3_column_type(sqlite3_stmt *pStmt, int i){
  function SQLITE_API (line 75653) | SQLITE_API const char *SQLITE_STDCALL sqlite3_column_name(sqlite3_stmt *...
  function SQLITE_API (line 75658) | SQLITE_API const void *SQLITE_STDCALL sqlite3_column_name16(sqlite3_stmt...
  function SQLITE_API (line 75678) | SQLITE_API const char *SQLITE_STDCALL sqlite3_column_decltype(sqlite3_st...
  function SQLITE_API (line 75683) | SQLITE_API const void *SQLITE_STDCALL sqlite3_column_decltype16(sqlite3_...
  function SQLITE_API (line 75696) | SQLITE_API const char *SQLITE_STDCALL sqlite3_column_database_name(sqlit...
  function SQLITE_API (line 75701) | SQLITE_API const void *SQLITE_STDCALL sqlite3_column_database_name16(sql...
  function SQLITE_API (line 75712) | SQLITE_API const char *SQLITE_STDCALL sqlite3_column_table_name(sqlite3_...
  function SQLITE_API (line 75717) | SQLITE_API const void *SQLITE_STDCALL sqlite3_column_table_name16(sqlite...
  function SQLITE_API (line 75728) | SQLITE_API const char *SQLITE_STDCALL sqlite3_column_origin_name(sqlite3...
  function SQLITE_API (line 75733) | SQLITE_API const void *SQLITE_STDCALL sqlite3_column_origin_name16(sqlit...
  function vdbeUnbind (line 75756) | static int vdbeUnbind(Vdbe *p, int i){
  function bindText (line 75800) | static int bindText(
  function SQLITE_STDCALL (line 75834) | SQLITE_STDCALL sqlite3_bind_blob(
  function SQLITE_STDCALL (line 75846) | SQLITE_STDCALL sqlite3_bind_blob64(
  function SQLITE_STDCALL (line 75860) | SQLITE_STDCALL sqlite3_bind_double(sqlite3_stmt *pStmt, int i, double rV...
  function SQLITE_STDCALL (line 75870) | SQLITE_STDCALL sqlite3_bind_int(sqlite3_stmt *p, int i, int iValue){
  function SQLITE_STDCALL (line 75873) | SQLITE_STDCALL sqlite3_bind_int64(sqlite3_stmt *pStmt, int i, sqlite_int...
  function SQLITE_STDCALL (line 75883) | SQLITE_STDCALL sqlite3_bind_null(sqlite3_stmt *pStmt, int i){
  function SQLITE_STDCALL (line 75892) | SQLITE_STDCALL sqlite3_bind_text(
  function SQLITE_STDCALL (line 75901) | SQLITE_STDCALL sqlite3_bind_text64(
  function SQLITE_STDCALL (line 75918) | SQLITE_STDCALL sqlite3_bind_text16(
  function SQLITE_STDCALL (line 75928) | SQLITE_STDCALL sqlite3_bind_value(sqlite3_stmt *pStmt, int i, const sqli...
  function SQLITE_STDCALL (line 75959) | SQLITE_STDCALL sqlite3_bind_zeroblob(sqlite3_stmt *pStmt, int i, int n){
  function SQLITE_STDCALL (line 75969) | SQLITE_STDCALL sqlite3_bind_zeroblob64(sqlite3_stmt *pStmt, int i, sqlit...
  function SQLITE_STDCALL (line 75988) | SQLITE_STDCALL sqlite3_bind_parameter_count(sqlite3_stmt *pStmt){
  function SQLITE_API (line 75999) | SQLITE_API const char *SQLITE_STDCALL sqlite3_bind_parameter_name(sqlite...
  function SQLITE_PRIVATE (line 76012) | SQLITE_PRIVATE int sqlite3VdbeParameterIndex(Vdbe *p, const char *zName,...
  function SQLITE_STDCALL (line 76027) | SQLITE_STDCALL sqlite3_bind_parameter_index(sqlite3_stmt *pStmt, const c...
  function SQLITE_PRIVATE (line 76034) | SQLITE_PRIVATE int sqlite3TransferBindings(sqlite3_stmt *pFromStmt, sqli...
  function SQLITE_STDCALL (line 76061) | SQLITE_STDCALL sqlite3_transfer_bindings(sqlite3_stmt *pFromStmt, sqlite...
  function SQLITE_API (line 76083) | SQLITE_API sqlite3 *SQLITE_STDCALL sqlite3_db_handle(sqlite3_stmt *pStmt){
  function SQLITE_STDCALL (line 76091) | SQLITE_STDCALL sqlite3_stmt_readonly(sqlite3_stmt *pStmt){
  function SQLITE_STDCALL (line 76098) | SQLITE_STDCALL sqlite3_stmt_busy(sqlite3_stmt *pStmt){
  function SQLITE_STDCALL (line 76130) | SQLITE_STDCALL sqlite3_stmt_status(sqlite3_stmt *pStmt, int op, int rese...
  function UnpackedRecord (line 76150) | static UnpackedRecord *vdbeUnpackRecord(
  function SQLITE_STDCALL (line 76170) | SQLITE_STDCALL sqlite3_preupdate_old(sqlite3 *db, int iIdx, sqlite3_valu...
  function SQLITE_STDCALL (line 76226) | SQLITE_STDCALL sqlite3_preupdate_count(sqlite3 *db){
  function SQLITE_STDCALL (line 76244) | SQLITE_STDCALL sqlite3_preupdate_depth(sqlite3 *db){
  function SQLITE_STDCALL (line 76255) | SQLITE_STDCALL sqlite3_preupdate_new(sqlite3 *db, int iIdx, sqlite3_valu...
  function SQLITE_STDCALL (line 76329) | SQLITE_STDCALL sqlite3_stmt_scanstatus(
  function SQLITE_STDCALL (line 76388) | SQLITE_STDCALL sqlite3_stmt_scanstatus_reset(sqlite3_stmt *pStmt){
  function findNextHostParameter (line 76424) | static int findNextHostParameter(const char *zSql, int *pnToken){
  function SQLITE_PRIVATE (line 76467) | SQLITE_PRIVATE char *sqlite3VdbeExpandSql(
  function updateMaxBlobsize (line 76668) | static void updateMaxBlobsize(Mem *p){
  function vdbeTakeBranch (line 76726) | static void vdbeTakeBranch(int iSrcLine, u8 I, u8 M){
  function VdbeCursor (line 76770) | static VdbeCursor *allocateCursor(
  function applyNumericAffinity (line 76839) | static void applyNumericAffinity(Mem *pRec, int bTryForInt){
  function applyAffinity (line 76873) | static void applyAffinity(
  function SQLITE_STDCALL (line 76909) | SQLITE_STDCALL sqlite3_value_numeric_type(sqlite3_value *pVal){
  function SQLITE_PRIVATE (line 76923) | SQLITE_PRIVATE void sqlite3ValueApplyAffinity(
  function u16 (line 76937) | static u16 SQLITE_NOINLINE computeNumericType(Mem *pMem){
  function u16 (line 76956) | static u16 numericType(Mem *pMem){
  function SQLITE_PRIVATE (line 76971) | SQLITE_PRIVATE void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf){
  function memTracePrint (line 77053) | static void memTracePrint(Mem *p){
  function registerTrace (line 77075) | static void registerTrace(int iReg, Mem *p){
  function sqlite_uint64 (line 77126) | __inline__ sqlite_uint64 sqlite3Hwtime(void){
  function sqlite_uint64 (line 77134) | __declspec(naked) __inline sqlite_uint64 __cdecl sqlite3Hwtime(void){
  function sqlite_uint64 (line 77145) | __inline__ sqlite_uint64 sqlite3Hwtime(void){
  function sqlite_uint64 (line 77153) | __inline__ sqlite_uint64 sqlite3Hwtime(void){
  function sqlite3Hwtime (line 77177) | sqlite3Hwtime(void){ return ((sqlite_uint64)0); }
  function checkSavepointCount (line 77199) | static int checkSavepointCount(sqlite3 *db){
  function SQLITE_NOINLINE (line 77212) | static SQLITE_NOINLINE Mem *out2PrereleaseWithClear(Mem *pOut){
  function Mem (line 77217) | static Mem *out2Prerelease(Vdbe *p, VdbeOp *pOp){
  function SQLITE_PRIVATE (line 77236) | SQLITE_PRIVATE int sqlite3VdbeExec(
  type Incrblob (line 83637) | typedef struct Incrblob Incrblob;
  type Incrblob (line 83638) | struct Incrblob {
  function blobSeekToRow (line 83668) | static int blobSeekToRow(Incrblob *p, sqlite3_int64 iRow, char **pzErr){
  function SQLITE_STDCALL (line 83722) | SQLITE_STDCALL sqlite3_blob_open(
  function SQLITE_STDCALL (line 83963) | SQLITE_STDCALL sqlite3_blob_close(sqlite3_blob *pBlob){
  function blobReadWrite (line 83983) | static int blobReadWrite(
  function SQLITE_STDCALL (line 84056) | SQLITE_STDCALL sqlite3_blob_read(sqlite3_blob *pBlob, void *z, int n, in...
  function SQLITE_STDCALL (line 84063) | SQLITE_STDCALL sqlite3_blob_write(sqlite3_blob *pBlob, const void *z, in...
  function SQLITE_STDCALL (line 84073) | SQLITE_STDCALL sqlite3_blob_bytes(sqlite3_blob *pBlob){
  function SQLITE_STDCALL (line 84088) | SQLITE_STDCALL sqlite3_blob_reopen(sqlite3_blob *pBlob, sqlite3_int64 iR...
  type MergeEngine (line 84281) | typedef struct MergeEngine MergeEngine;
  type PmaReader (line 84282) | typedef struct PmaReader PmaReader;
  type PmaWriter (line 84283) | typedef struct PmaWriter PmaWriter;
  type SorterRecord (line 84284) | typedef struct SorterRecord SorterRecord;
  type SortSubtask (line 84285) | typedef struct SortSubtask SortSubtask;
  type SorterFile (line 84286) | typedef struct SorterFile SorterFile;
  type SorterList (line 84287) | typedef struct SorterList SorterList;
  type IncrMerger (line 84288) | typedef struct IncrMerger IncrMerger;
  type SorterFile (line 84294) | struct SorterFile {
  type SorterList (line 84307) | struct SorterList {
  type MergeEngine (line 84377) | struct MergeEngine {
  type SortSubtask (line 84416) | struct SortSubtask {
  type VdbeSorter (line 84438) | struct VdbeSorter {
  type PmaReader (line 84471) | struct PmaReader {
  type IncrMerger (line 84517) | struct IncrMerger {
  type PmaWriter (line 84535) | struct PmaWriter {
  type SorterRecord (line 84563) | struct SorterRecord {
  function vdbePmaReaderClear (line 84590) | static void vdbePmaReaderClear(PmaReader *pReadr){
  function vdbePmaReadBlob (line 84607) | static int vdbePmaReadBlob(
  function vdbePmaReadVarint (line 84701) | static int vdbePmaReadVarint(PmaReader *p, u64 *pnOut){
  function vdbeSorterMapFile (line 84734) | static int vdbeSorterMapFile(SortSubtask *pTask, SorterFile *pFile, u8 *...
  function vdbePmaReaderSeek (line 84751) | static int vdbePmaReaderSeek(
  function vdbePmaReaderNext (line 84798) | static int vdbePmaReaderNext(PmaReader *pReadr){
  function vdbePmaReaderInit (line 84845) | static int vdbePmaReaderInit(
  function vdbeSorterCompareTail (line 84878) | static int vdbeSorterCompareTail(
  function vdbeSorterCompare (line 84905) | static int vdbeSorterCompare(
  function vdbeSorterCompareText (line 84924) | static int vdbeSorterCompareText(
  function vdbeSorterCompareInt (line 84965) | static int vdbeSorterCompareInt(
  function SQLITE_PRIVATE (line 85048) | SQLITE_PRIVATE int sqlite3VdbeSorterInit(
  function vdbeSorterRecordFree (line 85152) | static void vdbeSorterRecordFree(sqlite3 *db, SorterRecord *pRecord){
  function vdbeSortSubtaskCleanup (line 85165) | static void vdbeSortSubtaskCleanup(sqlite3 *db, SortSubtask *pTask){
  function vdbeSorterWorkDebug (line 85188) | static void vdbeSorterWorkDebug(SortSubtask *pTask, const char *zEvent){
  function vdbeSorterRewindDebug (line 85194) | static void vdbeSorterRewindDebug(const char *zEvent){
  function vdbeSorterPopulateDebug (line 85199) | static void vdbeSorterPopulateDebug(
  function vdbeSorterBlockDebug (line 85208) | static void vdbeSorterBlockDebug(
  function vdbeSorterJoinThread (line 85230) | static int vdbeSorterJoinThread(SortSubtask *pTask){
  function vdbeSorterCreateThread (line 85251) | static int vdbeSorterCreateThread(
  function vdbeSorterJoinAll (line 85264) | static int vdbeSorterJoinAll(VdbeSorter *pSorter, int rcin){
  function MergeEngine (line 85294) | static MergeEngine *vdbeMergeEngineNew(int nReader){
  function vdbeMergeEngineFree (line 85317) | static void vdbeMergeEngineFree(MergeEngine *pMerger){
  function vdbeIncrFree (line 85331) | static void vdbeIncrFree(IncrMerger *pIncr){
  function SQLITE_PRIVATE (line 85348) | SQLITE_PRIVATE void sqlite3VdbeSorterReset(sqlite3 *db, VdbeSorter *pSor...
  function SQLITE_PRIVATE (line 85381) | SQLITE_PRIVATE void sqlite3VdbeSorterClose(sqlite3 *db, VdbeCursor *pCsr){
  function vdbeSorterExtendFile (line 85403) | static void vdbeSorterExtendFile(sqlite3 *db, sqlite3_file *pFd, i64 nBy...
  function vdbeSorterOpenTempFile (line 85422) | static int vdbeSorterOpenTempFile(
  function vdbeSortAllocUnpacked (line 85449) | static int vdbeSortAllocUnpacked(SortSubtask *pTask){
  function vdbeSorterMerge (line 85468) | static void vdbeSorterMerge(
  function SorterCompare (line 85503) | static SorterCompare vdbeSorterGetCompare(VdbeSorter *p){
  function vdbeSorterSort (line 85517) | static int vdbeSorterSort(SortSubtask *pTask, SorterList *pList){
  function vdbePmaWriterInit (line 85572) | static void vdbePmaWriterInit(
  function vdbePmaWriteBlob (line 85594) | static void vdbePmaWriteBlob(PmaWriter *p, u8 *pData, int nData){
  function vdbePmaWriterFinish (line 85627) | static int vdbePmaWriterFinish(PmaWriter *p, i64 *piEof){
  function vdbePmaWriteVarint (line 85646) | static void vdbePmaWriteVarint(PmaWriter *p, u64 iVal){
  function vdbeSorterListToPMA (line 85667) | static int vdbeSorterListToPMA(SortSubtask *pTask, SorterList *pList){
  function vdbeMergeEngineStep (line 85731) | static int vdbeMergeEngineStep(
  function vdbeSorterFlushPMA (line 85816) | static int vdbeSorterFlushPMA(VdbeSorter *pSorter){
  function SQLITE_PRIVATE (line 85883) | SQLITE_PRIVATE int sqlite3VdbeSorterWrite(
  function vdbeIncrPopulate (line 85991) | static int vdbeIncrPopulate(IncrMerger *pIncr){
  function vdbeIncrBgPopulate (line 86043) | static int vdbeIncrBgPopulate(IncrMerger *pIncr){
  function vdbeIncrSwap (line 86067) | static int vdbeIncrSwap(IncrMerger *pIncr){
  function vdbeIncrMergerNew (line 86106) | static int vdbeIncrMergerNew(
  function vdbeIncrMergerSetThreads (line 86130) | static void vdbeIncrMergerSetThreads(IncrMerger *pIncr){
  function vdbeMergeEngineCompare (line 86143) | static void vdbeMergeEngineCompare(
  function vdbeMergeEngineInit (line 86225) | static int vdbeMergeEngineInit(
  function vdbePmaReaderIncrMergeInit (line 86296) | static int vdbePmaReaderIncrMergeInit(PmaReader *pReadr, int eMode){
  function vdbePmaReaderIncrInit (line 86384) | static int vdbePmaReaderIncrInit(PmaReader *pReadr, int eMode){
  function vdbeMergeEngineLevel0 (line 86414) | static int vdbeMergeEngineLevel0(
  function vdbeSorterTreeDepth (line 86453) | static int vdbeSorterTreeDepth(int nPMA){
  function vdbeSorterAddToTree (line 86471) | static int vdbeSorterAddToTree(
  function vdbeSorterMergeTreeBuild (line 86527) | static int vdbeSorterMergeTreeBuild(
  function vdbeSorterSetupMerge (line 86606) | static int vdbeSorterSetupMerge(VdbeSorter *pSorter){
  function SQLITE_PRIVATE (line 86688) | SQLITE_PRIVATE int sqlite3VdbeSorterRewind(const VdbeCursor *pCsr, int *...
  function SQLITE_PRIVATE (line 86736) | SQLITE_PRIVATE int sqlite3VdbeSorterNext(sqlite3 *db, const VdbeCursor *...
  function SQLITE_PRIVATE (line 86800) | SQLITE_PRIVATE int sqlite3VdbeSorterRowkey(const VdbeCursor *pCsr, Mem *...
  function SQLITE_PRIVATE (line 86833) | SQLITE_PRIVATE int sqlite3VdbeSorterCompare(
  type MemJournal (line 86901) | typedef struct MemJournal MemJournal;
  type FilePoint (line 86902) | typedef struct FilePoint FilePoint;
  type FileChunk (line 86903) | typedef struct FileChunk FileChunk;
  type FileChunk (line 86911) | struct FileChunk {
  type FilePoint (line 86931) | struct FilePoint {
  type MemJournal (line 86940) | struct MemJournal {
  function memjrnlRead (line 86959) | static int memjrnlRead(
  function memjrnlFreeChunks (line 87010) | static void memjrnlFreeChunks(MemJournal *p){
  function memjrnlCreateFile (line 87023) | static int memjrnlCreateFile(MemJournal *p){
  function memjrnlWrite (line 87062) | static int memjrnlWrite(
  function memjrnlTruncate (line 87140) | static int memjrnlTruncate(sqlite3_file *pJfd, sqlite_int64 size){
  function memjrnlClose (line 87156) | static int memjrnlClose(sqlite3_file *pJfd){
  function memjrnlSync (line 87168) | static int memjrnlSync(sqlite3_file *pJfd, int flags){
  function memjrnlFileSize (line 87176) | static int memjrnlFileSize(sqlite3_file *pJfd, sqlite_int64 *pSize){
  type sqlite3_io_methods (line 87185) | struct sqlite3_io_methods
  function SQLITE_PRIVATE (line 87219) | SQLITE_PRIVATE int sqlite3JournalOpen(
  function SQLITE_PRIVATE (line 87255) | SQLITE_PRIVATE void sqlite3MemJournalOpen(sqlite3_file *pJfd){
  function SQLITE_PRIVATE (line 87266) | SQLITE_PRIVATE int sqlite3JournalCreate(sqlite3_file *p){
  function SQLITE_PRIVATE (line 87280) | SQLITE_PRIVATE int sqlite3JournalIsInMemory(sqlite3_file *p){
  function SQLITE_PRIVATE (line 87288) | SQLITE_PRIVATE int sqlite3JournalSize(sqlite3_vfs *pVfs){
  function SQLITE_NOINLINE (line 87332) | static SQLITE_NOINLINE int walkExpr(Walker *pWalker, Expr *pExpr){
  function SQLITE_PRIVATE (line 87349) | SQLITE_PRIVATE int sqlite3WalkExpr(Walker *pWalker, Expr *pExpr){
  function SQLITE_PRIVATE (line 87357) | SQLITE_PRIVATE int sqlite3WalkExprList(Walker *pWalker, ExprList *p){
  function SQLITE_PRIVATE (line 87374) | SQLITE_PRIVATE int sqlite3WalkSelectExpr(Walker *pWalker, Select *p){
  function SQLITE_PRIVATE (line 87392) | SQLITE_PRIVATE int sqlite3WalkSelectFrom(Walker *pWalker, Select *p){
  function SQLITE_PRIVATE (line 87429) | SQLITE_PRIVATE int sqlite3WalkSelect(Walker *pWalker, Select *p){
  function incrAggDepth (line 87487) | static int incrAggDepth(Walker *pWalker, Expr *pExpr){
  function incrAggFunctionDepth (line 87491) | static void incrAggFunctionDepth(Expr *pExpr, int N){
  function resolveAlias (line 87520) | static void resolveAlias(
  function nameInUsingClause (line 87569) | static int nameInUsingClause(IdList *pUsing, const char *zCol){
  function SQLITE_PRIVATE (line 87586) | SQLITE_PRIVATE int sqlite3MatchSpanName(
  function lookupName (line 87636) | static int lookupName(
  function SQLITE_PRIVATE (line 87959) | SQLITE_PRIVATE Expr *sqlite3CreateColumnExpr(sqlite3 *db, SrcList *pSrc,...
  function notValid (line 87982) | static void notValid(
  function exprProbability (line 88004) | static int exprProbability(Expr *p){
  function resolveExprStep (line 88024) | static int resolveExprStep(Walker *pWalker, Expr *pExpr){
  function resolveAsName (line 88248) | static int resolveAsName(
  function resolveOrderByTermToExprList (line 88287) | static int resolveOrderByTermToExprList(
  function resolveOutOfRangeError (line 88334) | static void resolveOutOfRangeError(
  function resolveCompoundOrderBy (line 88360) | static int resolveCompoundOrderBy(
  function SQLITE_PRIVATE (line 88458) | SQLITE_PRIVATE int sqlite3ResolveOrderGroupBy(
  function resolveOrderGroupBy (line 88509) | static int resolveOrderGroupBy(
  function resolveSelectStep (line 88567) | static int resolveSelectStep(Walker *pWalker, Select *p){
  function SQLITE_PRIVATE (line 88835) | SQLITE_PRIVATE int sqlite3ResolveExprNames(
  function SQLITE_PRIVATE (line 88880) | SQLITE_PRIVATE int sqlite3ResolveExprListNames(
  function SQLITE_PRIVATE (line 88905) | SQLITE_PRIVATE void sqlite3ResolveSelectNames(
  function SQLITE_PRIVATE (line 88932) | SQLITE_PRIVATE void sqlite3ResolveSelfReference(
  function SQLITE_PRIVATE (line 88990) | SQLITE_PRIVATE char sqlite3ExprAffinity(Expr *pExpr){
  function SQLITE_PRIVATE (line 89026) | SQLITE_PRIVATE Expr *sqlite3ExprAddCollateToken(
  function SQLITE_PRIVATE (line 89042) | SQLITE_PRIVATE Expr *sqlite3ExprAddCollateString(Parse *pParse, Expr *pE...
  function SQLITE_PRIVATE (line 89053) | SQLITE_PRIVATE Expr *sqlite3ExprSkipCollate(Expr *pExpr){
  function SQLITE_PRIVATE (line 89077) | SQLITE_PRIVATE CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr){
  function SQLITE_PRIVATE (line 89141) | SQLITE_PRIVATE char sqlite3CompareAffinity(Expr *pExpr, char aff2){
  function comparisonAffinity (line 89168) | static char comparisonAffinity(Expr *pExpr){
  function SQLITE_PRIVATE (line 89191) | SQLITE_PRIVATE int sqlite3IndexAffinityOk(Expr *pExpr, char idx_affinity){
  function u8 (line 89207) | static u8 binaryCompareP5(Expr *pExpr1, Expr *pExpr2, int jumpIfNull){
  function SQLITE_PRIVATE (line 89225) | SQLITE_PRIVATE CollSeq *sqlite3BinaryCompareCollSeq(
  function codeCompare (line 89248) | static int codeCompare(
  function SQLITE_PRIVATE (line 89275) | SQLITE_PRIVATE int sqlite3ExprCheckHeight(Parse *pParse, int nHeight){
  function heightOfExpr (line 89296) | static void heightOfExpr(Expr *p, int *pnHeight){
  function heightOfExprList (line 89303) | static void heightOfExprList(ExprList *p, int *pnHeight){
  function heightOfSelect (line 89311) | static void heightOfSelect(Select *p, int *pnHeight){
  function exprSetHeight (line 89334) | static void exprSetHeight(Expr *p){
  function SQLITE_PRIVATE (line 89355) | SQLITE_PRIVATE void sqlite3ExprSetHeightAndFlags(Parse *pParse, Expr *p){
  function SQLITE_PRIVATE (line 89365) | SQLITE_PRIVATE int sqlite3SelectExprHeight(Select *p){
  function SQLITE_PRIVATE (line 89375) | SQLITE_PRIVATE void sqlite3ExprSetHeightAndFlags(Parse *pParse, Expr *p){
  function SQLITE_PRIVATE (line 89403) | SQLITE_PRIVATE Expr *sqlite3ExprAlloc(
  function SQLITE_PRIVATE (line 89452) | SQLITE_PRIVATE Expr *sqlite3Expr(
  function SQLITE_PRIVATE (line 89469) | SQLITE_PRIVATE void sqlite3ExprAttachSubtrees(
  function SQLITE_PRIVATE (line 89499) | SQLITE_PRIVATE Expr *sqlite3PExpr(
  function SQLITE_PRIVATE (line 89524) | SQLITE_PRIVATE void sqlite3PExprAddSelect(Parse *pParse, Expr *pExpr, Se...
  function exprAlwaysTrue (line 89550) | static int exprAlwaysTrue(Expr *p){
  function exprAlwaysFalse (line 89556) | static int exprAlwaysFalse(Expr *p){
  function SQLITE_PRIVATE (line 89571) | SQLITE_PRIVATE Expr *sqlite3ExprAnd(sqlite3 *db, Expr *pLeft, Expr *pRig...
  function SQLITE_PRIVATE (line 89591) | SQLITE_PRIVATE Expr *sqlite3ExprFunction(Parse *pParse, ExprList *pList,...
  function SQLITE_PRIVATE (line 89622) | SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr){
  function SQLITE_NOINLINE (line 89696) | static SQLITE_NOINLINE void sqlite3ExprDeleteNN(sqlite3 *db, Expr *p){
  function SQLITE_PRIVATE (line 89716) | SQLITE_PRIVATE void sqlite3ExprDelete(sqlite3 *db, Expr *p){
  function exprStructSize (line 89725) | static int exprStructSize(Expr *p){
  function dupedExprStructSize (line 89765) | static int dupedExprStructSize(Expr *p, int flags){
  function dupedExprNodeSize (line 89792) | static int dupedExprNodeSize(Expr *p, int flags){
  function dupedExprSize (line 89813) | static int dupedExprSize(Expr *p, int flags){
  function Expr (line 89832) | static Expr *exprDup(sqlite3 *db, Expr *p, int dupFlags, u8 **pzBuffer){
  function With (line 89925) | static With *withDup(sqlite3 *db, With *p){
  function SQLITE_PRIVATE (line 89963) | SQLITE_PRIVATE Expr *sqlite3ExprDup(sqlite3 *db, Expr *p, int flags){
  function SQLITE_PRIVATE (line 89967) | SQLITE_PRIVATE ExprList *sqlite3ExprListDup(sqlite3 *db, ExprList *p, in...
  function SQLITE_PRIVATE (line 90004) | SQLITE_PRIVATE SrcList *sqlite3SrcListDup(sqlite3 *db, SrcList *p, int f...
  function SQLITE_PRIVATE (line 90045) | SQLITE_PRIVATE IdList *sqlite3IdListDup(sqlite3 *db, IdList *p){
  function SQLITE_PRIVATE (line 90069) | SQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3 *db, Select *p, int flags){
  function SQLITE_PRIVATE (line 90098) | SQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3 *db, Select *p, int flags){
  function SQLITE_PRIVATE (line 90113) | SQLITE_PRIVATE ExprList *sqlite3ExprListAppend(
  function SQLITE_PRIVATE (line 90155) | SQLITE_PRIVATE void sqlite3ExprListSetSortOrder(ExprList *p, int iSortOr...
  function SQLITE_PRIVATE (line 90174) | SQLITE_PRIVATE void sqlite3ExprListSetName(
  function SQLITE_PRIVATE (line 90199) | SQLITE_PRIVATE void sqlite3ExprListSetSpan(
  function SQLITE_PRIVATE (line 90220) | SQLITE_PRIVATE void sqlite3ExprListCheckLength(
  function SQLITE_NOINLINE (line 90236) | static SQLITE_NOINLINE void exprListDeleteNN(sqlite3 *db, ExprList *pList){
  function SQLITE_PRIVATE (line 90248) | SQLITE_PRIVATE void sqlite3ExprListDelete(sqlite3 *db, ExprList *pList){
  function SQLITE_PRIVATE (line 90256) | SQLITE_PRIVATE u32 sqlite3ExprListFlags(const ExprList *pList){
  function exprNodeIsConstant (line 90294) | static int exprNodeIsConstant(Walker *pWalker, Expr *pExpr){
  function selectNodeIsConstant (line 90348) | static int selectNodeIsConstant(Walker *pWalker, Select *NotUsed){
  function exprIsConst (line 90353) | static int exprIsConst(Expr *p, int initFlag, int iCur){
  function SQLITE_PRIVATE (line 90372) | SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr *p){
  function SQLITE_PRIVATE (line 90382) | SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr *p){
  function SQLITE_PRIVATE (line 90392) | SQLITE_PRIVATE int sqlite3ExprIsTableConstant(Expr *p, int iCur){
  function SQLITE_PRIVATE (line 90405) | SQLITE_PRIVATE int sqlite3ExprIsConstantOrFunction(Expr *p, u8 isInit){
  function SQLITE_PRIVATE (line 90415) | SQLITE_PRIVATE int sqlite3ExprContainsSubquery(Expr *p){
  function SQLITE_PRIVATE (line 90432) | SQLITE_PRIVATE int sqlite3ExprIsInteger(Expr *p, int *pValue){
  function SQLITE_PRIVATE (line 90477) | SQLITE_PRIVATE int sqlite3ExprCanBeNull(const Expr *p){
  function SQLITE_PRIVATE (line 90507) | SQLITE_PRIVATE int sqlite3ExprNeedsNoAffinityChange(const Expr *p, char ...
  function SQLITE_PRIVATE (line 90540) | SQLITE_PRIVATE int sqlite3IsRowid(const char *z){
  function Select (line 90555) | static Select *isCandidateForInOpt(Expr *pX){
  function SQLITE_PRIVATE (line 90595) | SQLITE_PRIVATE int sqlite3CodeOnce(Parse *pParse){
  function sqlite3SetHasNullFlag (line 90606) | static void sqlite3SetHasNullFlag(Vdbe *v, int iCur, int regHasNull){
  function sqlite3InRhsIsConstant (line 90622) | static int sqlite3InRhsIsConstant(Expr *pIn){
  function SQLITE_PRIVATE (line 90705) | SQLITE_PRIVATE int sqlite3FindInIndex(Parse *pParse, Expr *pX, u32 inFla...
  function SQLITE_PRIVATE (line 90855) | SQLITE_PRIVATE int sqlite3CodeSubselect(
  function sqlite3ExprCodeIN (line 91085) | static void sqlite3ExprCodeIN(
  function codeReal (line 91244) | static void codeReal(Vdbe *v, const char *z, int negateFlag, int iMem){
  function codeInteger (line 91262) | static void codeInteger(Parse *pParse, Expr *pExpr, int negFlag, int iMem){
  function cacheIsValid (line 91299) | static int cacheIsValid(Parse *pParse){
  function cacheEntryClear (line 91311) | static void cacheEntryClear(Parse *pParse, struct yColCache *p){
  function SQLITE_PRIVATE (line 91328) | SQLITE_PRIVATE void sqlite3ExprCacheStore(Parse *pParse, int iTab, int i...
  function SQLITE_PRIVATE (line 91396) | SQLITE_PRIVATE void sqlite3ExprCacheRemove(Parse *pParse, int iReg, int ...
  function SQLITE_PRIVATE (line 91412) | SQLITE_PRIVATE void sqlite3ExprCachePush(Parse *pParse){
  function SQLITE_PRIVATE (line 91426) | SQLITE_PRIVATE void sqlite3ExprCachePop(Parse *pParse){
  function sqlite3ExprCachePinRegister (line 91449) | static void sqlite3ExprCachePinRegister(Parse *pParse, int iReg){
  function SQLITE_PRIVATE (line 91462) | SQLITE_PRIVATE void sqlite3ExprCodeLoadIndexColumn(
  function SQLITE_PRIVATE (line 91484) | SQLITE_PRIVATE void sqlite3ExprCodeGetColumnOfTable(
  function SQLITE_PRIVATE (line 91518) | SQLITE_PRIVATE int sqlite3ExprCodeGetColumn(
  function SQLITE_PRIVATE (line 91546) | SQLITE_PRIVATE void sqlite3ExprCodeGetColumnToReg(
  function SQLITE_PRIVATE (line 91561) | SQLITE_PRIVATE void sqlite3ExprCacheClear(Parse *pParse){
  function SQLITE_PRIVATE (line 91581) | SQLITE_PRIVATE void sqlite3ExprCacheAffinityChange(Parse *pParse, int iS...
  function SQLITE_PRIVATE (line 91589) | SQLITE_PRIVATE void sqlite3ExprCodeMove(Parse *pParse, int iFrom, int iT...
  function usedAsColumnCache (line 91603) | static int usedAsColumnCache(Parse *pParse, int iFrom, int iTo){
  function exprToRegister (line 91618) | static void exprToRegister(Expr *p, int iReg){
  function SQLITE_PRIVATE (line 91636) | SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int...
  function SQLITE_PRIVATE (line 92248) | SQLITE_PRIVATE void sqlite3ExprCodeAtInit(
  function SQLITE_PRIVATE (line 92280) | SQLITE_PRIVATE int sqlite3ExprCodeTemp(Parse *pParse, Expr *pExpr, int *...
  function SQLITE_PRIVATE (line 92318) | SQLITE_PRIVATE void sqlite3ExprCode(Parse *pParse, Expr *pExpr, int targ...
  function SQLITE_PRIVATE (line 92338) | SQLITE_PRIVATE void sqlite3ExprCodeCopy(Parse *pParse, Expr *pExpr, int ...
  function SQLITE_PRIVATE (line 92351) | SQLITE_PRIVATE void sqlite3ExprCodeFactorable(Parse *pParse, Expr *pExpr...
  function SQLITE_PRIVATE (line 92371) | SQLITE_PRIVATE void sqlite3ExprCodeAndCache(Parse *pParse, Expr *pExpr, ...
  function SQLITE_PRIVATE (line 92399) | SQLITE_PRIVATE int sqlite3ExprCodeExprList(
  function exprCodeBetween (line 92452) | static void exprCodeBetween(
  function SQLITE_PRIVATE (line 92509) | SQLITE_PRIVATE void sqlite3ExprIfTrue(Parse *pParse, Expr *pExpr, int de...
  function SQLITE_PRIVATE (line 92630) | SQLITE_PRIVATE void sqlite3ExprIfFalse(Parse *pParse, Expr *pExpr, int d...
  function SQLITE_PRIVATE (line 92778) | SQLITE_PRIVATE void sqlite3ExprIfFalseDup(Parse *pParse, Expr *pExpr, in...
  function SQLITE_PRIVATE (line 92810) | SQLITE_PRIVATE int sqlite3ExprCompare(Expr *pA, Expr *pB, int iTab){
  function SQLITE_PRIVATE (line 92868) | SQLITE_PRIVATE int sqlite3ExprListCompare(ExprList *pA, ExprList *pB, in...
  function SQLITE_PRIVATE (line 92902) | SQLITE_PRIVATE int sqlite3ExprImpliesExpr(Expr *pE1, Expr *pE2, int iTab){
  type SrcCount (line 92927) | struct SrcCount {
  function exprSrcCount (line 92936) | static int exprSrcCount(Walker *pWalker, Expr *pExpr){
  function SQLITE_PRIVATE (line 92965) | SQLITE_PRIVATE int sqlite3FunctionUsesThisSrc(Expr *pExpr, SrcList *pSrc...
  function addAggInfoColumn (line 92983) | static int addAggInfoColumn(sqlite3 *db, AggInfo *pInfo){
  function addAggInfoFunc (line 92999) | static int addAggInfoFunc(sqlite3 *db, AggInfo *pInfo){
  function analyzeAggregate (line 93016) | static int analyzeAggregate(Walker *pWalker, Expr *pExpr){
  function analyzeAggregatesInSelect (line 93141) | static int analyzeAggregatesInSelect(Walker *pWalker, Select *pSelect){
  function SQLITE_PRIVATE (line 93156) | SQLITE_PRIVATE void sqlite3ExprAnalyzeAggregates(NameContext *pNC, Expr ...
  function SQLITE_PRIVATE (line 93172) | SQLITE_PRIVATE void sqlite3ExprAnalyzeAggList(NameContext *pNC, ExprList...
  function SQLITE_PRIVATE (line 93185) | SQLITE_PRIVATE int sqlite3GetTempReg(Parse *pParse){
  function SQLITE_PRIVATE (line 93200) | SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse *pParse, int iReg){
  function SQLITE_PRIVATE (line 93217) | SQLITE_PRIVATE int sqlite3GetTempRange(Parse *pParse, int nReg){
  function SQLITE_PRIVATE (line 93231) | SQLITE_PRIVATE void sqlite3ReleaseTempRange(Parse *pParse, int iReg, int...
  function SQLITE_PRIVATE (line 93242) | SQLITE_PRIVATE void sqlite3ClearTempRegCache(Parse *pParse){
  function SQLITE_PRIVATE (line 93253) | SQLITE_PRIVATE int sqlite3NoTempsInRange(Parse *pParse, int iFirst, int ...
  function renameTableFunc (line 93308) | static void renameTableFunc(
  function renameParentFunc (line 93373) | static void renameParentFunc(
  function renameTriggerFunc (line 93430) | static void renameTriggerFunc(
  function SQLITE_PRIVATE (line 93502) | SQLITE_PRIVATE void sqlite3AlterFunctions(void){
  function reloadTableSchema (line 93599) | static void reloadTableSchema(Parse *pParse, Table *pTab, const char *zN...
  function isSystemTable (line 93648) | static int isSystemTable(Parse *pParse, const char *zName){
  function SQLITE_PRIVATE (line 93660) | SQLITE_PRIVATE void sqlite3AlterRenameTable(
  function SQLITE_PRIVATE (line 93864) | SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pC...
  function SQLITE_PRIVATE (line 93999) | SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *pParse, SrcList *p...
  function openStatTable (line 94251) | static void openStatTable(
  type Stat4Accum (line 94344) | typedef struct Stat4Accum Stat4Accum;
  type Stat4Sample (line 94345) | typedef struct Stat4Sample Stat4Sample;
  type Stat4Sample (line 94346) | struct Stat4Sample {
  type Stat4Accum (line 94361) | struct Stat4Accum {
  function sampleClear (line 94380) | static void sampleClear(sqlite3 *db, Stat4Sample *p){
  function sampleSetRowid (line 94392) | static void sampleSetRowid(sqlite3 *db, Stat4Sample *p, int n, const u8 ...
  function sampleSetRowidInt64 (line 94408) | static void sampleSetRowidInt64(sqlite3 *db, Stat4Sample *p, i64 iRowid){
  function sampleCopy (line 94421) | static void sampleCopy(Stat4Accum *p, Stat4Sample *pTo, Stat4Sample *pFr...
  function stat4Destructor (line 94439) | static void stat4Destructor(void *pOld){
  type Stat4Sample (line 94533) | struct Stat4Sample
  function sampleIsBetterPost (line 94578) | static int sampleIsBetterPost(
  function sampleIsBetter (line 94602) | static int sampleIsBetter(
  function sampleInsert (line 94629) | static void sampleInsert(Stat4Accum *p, Stat4Sample *pNew, int nEqZero){
  function samplePushPrevious (line 94719) | static void samplePushPrevious(Stat4Accum *p, int iChng){
  function statPush (line 94785) | static void statPush(
  function statGet (line 94884) | static void statGet(
  function callStatGet (line 95010) | static void callStatGet(Vdbe *v, int regStat4, int iParam, int regOut){
  function analyzeOneTable (line 95028) | static void analyzeOneTable(
  function loadAnalysis (line 95354) | static void loadAnalysis(Parse *pParse, int iDb){
  function analyzeDatabase (line 95364) | static void analyzeDatabase(Parse *pParse, int iDb){
  function analyzeTable (line 95391) | static void analyzeTable(Parse *pParse, Table *pTab, Index *pOnlyIdx){
  function SQLITE_PRIVATE (line 95422) | SQLITE_PRIVATE void sqlite3Analyze(Parse *pParse, Token *pName1, Token *...
  type analysisInfo (line 95486) | typedef struct analysisInfo analysisInfo;
  type analysisInfo (line 95487) | struct analysisInfo {
  function analysisLoader (line 95568) | static int analysisLoader(void *pData, int argc, char **argv, char **Not...
  function SQLITE_PRIVATE (line 95626) | SQLITE_PRIVATE void sqlite3DeleteIndexSamples(sqlite3 *db, Index *pIdx){
  function initAvgEq (line 95651) | static void initAvgEq(Index *pIdx){
  function Index (line 95710) | static Index *findIndexOrPrimaryKey(
  function loadStatTbl (line 95736) | static int loadStatTbl(
  function loadStat4 (line 95860) | static int loadStat4(sqlite3 *db, const char *zDb){
  function SQLITE_PRIVATE (line 95904) | SQLITE_PRIVATE int sqlite3AnalysisLoad(sqlite3 *db, int iDb){
  function resolveAttachExpr (line 96004) | static int resolveAttachExpr(NameContext *pName, Expr *pExpr)
  function attachFunc (line 96028) | static void attachFunc(
  function detachFunc (line 96230) | static void detachFunc(
  function codeAttach (line 96282) | static void codeAttach(
  function SQLITE_PRIVATE (line 96355) | SQLITE_PRIVATE void sqlite3Detach(Parse *pParse, Expr *pDbname){
  function SQLITE_PRIVATE (line 96374) | SQLITE_PRIVATE void sqlite3Attach(Parse *pParse, Expr *p, Expr *pDbname,...
  function SQLITE_PRIVATE (line 96393) | SQLITE_PRIVATE void sqlite3FixInit(
  function SQLITE_PRIVATE (line 96426) | SQLITE_PRIVATE int sqlite3FixSrcList(
  function SQLITE_PRIVATE (line 96456) | SQLITE_PRIVATE int sqlite3FixSelect(
  function SQLITE_PRIVATE (line 96489) | SQLITE_PRIVATE int sqlite3FixExpr(
  function SQLITE_PRIVATE (line 96515) | SQLITE_PRIVATE int sqlite3FixExprList(
  function SQLITE_PRIVATE (line 96532) | SQLITE_PRIVATE int sqlite3FixTriggerStep(
  function SQLITE_STDCALL (line 96623) | SQLITE_STDCALL sqlite3_set_authorizer(
  function sqliteAuthBadReturnCode (line 96643) | static void sqliteAuthBadReturnCode(Parse *pParse){
  function SQLITE_PRIVATE (line 96657) | SQLITE_PRIVATE int sqlite3AuthReadCol(
  function SQLITE_PRIVATE (line 96694) | SQLITE_PRIVATE void sqlite3AuthRead(
  function SQLITE_PRIVATE (line 96751) | SQLITE_PRIVATE int sqlite3AuthCheck(
  function SQLITE_PRIVATE (line 96791) | SQLITE_PRIVATE void sqlite3AuthContextPush(
  function SQLITE_PRIVATE (line 96806) | SQLITE_PRIVATE void sqlite3AuthContextPop(AuthContext *pContext){
  type TableLock (line 96848) | struct TableLock {
  function SQLITE_PRIVATE (line 96865) | SQLITE_PRIVATE void sqlite3TableLock(
  function codeTableLocks (line 96905) | static void codeTableLocks(Parse *pParse){
  function SQLITE_PRIVATE (line 96929) | SQLITE_PRIVATE int sqlite3DbMaskAllZero(yDbMask m){
  function SQLITE_PRIVATE (line 96946) | SQLITE_PRIVATE void sqlite3FinishCoding(Parse *pParse){
  function SQLITE_PRIVATE (line 97074) | SQLITE_PRIVATE void sqlite3NestedParse(Parse *pParse, const char *zForma...
  function SQLITE_PRIVATE (line 97105) | SQLITE_PRIVATE int sqlite3UserAuthTable(const char *zTable){
  function SQLITE_PRIVATE (line 97122) | SQLITE_PRIVATE Table *sqlite3FindTable(sqlite3 *db, const char *zName, c...
  function SQLITE_PRIVATE (line 97155) | SQLITE_PRIVATE Table *sqlite3LocateTable(
  function SQLITE_PRIVATE (line 97203) | SQLITE_PRIVATE Table *sqlite3LocateTableItem(
  function SQLITE_PRIVATE (line 97231) | SQLITE_PRIVATE Index *sqlite3FindIndex(sqlite3 *db, const char *zName, c...
  function freeIndex (line 97251) | static void freeIndex(sqlite3 *db, Index *p){
  function SQLITE_PRIVATE (line 97271) | SQLITE_PRIVATE void sqlite3UnlinkAndDeleteIndex(sqlite3 *db, int iDb, co...
  function SQLITE_PRIVATE (line 97304) | SQLITE_PRIVATE void sqlite3CollapseDatabaseArray(sqlite3 *db){
  function SQLITE_PRIVATE (line 97330) | SQLITE_PRIVATE void sqlite3ResetOneSchema(sqlite3 *db, int iDb){
  function SQLITE_PRIVATE (line 97356) | SQLITE_PRIVATE void sqlite3ResetAllSchemasOfConnection(sqlite3 *db){
  function SQLITE_PRIVATE (line 97374) | SQLITE_PRIVATE void sqlite3CommitInternalChanges(sqlite3 *db){
  function SQLITE_PRIVATE (line 97382) | SQLITE_PRIVATE void sqlite3DeleteColumnNames(sqlite3 *db, Table *pTable){
  function deleteTable (line 97411) | static void SQLITE_NOINLINE deleteTable(sqlite3 *db, Table *pTable){
  function SQLITE_PRIVATE (line 97454) | SQLITE_PRIVATE void sqlite3DeleteTable(sqlite3 *db, Table *pTable){
  function SQLITE_PRIVATE (line 97466) | SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTable(sqlite3 *db, int iDb, co...
  function SQLITE_PRIVATE (line 97494) | SQLITE_PRIVATE char *sqlite3NameFromToken(sqlite3 *db, Token *pName){
  function SQLITE_PRIVATE (line 97509) | SQLITE_PRIVATE void sqlite3OpenMasterTable(Parse *p, int iDb){
  function SQLITE_PRIVATE (line 97524) | SQLITE_PRIVATE int sqlite3FindDbName(sqlite3 *db, const char *zName){
  function SQLITE_PRIVATE (line 97541) | SQLITE_PRIVATE int sqlite3FindDb(sqlite3 *db, Token *pName){
  function SQLITE_PRIVATE (line 97566) | SQLITE_PRIVATE int sqlite3TwoPartName(
  function SQLITE_PRIVATE (line 97602) | SQLITE_PRIVATE int sqlite3CheckObjectName(Parse *pParse, const char *zNa...
  function SQLITE_PRIVATE (line 97615) | SQLITE_PRIVATE Index *sqlite3PrimaryKeyIndex(Table *pTab){
  function SQLITE_PRIVATE (line 97625) | SQLITE_PRIVATE i16 sqlite3ColumnOfIndex(Index *pIdx, i16 iCol){
  function SQLITE_PRIVATE (line 97649) | SQLITE_PRIVATE void sqlite3StartTable(
  function SQLITE_PRIVATE (line 97839) | SQLITE_PRIVATE void sqlite3ColumnPropertiesFromName(Table *pTab, Column ...
  function SQLITE_PRIVATE (line 97857) | SQLITE_PRIVATE void sqlite3AddColumn(Parse *pParse, Token *pName, Token ...
  function SQLITE_PRIVATE (line 97920) | SQLITE_PRIVATE void sqlite3AddNotNull(Parse *pParse, int onError){
  function SQLITE_PRIVATE (line 97952) | SQLITE_PRIVATE char sqlite3AffinityType(const char *zIn, u8 *pszEst){
  function SQLITE_PRIVATE (line 98024) | SQLITE_PRIVATE void sqlite3AddDefaultValue(Parse *pParse, ExprSpan *pSpan){
  function sqlite3StringToId (line 98070) | static void sqlite3StringToId(Expr *p){
  function SQLITE_PRIVATE (line 98096) | SQLITE_PRIVATE void sqlite3AddPrimaryKey(
  function SQLITE_PRIVATE (line 98170) | SQLITE_PRIVATE void sqlite3AddCheckConstraint(
  function SQLITE_PRIVATE (line 98195) | SQLITE_PRIVATE void sqlite3AddCollateType(Parse *pParse, Token *pToken){
  function SQLITE_PRIVATE (line 98247) | SQLITE_PRIVATE CollSeq *sqlite3LocateCollSeq(Parse *pParse, const char *...
  function SQLITE_PRIVATE (line 98278) | SQLITE_PRIVATE void sqlite3ChangeCookie(Parse *pParse, int iDb){
  function identLength (line 98294) | static int identLength(const char *z){
  function identPut (line 98315) | static void identPut(char *z, int *pIdx, char *zSignedIdent){
  function resizeIndexObject (line 98411) | static int resizeIndexObject(sqlite3 *db, Index *pIdx, int N){
  function estimateTableWidth (line 98435) | static void estimateTableWidth(Table *pTab){
  function estimateIndexWidth (line 98449) | static void estimateIndexWidth(Index *pIdx){
  function hasColumn (line 98463) | static int hasColumn(const i16 *aiCol, int nCol, int x){
  function convertToWithoutRowidTable (line 98491) | static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){
  function SQLITE_PRIVATE (line 98631) | SQLITE_PRIVATE void sqlite3EndTable(
  function SQLITE_PRIVATE (line 98873) | SQLITE_PRIVATE void sqlite3CreateView(
  function SQLITE_PRIVATE (line 98945) | SQLITE_PRIVATE int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){
  function sqliteViewResetAll (line 99057) | static void sqliteViewResetAll(sqlite3 *db, int idx){
  function SQLITE_PRIVATE (line 99093) | SQLITE_PRIVATE void sqlite3RootPageMoved(sqlite3 *db, int iDb, int iFrom...
  function destroyRootPage (line 99123) | static void destroyRootPage(Parse *pParse, int iTable, int iDb){
  function destroyTable (line 99152) | static void destroyTable(Parse *pParse, Table *pTab){
  function sqlite3ClearStatTables (line 99210) | static void sqlite3ClearStatTables(
  function SQLITE_PRIVATE (line 99233) | SQLITE_PRIVATE void sqlite3CodeDropTable(Parse *pParse, Table *pTab, int...
  function SQLITE_PRIVATE (line 99304) | SQLITE_PRIVATE void sqlite3DropTable(Parse *pParse, SrcList *pName, int ...
  function SQLITE_PRIVATE (line 99419) | SQLITE_PRIVATE void sqlite3CreateForeignKey(
  function SQLITE_PRIVATE (line 99540) | SQLITE_PRIVATE void sqlite3DeferForeignKey(Parse *pParse, int isDeferred){
  function sqlite3RefillIndex (line 99561) | static void sqlite3RefillIndex(Parse *pParse, Index *pIndex, int memRoot...
  function SQLITE_PRIVATE (line 99648) | SQLITE_PRIVATE Index *sqlite3AllocateIndexObject(
  function SQLITE_PRIVATE (line 99692) | SQLITE_PRIVATE Index *sqlite3CreateIndex(
  function SQLITE_PRIVATE (line 100241) | SQLITE_PRIVATE void sqlite3DefaultRowEst(Index *pIdx){
  function SQLITE_PRIVATE (line 100269) | SQLITE_PRIVATE void sqlite3DropIndex(Parse *pParse, SrcList *pName, int ...
  function SQLITE_PRIVATE (line 100350) | SQLITE_PRIVATE void *sqlite3ArrayAllocate(
  function SQLITE_PRIVATE (line 100381) | SQLITE_PRIVATE IdList *sqlite3IdListAppend(sqlite3 *db, IdList *pList, T...
  function SQLITE_PRIVATE (line 100405) | SQLITE_PRIVATE void sqlite3IdListDelete(sqlite3 *db, IdList *pList){
  function SQLITE_PRIVATE (line 100419) | SQLITE_PRIVATE int sqlite3IdListIndex(IdList *pList, const char *zName){
  function SQLITE_PRIVATE (line 100447) | SQLITE_PRIVATE SrcList *sqlite3SrcListEnlarge(
  function SQLITE_PRIVATE (line 100529) | SQLITE_PRIVATE SrcList *sqlite3SrcListAppend(
  function SQLITE_PRIVATE (line 100566) | SQLITE_PRIVATE void sqlite3SrcListAssignCursors(Parse *pParse, SrcList *...
  function SQLITE_PRIVATE (line 100584) | SQLITE_PRIVATE void sqlite3SrcListDelete(sqlite3 *db, SrcList *pList){
  function SQLITE_PRIVATE (line 100618) | SQLITE_PRIVATE SrcList *sqlite3SrcListAppendFromTerm(
  function SQLITE_PRIVATE (line 100662) | SQLITE_PRIVATE void sqlite3SrcListIndexedBy(Parse *pParse, SrcList *p, T...
  function SQLITE_PRIVATE (line 100684) | SQLITE_PRIVATE void sqlite3SrcListFuncArgs(Parse *pParse, SrcList *p, Ex...
  function SQLITE_PRIVATE (line 100712) | SQLITE_PRIVATE void sqlite3SrcListShiftJoinType(SrcList *p){
  function SQLITE_PRIVATE (line 100725) | SQLITE_PRIVATE void sqlite3BeginTransaction(Parse *pParse, int type){
  function SQLITE_PRIVATE (line 100750) | SQLITE_PRIVATE void sqlite3CommitTransaction(Parse *pParse){
  function SQLITE_PRIVATE (line 100767) | SQLITE_PRIVATE void sqlite3RollbackTransaction(Parse *pParse){
  function SQLITE_PRIVATE (line 100785) | SQLITE_PRIVATE void sqlite3Savepoint(Parse *pParse, int op, Token *pName){
  function SQLITE_PRIVATE (line 100805) | SQLITE_PRIVATE int sqlite3OpenTempDatabase(Parse *pParse){
  function SQLITE_PRIVATE (line 100840) | SQLITE_PRIVATE void sqlite3CodeVerifySchema(Parse *pParse, int iDb){
  function SQLITE_PRIVATE (line 100861) | SQLITE_PRIVATE void sqlite3CodeVerifyNamedSchema(Parse *pParse, const ch...
  function SQLITE_PRIVATE (line 100885) | SQLITE_PRIVATE void sqlite3BeginWriteOperation(Parse *pParse, int setSta...
  function SQLITE_PRIVATE (line 100899) | SQLITE_PRIVATE void sqlite3Mul
Condensed preview — 11 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (7,947K chars).
[
  {
    "path": "LICENSE",
    "chars": 1070,
    "preview": "MIT License\n\nCopyright (c) 2017 Diego Macario\n\nPermission is hereby granted, free of charge, to any person obtaining a c"
  },
  {
    "path": "README.md",
    "chars": 6345,
    "preview": "<p align=\"center\">\n  <img src=\"https://github.com/diegomacario/Poor-Fox/blob/master/readme_images/poor_fox_ascii_logo.pn"
  },
  {
    "path": "code/CmdLineParser.h",
    "chars": 19964,
    "preview": "#include <string>\n#include <vector>\n#include <iostream>\n#include <fstream>\n#include <algorithm>\n#include <cctype>\n#inclu"
  },
  {
    "path": "code/Makefile",
    "chars": 268,
    "preview": "CXX = g++ -std=c++11\ncc = gcc\n\nLIB = -lpthread -ldl\nBIN = sqlite pfox\n\nall : $(BIN)\nsqlite : sqlite3.c shell.c\n\t$(cc) -o"
  },
  {
    "path": "code/TablePrinter.h",
    "chars": 42426,
    "preview": "#include <string>\n#include <vector>\n#include <iostream>\n#include <sstream>\n#include <fstream>\n#include <iomanip>\n#inclu"
  },
  {
    "path": "code/main.cpp",
    "chars": 31030,
    "preview": "#include \"CmdLineParser.h\"\n#include \"TablePrinter.h\"\n#include \"sqlite3.h\"\n#include <sstream>\n#include <fstream>\n#includ"
  },
  {
    "path": "code/shell.c",
    "chars": 175474,
    "preview": "/*\n** 2001 September 15\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here i"
  },
  {
    "path": "code/sqlite3.c",
    "chars": 6915432,
    "preview": "/******************************************************************************\n** This file is an amalgamation of many "
  },
  {
    "path": "code/sqlite3.h",
    "chars": 486805,
    "preview": "/*\n** 2001 September 15\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here i"
  },
  {
    "path": "code/sqlite3ext.h",
    "chars": 29370,
    "preview": "/*\n** 2006 June 7\n**\n** The author disclaims copyright to this source code.  In place of\n** a legal notice, here is a bl"
  },
  {
    "path": "installer/unix_installer.sh",
    "chars": 1520,
    "preview": "#!/bin/bash\n\nset -e\nscript_runner=$(whoami)\nexec_path=\"/usr/local/bin/\"\nexec_name=\"pfox\"\nexec_full_path=\"${exec_path}${e"
  }
]

About this extraction

This page contains the full source code of the diegomacario/Poor-Fox GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 11 files (7.4 MB), approximately 1.9M tokens, and a symbol index with 4475 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.

Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.

Copied to clipboard!