我将有5个图像和5个按钮,目前只有单个按钮.单击按钮时,我只想显示与按钮关联的图像.为此,我想编写单个函数,将图像路径作为参数.我是JavaScript的新手,Bellow是我发现并编辑的代码:
<script>
function pictureChange(path) {
console.log(path);
document.getElementById("theImage").src=path;
}
</script>
<body>
<img id="theImage" src="http://31.media.tumblr.com/18b5f8f0a00ad01e50f7ae2f513be52d/tumblr_msqcl4iwM01soh1p8o1_500.png">
<p><input type="button" id="theButton" value="click me!" onclick="pictureChange("http://31.media.tumblr.com/fca646cd8fe87906e605ad7e8d039903/tumblr_mmoz4fWT6U1soh1p8o1_500.png")"></p>
</body>
Run Code Online (Sandbox Code Playgroud) 我相信 jOOQ 中的更新不支持连接,所以我一直在探索如何解决它......
我的第一次尝试是使用 where in,但问题是 MySQL 不支持 FROM 子句中的目标表:
create
.update(USER)
.set(USER.name, concat(USER.NAME, "some text"))
.where(USER.ID.in(
create
.select(USER.ID)
.from(USER)
.join(TEAM)
.on(USER.TEAM_ID.eq(TEAM.ID))
.where(TEAM.STATE.equal("test"))
))
.execute();
Run Code Online (Sandbox Code Playgroud)
我的第二个尝试是用于用户临时表(灵感来自这个答案)。问题是,我不知道如何在选择中引用临时表。到目前为止,这是我使用本机 SQL 的尝试:
create
.update(USER)
.set(USER.name, concat(USER.NAME, "some text"))
.where(USER.ID.in(
create
.select("user_nested.id") // This line doesn't work
.from("SELECT * FROM user AS user_nested")
.join(TEAM)
.on("user_nested.team_id = team.id")
.where(TEAM.STATE.equal("test"))
))
.execute();
Run Code Online (Sandbox Code Playgroud)
我最终想要得到的查询类似于:
UPDATE user
SET user.name = concat(user.email, 'some text')
WHERE user.id IN (
SELECT user_nested.id
FROM (SELECT * FROM user) AS user_nested
JOIN …Run Code Online (Sandbox Code Playgroud) 我正在使用Windows Universal应用程序(Windows 8.1和Windows Phone 8.1之间的共享后端,而不是Silverlight).该应用程序通过Azure移动服务连接到Azure.在应用程序的设置中,我希望只有通过WiFi网络才能进行同步选项.
如何确定手机是连接到WiFi还是移动网络?虽然从我的研究中我已经找到了使用旧版Windows Phone和Silverlight的方法,但似乎我只能确定该设备是否在Windows Universal应用程序中连接到互联网.
c# connectivity azure-mobile-services windows-phone-8.1 win-universal-app
也许我在滥用jOOQ,因为我正努力在其他地方为这个用例找到解决方案.
我想将自己的方法应用于jOOQ查询中的某些行,类似于:
create
.update(USER)
.set(USER.EMAIL, hash(EMAIL))
.where(USER.ID.in(userIdsToUpdate))
.execute();
Run Code Online (Sandbox Code Playgroud)
哪里hash(EMAIL)会返回电子邮件的哈希版本.
显然这种语法无效,但希望它传达了我的意图.
用jOOQ支持这样的东西吗?