我是新手来触发.我试图通过以下链接创建一个触发器 - http://www.postgresqltutorial.com/creating-first-trigger-postgresql/.但它给出了一些错误.代码块和错误如下:
代码块>>
CREATE OR REPLACE FUNCTION log_last_name_changes()
RETURNS trigger AS
$BODY$
BEGIN
IF NEW.last_name <> OLD.last_name THEN
INSERT INTO employee_audits(employee_id,last_name,changed_on)
VALUES(OLD.id,OLD.last_name,now());
END IF;
RETURN NEW;
END;
$BODY$
Run Code Online (Sandbox Code Playgroud)
而错误>>
ERROR: no language specified
SQL state: 42P13
Run Code Online (Sandbox Code Playgroud)
有人可以帮我吗?
我是grails的新手.我必须与会议合作.我见过会话文档.但不知道将代码放在我的控制器中的哪个位置.我有一个学生创建名称createStudent的页面.现在我希望只有在用户进入会话时才能访问此页面.现在我该怎么办呢.我是否必须在登录时将用户设置为变量.有人可以帮我这个吗?
def index() {
def user = session["user"]
if (user){
redirect(controller: 'admistratorAction', action: 'createUser')
}else{
redirect(controller: 'login', action: 'index')
}
}
Run Code Online (Sandbox Code Playgroud) 我需要按升序对数组进行排序,仅用于正值.对于负值,指数位置将保持不变.
如果数组是:int[] inputArray = {-1, 150, 190, 170, -1, -1, 160, 180}.
输出应该是这样的 - int[] outputArray = {-1, 150, 160, 170, -1, -1, 180, 190}.
但就我而言,输出就是这个 - int[] outputArray = {-1, 150, 170, 190, -1, -1, 160, 180}.
这是我的代码如下:
public static void main(String[] args) {
int[] inputArray = {-1, 150, 190, 170, -1, -1, 160, 180};
int[] outputArray = sortByHeight(inputArray);
for (int item : outputArray) {
System.out.print(item + ", ");
}
}
public static int[] sortByHeight(int[] …Run Code Online (Sandbox Code Playgroud) 我想在我的字符串中使用制表符空间.我提供使用新行的代码.但我不知道如何在字符串中使用制表空间.谁可以帮我这个事 !?
"Warning ! Sorry Cash Pay is less than this <br/> month\'s installment. Please pay the <br/> right amount."
Run Code Online (Sandbox Code Playgroud) 我是ajax的新手.我正在尝试从我的gsp页面向控制器操作发送请求.但我失败了.它没有调用控制器操作,页面正在重新加载.任何人都可以看看这个和帮助.这是我的观点页面>>>
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
<title>Ajax First Example</title>
<g:javascript plugin="jquery" library="jquery" src="jquery/jquery-1.7.2.js"/>
<script>
function callAjax(){
$.ajax({
url: "returnMe",
type:"post",
dataType: 'json',
// data:{ids:JSON.stringify(idList), option:option, id:id}
success: function() {
alert(1)
}
});
}
</script>
</head>
<body>
<form name='myForm'>
<input type="submit" value="Call Ajax Function" onclick="callAjax()">
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
这是我的控制器动作>>>
def returnMe = {
String msg = 'sdfsdf'
render msg as JSON
}
Run Code Online (Sandbox Code Playgroud) 我正在努力学习休眠.现在我正在研究标准查询.在这里,我遇到了Restrictions.isEmpty()的问题.有人可以帮我这个吗?以下是我的尝试::
在我的方法>>>
Criteria cr = session.createCriteria(EmployeeCriteria.class);
cr.add(Restrictions.isEmpty("salary"));
List results = cr.list();
for (Iterator iterator = results.iterator(); iterator.hasNext();) {
EmployeeCriteria employee = (EmployeeCriteria) iterator.next();
System.out.println("##### - Employee #" + employee.getId() + " - #####");
System.out.println("===============================");
System.out.print("Employee ID: " + employee.getId());
System.out.print(" || First Name: " + employee.getFirstName());
System.out.print(" || Last Name: " + employee.getLastName());
System.out.println(" || Salary: " + employee.getSalary());
}
Run Code Online (Sandbox Code Playgroud)
并且它给出了这个错误>>>
org.hibernate.MappingException: Property path [criteria.EmployeeCriteria.salary] does not reference a collection
at org.hibernate.criterion.AbstractEmptinessExpression.getQueryableCollection(AbstractEmptinessExpression.java:84)
at org.hibernate.criterion.AbstractEmptinessExpression.toSqlString(AbstractEmptinessExpression.java:63)
at org.hibernate.loader.criteria.CriteriaQueryTranslator.getWhereCondition(CriteriaQueryTranslator.java:380)
at org.hibernate.loader.criteria.CriteriaJoinWalker.<init>(CriteriaJoinWalker.java:113)
at org.hibernate.loader.criteria.CriteriaJoinWalker.<init>(CriteriaJoinWalker.java:82) …Run Code Online (Sandbox Code Playgroud) 我正在使用extjs 4,我有一个显示字段名称Approval的网格.这里我显示了复选框,如果值为true,将在加载网格时检查该复选框.但如果dataIndex值为fault,则仅显示复选框.现在我希望如果我单击未选中的复选框,它将使用侦听器执行操作.但我无法做到这一点.有人可以帮我这个吗?我的代码如下:
{
text: 'Approval',
dataIndex: 'approve',
flex: 1,
align: 'left',
renderer: function(value, metaData, record, row, col, store, gridView){
if(value == true)
{
return '<input type="checkbox" checked="true" />';
}else{
return '<input type = "checkbox" />';
listeners: {
this.approve();
}
}
}
}
approve: function(){
alert('hi');
}
Run Code Online (Sandbox Code Playgroud) 我想针对网格值的参数制作pdf报告.我希望手风琴标题的年份为参数编号1,月份名称为参数编号2.但是我无法做到.任何人都可以帮我这个.这是我的代码如下:
Ext.define('Ext4Example.view.attendence.Timeperiod' ,{
extend: 'Ext.form.Panel',
alias : 'widget.timeperiod',
id: 'timeperiod',
region: 'west',
border: true,
width: 150,
height:395,
split: true,
defaults: {
// applied to each contained panel
//bodyStyle: 'padding:15px'
},
layout: {
// layout-specific configs go here
type: 'accordion',
titleCollapse: true,
animate: true,
activeOnTop: true,
hideCollapseTool : true
},
initComponent: function() {
var me = this;
me.items = me.maccord();
me.callParent(arguments);
},
mstore: function(year){
var data = [
[1, year, 'January' ],
[2, year, 'February' ],
[3, year, 'March' ],
[4, …Run Code Online (Sandbox Code Playgroud) 我正在使用jasper报告来设计报告.我有一个报告,其中有一个静态文本.我想通过参数值设置它的背景颜色.在xml中它为这样的文本生成 -
<reportElement mode="Opaque" x="434" y="0" width="121" height="12" backcolor="#A6A6A6" uuid="e088bd9f-a0ac-4f34-9375-df765c829ec2"/>.
现在我需要从一个来自数据库的参数设置背景颜色.在这里喜欢#A6A6A6.
有人可以帮我这个吗?我用google搜索但没有运气.
我正在使用java 8.我试图用DateTimeFormatter解析日期到字符串.但它给出了以下错误.我的尝试和错误如下.谁能帮帮我吗?
我的代码>>
String getFormatedDateForList(String dateObj) {
// dateObj = "2019-02-06 00:00:00.0"
DateTimeFormatter inputFormat = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
DateTimeFormatter outputFormat = DateTimeFormatter.ofPattern("dd/MM/yyyy");
String output = LocalDate.parse(dateObj, inputFormat).format(outputFormat)
return output
}
Run Code Online (Sandbox Code Playgroud)
错误>>
Text '2019-02-06 00:00:00.0' could not be parsed, unparsed text found at index 19. Stacktrace follows:
Message: Text '2019-02-06 00:00:00.0' could not be parsed, unparsed text found at index 19
extjs ×3
java ×3
extjs4.1 ×2
grails ×2
javascript ×2
ajax ×1
arrays ×1
extjs-grid ×1
extjs4 ×1
grails-2.0 ×1
hibernate ×1
html ×1
java-8 ×1
jquery ×1
postgresql ×1
session ×1
sorting ×1
sql ×1