我有一张桌子t1如下:
create table t1 (
person_id int,
item_name varchar(30),
item_value varchar(100)
);
Run Code Online (Sandbox Code Playgroud)
此表中有五条记录:
person_id | item_name | item_value
1 'NAME' 'john'
1 'GENDER' 'M'
1 'DOB' '1970/02/01'
1 'M_PHONE' '1234567890'
1 'ADDRESS' 'Some Addresses unknown'
Run Code Online (Sandbox Code Playgroud)
现在我想用交叉功能提取NAME,GENDER数据,所以我写了一个SQL为:
select * from crosstab(
'select person_id, item_name, item_value from t1
where person_id=1 and item_name in ('NAME', 'GENDER') ')
as virtual_table (person_id int, NAME varchar, GENDER varchar)
Run Code Online (Sandbox Code Playgroud)
我的问题是,正如您所看到的SQL in crosstab()contains condition item_name,这将导致引号不正确.我该如何解决这个问题?
根据Grails 3.0.11 拦截器文档,我编写自己的拦截器如下:
class AuthInterceptor {
int order = HIGHEST_PRECEDENCE;
AuthInterceptor() {
println("AuthInterceptor.AuthInterceptor(): Enter..............");
// ApiController.index() and HomeController.index() don't need authentication.
// Other controllers need to check authentication
matchAll().excludes {
match(controller:'api', action:'index);
match(controller:'home', action:'index');
}
}
boolean before() {
println "AuthInterceptor.before():Enter----------------->>>>>>";
log.debug("AuthInterceptor.before(): params:${params}");
log.debug("AuthInterceptor.before(): session.id:${session.id}");
log.debug("AuthInterceptor.before(): session.user:${session.user?.englishDisplayName}");
if (!session.user) {
log.debug("AuthInterceptor.before(): display warning msg");
render "Hi, I am gonna check authentication"
return false;
} else {
return true;
}
}
boolean after() {
log.debug("AuthInterceptor.after(): Enter ...........");
true
} …Run Code Online (Sandbox Code Playgroud) 我对 Google 云虚拟机上的 vGPU (Tesla K80) 有疑问。
我的笔记本电脑是 Lenovo T460P,配备以下规格:
我在 Google Cloud 中创建的虚拟机包含以下规格:
我使用 opencv 用 160 张正图像和 800 张负图像来训练 LBP …
我想向现有的类 java.util.Date 添加一个方法“toFormatString(fmt)”。我的代码如下:
Date.metaClass.toFormatString(String fmt) = {
SimpleDateFormat sdf = new SimpleDateFormat(fmt)
return sdf.format(delegate)
}
Run Code Online (Sandbox Code Playgroud)
但是,Intellij 给了我一个错误:要分配给的值无效。
我在 cli-app 配置文件中有一个使用 micronaut 框架开发的应用程序。我的应用程序使用Hibernate和GORM包,所以application.yml中有相关配置
在默认配置中,micronaut 从 src/main/resources 加载 application.yml。
如果我希望我的应用程序从如下参数中加载 application.yml:
java -Dmicronaut.config=/etc/fooApp/application.yml -jar fooApp.jar
Run Code Online (Sandbox Code Playgroud)
我应该怎么做 ?谢谢
arguments ×1
crosstab ×1
dynamic ×1
gpu ×1
grails ×1
groovy ×1
interceptor ×1
methods ×1
micronaut ×1
picocli ×1
pivot ×1
postgresql ×1
quotes ×1
ubuntu-16.04 ×1