Get database size (from information_schema)
@return float
777198
public function getSize()
    {
        $app = Base::instance();
        $key = 'CACHE.db_size';
        if ($app->devoid($key)) {
            $sql = 'SELECT SUM(ROUND(((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024 ), 2)) AS mb_size'.
                ' FROM information_schema.TABLES WHERE TABLE_SCHEMA = ?';
            $query = $this->getConnection()->pdo()->prepare($sql);
            $query->execute([$this->getConfig('name')]);
            $result = $query->fetch(PDO::FETCH_ASSOC);

            $app->set($key, $result ? $result['mb_size'] : 0, 60);
        }

        return $app->get($key);
    }
1186210
public function getSize() : int
    {
        $files = $this->getFiles();
        $size = 0;
        foreach($files as $file) {
            $size += $file->getSize();
        }
        return $size;
    }
44548
public function getDiskQuotaMB() {
		$size = $this->getField('DiskQuotaMB');

		if(empty($size)) {
			$defaults = $this->config()->get('defaults');
			$size = (isset($defaults['DiskQuotaMB'])) ? $defaults['DiskQuotaMB'] : 0;
		}

		return $size;
	}
1177150
def size_on_disk(self):
        
        return int(self.connection.query(
            """
            SELECT SUM(data_length + index_length)
            FROM information_schema.tables WHERE table_schema='{db}'
            """.format(db=self.database)).fetchone()[0])
501736
protected function calculateSize()
    {
        $size = 0;

        if (($this->dataSize + $this->metaSize) > 127) {
            $size += 3;
        }

        if (count($this->binnArr) > 127) {
            $size += 3;
        }

        $this->size = ($this->dataSize + $this->metaSize) + $size;
        return $this->size;
    }
614386
public function getSize() : ?string 
    {
        if ( ! $this->hasSize()) {
            $this->setSize($this->getDefaultSize());
        }
        return $this->size;
    }
594307
Integer getDatabasePageSize(Class<? extends Storable> type) {
        if (mDatabasePageSizes == null) {
            return null;
        }
        Integer size = mDatabasePageSizes.get(type);
        if (size == null && type != null) {
            size = mDatabasePageSizes.get(null);
        }
        return size;
    }
1177053
public static int recordSize(Schema sch) {
		int pos = 0;
		for (String fldname : sch.fields())
			pos += Page.maxSize(sch.type(fldname));
		return pos < MIN_REC_SIZE ? MIN_REC_SIZE : pos;
	}
669337
def size(self):
        ''''''
        c = self.database.cursor()
        r = c.execute("SELECT sum(size) FROM files")

        try:
            size = int(r.fetchone()[0])
        except TypeError:
            size = 0

        return size
791878
protected function getSizeInfo()
	{
		$size = array();
		// since we check $i + 1 we need to stop one step earlier
		$this->dataLength = strlen($this->data) - 1;

		$sofStartRead = true;

		// Look through file for SOF marker
		for ($i = 2; $i < $this->dataLength; $i++)
		{
			$marker = $this->getNextMarker($i, $sofStartRead);

			if (in_array($marker, $this->sofMarkers))
			{
				// Extract size info from SOF marker
				return $this->extractSizeInfo($i);
			}
			else
			{
				// Extract length only
				$markerLength = $this->extractMarkerLength($i);

				if ($markerLength < 2)
				{
					return $size;
				}

				$i += $markerLength - 1;
				continue;
			}
		}

		return $size;
	}
718568
public static function getAllDbInfos() {
		if ( !isset( self::$dbInfos ) ) {
			global $kgCache;
			$key = kfCacheKey( 'base', 'labsdb', 'meta', 'dbinfos' );
			$value = $kgCache->get( $key );
			if ( $value === false ) {
				$value = self::fetchAllDbInfos();
				$kgCache->set( $key, $value, 3600 * 24 );
			}
			self::$dbInfos = $value;
		}

		return self::$dbInfos;
	}
1192274
public function getIndexSize() {

		$sQuery = 'SHOW TABLE STATUS';
		$lTable = $this->getAll($sQuery);
		$lIndex = array_column($lTable, 'Index_length');
		$iIndex = array_sum($lIndex);

		return $iIndex;
	}
371919
protected function getModelPageSize()
    {
        $pageSize = $this->getModelInformation()->list->page_size;

        if (is_array($pageSize)) {
            return (int) head($pageSize);
        }

        return (int) $pageSize;
    }
687088
public function actionIndex(): int
    {
        $dataTypes = $this->getDataTypes();
        $definitions = [];
        $overrideData = Data::parseYamlFile($this->overrideFile);

        $this->disableLogging();

        try {
            // Import from single file.
            if ($this->getStorageType() === self::SINGLE_FILE) {
                $definitions = $this->importDefinitionsFromFile($overrideData);
                $this->importFromDefinitions($dataTypes, $definitions);

                Schematic::info('Loaded schema from '.$this->file);
            }

            // Import from multiple files.
            if ($this->getStorageType() === self::MULTIPLE_FILES) {
                $definitions = $this->importDefinitionsFromDirectory($overrideData);
                $this->importFromDefinitions($dataTypes, $definitions);

                Schematic::info('Loaded schema from '.$this->path);
            }

            return 0;
        } catch (\Exception $e) {
            Schematic::error($e->getMessage());
            return 1;
        }
    }
885846
public function getSosaCount(){
        if(!$this->is_setup) return 0;
        return Database::prepare(
            'SELECT COUNT(majs_sosa) FROM `##maj_sosa`' .
            ' WHERE majs_gedcom_id=:tree_id AND majs_user_id=:user_id')
            ->execute(array(
                'tree_id' => $this->tree->getTreeId(), 
                'user_id' => $this->user->getUserId() 
            ))->fetchOne() ?: 0;
    }
299754
public function getSizeTable($database_table)
    {
        $nodes = $this->getNodesByTable($database_table);
        // scan need node`s
        foreach ($nodes as $node)
        {
            if (empty($this->_table_size_cache[$node]))
            {
                $this->_table_size_cache[$node] = $this->client($node)->tablesSize(true);
            }
        }

        $sizes = [];
        foreach ($this->_table_size_cache as $node=>$rows)
        {
            foreach ($rows as $row)
            {
                $sizes[$row['database'] . '.' . $row['table']][$node] = $row;
                @$sizes[$row['database'] . '.' . $row['table']]['total']['sizebytes'] += $row['sizebytes'];



            }
        }

        if (empty($sizes[$database_table]))
        {
            return null;
        }
        return $sizes[$database_table]['total']['sizebytes'];
    }
150102
public function size() : int
    {
        if ($this->bufSize == null) {
            $this->bufSize = strlen($this->buf);
        }
        return $this->bufSize;
    }