⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tst830.mal

📁 一个内存数据库的源代码这是服务器端还有客户端
💻 MAL
字号:
# a simple functional test for the access control table	scens := bat.new(:str, :oid);	bat.insert(scens, "sql", nil:oid);	bat.insert(scens, "mal", nil:oid);	# this should fail, the monetdb user is already there	id := clients.addUser("monetdb", "Pmonetdb", scens);catch MALException:str;	io.printf("%s\n",MALException);exit MALException;	# should print 0@1 or something	id := clients.addUser("test", "test", scens);	io.print(id);	# this should work also	# don't use nil:bat[:str, :oid] here, it results in a crash	t := bat.new(:str, :oid);	id := clients.addUser("checkpoint", "Pcheckpoint", t);	io.print(id);	# do a simple listing of users known	u := clients.getUsers(t);	io.print(u);	bat.insert(t, "mal", nil:oid);	bat.insert(t, "sql", nil:oid);	u := clients.getUsers(t);	io.print(u);	# should work, we're the admin here	clients.removeUser("checkpoint");	# do a simple listing of users known	u := clients.getUsers(t);	io.print(u);	# just remove the scenarios one by one, should work	clients.removeScenario("test", "mal");	clients.removeScenario("test", "sql");	# this one should fail: it's not there	clients.removeScenario("test", "mil");catch MALException:str;	io.printf("%s\n",MALException);	MALException:= nil:str;exit MALException;	# and add a scenario again	clients.addScenario("test", "mal");	# do it again, see what happens (should fail)	clients.addScenario("test", "mal");catch MALException:str;	io.printf("%s\n",MALException);	MALException:= nil:str;exit MALException;	# forcefully set the password of the user test	clients.setPassword("test", "newpass");	# now try to set the password for ourself, should fail	clients.setPassword("monetdb", "badpass");catch InvalidCredentialsException:str;	io.printf("%s\n", InvalidCredentialsException);exit InvalidCredentialsException;	# change our own password	clients.changePassword("monetdb", "newdb");	# try it again, should fail...	clients.changePassword("monetdb", "newdb");catch InvalidCredentialsException:str;	io.printf("%s\n",InvalidCredentialsException);	InvalidCredentialsException:= nil:str;exit InvalidCredentialsException;	# all should fail	clients.checkPermission("monetdb","Pmonetdb","sql");catch InvalidCredentialsException:str;	io.printf("%s\n",InvalidCredentialsException);	InvalidCredentialsException:= nil:str;exit InvalidCredentialsException;	clients.checkPermission("monetdb","x","sql");catch InvalidCredentialsException:str;	io.printf("%s\n",InvalidCredentialsException);	InvalidCredentialsException:= nil:str;exit InvalidCredentialsException;	clients.checkPermission("monetdb","Pmonetdb","x");catch InvalidCredentialsException:str;	io.printf("%s\n",InvalidCredentialsException);	InvalidCredentialsException:= nil:str;exit InvalidCredentialsException;	clients.checkPermission("x","Pmonetdb","sql");catch InvalidCredentialsException:str;	io.printf("%s\n",InvalidCredentialsException);	InvalidCredentialsException:= nil:str;exit InvalidCredentialsException;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -