-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Soldy <[email protected]>
- Loading branch information
Showing
1 changed file
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
|
||
_sup_types = [ | ||
"VARCHAR", | ||
"CHAR", | ||
"TINYINT", | ||
"BOOLEAN", | ||
"INT1", | ||
"SMALLINT", | ||
"INT2", | ||
"MEDIUMINT", | ||
"INT3", | ||
"INT", | ||
"INTEGER", | ||
"INT4", | ||
"BIGINT", | ||
"INT8", | ||
"DECIMAL", | ||
"DEC", | ||
"NUMERIC", | ||
"FIXED", | ||
"FLOAT", | ||
"DOUBLE", | ||
"REAL", | ||
"BIT", | ||
"BINARY", | ||
"VARBINARY", | ||
"BLOB", | ||
"TINYBLOB", | ||
"MEDIUMBLOB", | ||
"LONGBLOB", | ||
"TINYTEXT", | ||
"TEXT", | ||
"MEDIUMTEXT", | ||
"LONGTEXT", | ||
"JSON", | ||
"CHAR", | ||
"VARCHAR", | ||
"ENUM", | ||
"INET4", | ||
"INET6" | ||
] | ||
|
||
_sup_engines = [ | ||
'Aria', | ||
'Federated', | ||
'InnoDB', | ||
'MyISAM', | ||
'MyRocks', | ||
'Mroonga' | ||
] | ||
|
||
|
||
|
||
class FielsHelper: | ||
|
||
class FieldHelper: | ||
def __init__(self, name:str, types:dict): | ||
self._name = name | ||
self._types = types | ||
self._unsigned = False | ||
self._notnull = False | ||
if types['unsigned']: | ||
self._unsigned = True | ||
if types['notnull']: | ||
self._notnull = True | ||
def create(self): | ||
out = " `"+self._name+"`" | ||
if self._types['type'] in _sup_types: | ||
out = (out+" "+self._types['type']) | ||
if self._unsigned: | ||
out = (out+" UNSIGNED") | ||
if self._notnull: | ||
out = (out+" NOT NULL") | ||
return out | ||
def functionInput(self): | ||
|
||
def functionCheck(self) | ||
|
||
class TableCreator: | ||
def tableStart(self, name:str)->str: | ||
out = ("TABLE CREATE `"+name+"` (\n") | ||
return out | ||
def tableIndexStart(self)->str: | ||
def tableIndexEnd(self)->str: | ||
|
||
def fieldSeparate(self)->str: | ||
return ",\n" | ||
|
||
def tableEnd(self name:str)->str: | ||
out = ") ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;;" | ||
return out | ||
|
||
|
||
class TableManager: | ||
def __init __(self): | ||
self._table = { | ||
"name":"notset", | ||
"fields":[], | ||
"engine":"InnoDB", | ||
"charset":"utf8", | ||
"collate":"utf8_general_ci", | ||
"id":True, | ||
|
||
} | ||
def fromJson | ||
|
||
|