]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Fix mysql dialect text docstring, length should be interpreted as byte size 11018/head
authorZhong Zheng <Zhong-z@users.noreply.github.com>
Thu, 15 Feb 2024 06:26:21 +0000 (17:26 +1100)
committerZhong Zheng <Zhong-z@users.noreply.github.com>
Fri, 16 Feb 2024 08:01:36 +0000 (19:01 +1100)
mysql interpreted the length as bytes
https://dev.mysql.com/doc/refman/5.7/en/storage-requirements.html
https://dev.mysql.com/doc/refman/8.0/en/storage-requirements.html

lib/sqlalchemy/dialects/mysql/types.py

index f563ead357f7aaca3e91cb6684a179beeb5b782e..20fe15c044e04747259124676ed7673ca23e4e16 100644 (file)
@@ -499,7 +499,7 @@ class YEAR(sqltypes.TypeEngine):
 
 
 class TEXT(_StringType, sqltypes.TEXT):
-    """MySQL TEXT type, for text up to 2^16 characters."""
+    """MySQL TEXT type, for character storage encoded up to 2^16 bytes."""
 
     __visit_name__ = "TEXT"
 
@@ -508,7 +508,7 @@ class TEXT(_StringType, sqltypes.TEXT):
 
         :param length: Optional, if provided the server may optimize storage
           by substituting the smallest TEXT type sufficient to store
-          ``length`` characters.
+          ``length`` bytes of characters.
 
         :param charset: Optional, a column-level character set for this string
           value.  Takes precedence to 'ascii' or 'unicode' short-hand.
@@ -535,7 +535,7 @@ class TEXT(_StringType, sqltypes.TEXT):
 
 
 class TINYTEXT(_StringType):
-    """MySQL TINYTEXT type, for text up to 2^8 characters."""
+    """MySQL TINYTEXT type, for character storage encoded up to 2^8 bytes."""
 
     __visit_name__ = "TINYTEXT"
 
@@ -567,7 +567,7 @@ class TINYTEXT(_StringType):
 
 
 class MEDIUMTEXT(_StringType):
-    """MySQL MEDIUMTEXT type, for text up to 2^24 characters."""
+    """MySQL MEDIUMTEXT type, for character storage encoded up to 2^24 bytes."""
 
     __visit_name__ = "MEDIUMTEXT"
 
@@ -599,7 +599,7 @@ class MEDIUMTEXT(_StringType):
 
 
 class LONGTEXT(_StringType):
-    """MySQL LONGTEXT type, for text up to 2^32 characters."""
+    """MySQL LONGTEXT type, for character storage encoded up to 2^32 bytes."""
 
     __visit_name__ = "LONGTEXT"