Exemplo n.º 1
0
        public SQLiteDatabase(SQLiteCommand cmd, bool getTotalRowsForEachTable)
        {
            _name = cmd.Connection.FileName;

            _listTable    = new SQLiteTableList(cmd);
            _listSequence = new SQLiteSequenceList(cmd);
            _listIndex    = new SQLiteIndexList(cmd);
            var tables = _listTable.ToList();

            _listView    = new SQLiteViewList(cmd, tables);
            _listTrigger = new SQLiteTriggerList(cmd, tables, _listView.ToList());

            if (getTotalRowsForEachTable)
            {
                GetTotalRows(cmd);
            }
        }
Exemplo n.º 2
0
        internal void Export(List <string> tablesToExport, SQLiteViewList allViews,
                             SQLiteBackup manager, List <string> exportedViews)
        {
            if (_isProcessed || manager.stopProcess)
            {
                return;
            }

            foreach (var dependantTable in _tableDependancies)
            {
                // skip views that are dependant on skiped tables
                if (!tablesToExport.Contains(dependantTable))
                {
                    return;
                }
            }
            foreach (var dependantView in _viewDependancies)
            {
                allViews[dependantView].Export(tablesToExport, allViews, manager, exportedViews);
            }


            _isProcessed = true;

            if (_createViewSQL.Trim().Length == 0)
            {
                return;
            }

            manager.Export_WriteLine(string.Format("DROP TABLE IF EXISTS `{0}`;", _name));
            manager.Export_WriteLine(string.Format("DROP VIEW IF EXISTS `{0}`;", _name));

            manager.Export_WriteLine(_createViewSQL);

            manager.textWriter.WriteLine();

            exportedViews.Add(_name);
        }