MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / ToDataBase

Method ToDataBase

class/databaseModel/sqlserverModel.py:309–324  ·  view source on GitHub ↗
(self, find)

Source from the content-addressed store, hash-verified

307
308 # 添加到服务器
309 def ToDataBase(self, find):
310 if find['username'] == 'bt_default': return 0
311 if len(find['password']) < 3:
312 find['username'] = find['name']
313 find['password'] = public.md5(str(time.time()) + find['name'])[0:10]
314 public.M('databases').where("id=? AND LOWER(type)=LOWER('SQLServer')", (find['id'],)).save('password,username', (find['password'], find['username']))
315
316 self.sid = find['sid']
317 mssql_obj = self.get_mssql_obj_by_sid(self.sid)
318 result = mssql_obj.execute("CREATE DATABASE %s" % find['name'])
319 isError = self.IsSqlError(result)
320 if isError != None and not 'already exists' in result: return -1
321
322 self.__CreateUsers(find['name'], find['username'], find['password'], '127.0.0.1')
323
324 return 1
325
326 # 从服务器获取数据库
327 def SyncGetDatabases(self, get):

Callers 1

SyncToDatabasesMethod · 0.95

Calls 9

get_mssql_obj_by_sidMethod · 0.95
__CreateUsersMethod · 0.95
timeMethod · 0.80
md5Method · 0.45
saveMethod · 0.45
whereMethod · 0.45
MMethod · 0.45
executeMethod · 0.45
IsSqlErrorMethod · 0.45

Tested by

no test coverage detected