PasswordType: use RAW impl for Oracle instead of non-existent VARBINARY
If I'm not mistaken, the Oracle SQL DB (at least 11g R2) doesn't have a VARBINARY type. This fix uses a RAW (binary) type instead for the Oracle dialect.
This commit is contained in:
@@ -2,7 +2,7 @@ import six
|
||||
import weakref
|
||||
from sqlalchemy_utils import ImproperlyConfigured
|
||||
from sqlalchemy import types
|
||||
from sqlalchemy.dialects import postgresql
|
||||
from sqlalchemy.dialects import postgresql, oracle
|
||||
from .scalar_coercible import ScalarCoercible
|
||||
from sqlalchemy.ext.mutable import Mutable
|
||||
|
||||
@@ -115,8 +115,6 @@ class PasswordType(types.TypeDecorator, ScalarCoercible):
|
||||
|
||||
"""
|
||||
|
||||
impl = types.VARBINARY(1024)
|
||||
|
||||
python_type = Password
|
||||
|
||||
def __init__(self, max_length=None, **kwargs):
|
||||
@@ -159,6 +157,10 @@ class PasswordType(types.TypeDecorator, ScalarCoercible):
|
||||
# Use a BYTEA type for postgresql.
|
||||
impl = postgresql.BYTEA(self.length)
|
||||
return dialect.type_descriptor(impl)
|
||||
if dialect.name == 'oracle':
|
||||
# Use a RAW type for oracle.
|
||||
impl = oracle.RAW(self.length)
|
||||
return dialect.type_descriptor(impl)
|
||||
|
||||
# Use a VARBINARY for all other dialects.
|
||||
impl = types.VARBINARY(self.length)
|
||||
|
Reference in New Issue
Block a user