]> git.mxchange.org Git - friendica.git/blobdiff - src/Util/Writer/DbaDefinitionSqlWriter.php
Fix: Pagination in search result works again
[friendica.git] / src / Util / Writer / DbaDefinitionSqlWriter.php
index 556957a85d9e12b3ab7c4f271c5f61e0c82af925..786eb866507f7aa88984453c370c193b443564b8 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2010-2022, the Friendica project
+ * @copyright Copyright (C) 2010-2023, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -22,6 +22,7 @@
 namespace Friendica\Util\Writer;
 
 use Exception;
+use Friendica\App;
 use Friendica\Database\Definition\DbaDefinition;
 
 /**
@@ -41,7 +42,7 @@ class DbaDefinitionSqlWriter
        public static function create(DbaDefinition $definition): string
        {
                $sqlString = "-- ------------------------------------------\n";
-               $sqlString .= "-- " . FRIENDICA_PLATFORM . " " . FRIENDICA_VERSION . " (" . FRIENDICA_CODENAME . ")\n";
+               $sqlString .= "-- " . App::PLATFORM . " " . App::VERSION . " (" . App::CODENAME . ")\n";
                $sqlString .= "-- DB_UPDATE_VERSION " . DB_UPDATE_VERSION . "\n";
                $sqlString .= "-- ------------------------------------------\n\n\n";
 
@@ -74,7 +75,7 @@ class DbaDefinitionSqlWriter
                $foreign_keys = [];
 
                foreach ($tableStructure['fields'] as $fieldName => $field) {
-                       $sql_rows[] = '`' . static::escape($fieldName) . '` ' . self::FieldCommand($field);
+                       $sql_rows[] = '`' . static::escape($fieldName) . '` ' . self::fieldCommand($field);
                        if (!empty($field['primary'])) {
                                $primary_keys[] = $fieldName;
                        }
@@ -170,20 +171,20 @@ class DbaDefinitionSqlWriter
         */
        public static function addTableField(string $fieldName, array $parameters): string
        {
-               return sprintf("ADD `%s` %s", static::escape($fieldName), static::FieldCommand($parameters));
+               return sprintf("ADD `%s` %s", static::escape($fieldName), static::fieldCommand($parameters));
        }
 
        /**
         * Creates the SQL definition to modify a table field
         *
         * @param string $fieldName  The table field name
-        * @param array  $parameters The paramters to modify
+        * @param array  $parameters The parameters to modify
         *
         * @return string The SQL definition
         */
        public static function modifyTableField(string $fieldName, array $parameters): string
        {
-               return sprintf("MODIFY `%s` %s", static::escape($fieldName), self::FieldCommand($parameters, false));
+               return sprintf("MODIFY `%s` %s", static::escape($fieldName), self::fieldCommand($parameters, false));
        }
 
        /**
@@ -193,7 +194,7 @@ class DbaDefinitionSqlWriter
         * @param boolean $create Whether to include PRIMARY KEY statement (unused)
         * @return string SQL statement part
         */
-       public static function FieldCommand(array $parameters, bool $create = true): string
+       public static function fieldCommand(array $parameters, bool $create = true): string
        {
                $fieldstruct = $parameters['type'];
 
@@ -234,7 +235,7 @@ class DbaDefinitionSqlWriter
         * @param string $method     The method to create the index (default is ADD)
         *
         * @return string The SQL definition
-        * @throws Exception in cases the paramter contains invalid content
+        * @throws Exception in cases the parameter contains invalid content
         */
        public static function createIndex(string $indexName, array $fieldNames, string $method = 'ADD'): string
        {