1
0
Fork 0
mirror of https://github.com/yweber/lodel2.git synced 2026-03-14 15:22:02 +01:00

[doxygen] Réécriture de la doc sur des méthodes de sqlsetup.py

This commit is contained in:
Roland Haroutiounian 2015-07-10 09:06:51 +02:00
commit 700c63d925

View file

@ -169,8 +169,12 @@ def create_column(**kwargs):
return col
## Converts a string to an sqlAlchemy column type
#
# @param strtype str: string describing the type of the column
# @return SqlAlchemy column type
# @raise NameError
def string_to_sqla_type(strtype):
""" Convert a string to an sqlAlchemy column type """
if 'VARCHAR' in strtype:
return string_to_varchar(strtype)
else:
@ -180,8 +184,11 @@ def string_to_sqla_type(strtype):
raise NameError("Unknown type '" + strtype + "'")
## Converts a string like 'VARCHAR(XX)' (with XX an integer) to a SqlAlchemy varchar type
#
# @param vstr str: String to convert
# @return SqlAlchemy.VARCHAR
def string_to_varchar(vstr):
""" Convert a string like 'VARCHAR(XX)' (with XX an integer) to a SqlAlchemy varchar type"""
check_length = re.search(re.compile('VARCHAR\(([\d]+)\)', re.IGNORECASE), vstr)
column_length = int(check_length.groups()[0]) if check_length else None
return sql.VARCHAR(length=column_length)