我在postgresql中有以下代码:
CREATE OR REPLACE FUNCTION update_category() RETURNS trigger AS $newProduct$
BEGIN
UPDATE category SET product_count = product_count + 1 WHERE cat_id = NEW.cat_id;
INSERT INTO notification (content, type, p_id) VALUES('new product', 1, NEW.p_id);
RETURN NEW;
END;
$newProduct$ LANGUAGE plpgsql;
CREATE TRIGGER update_cat AFTER INSERT ON product
EXECUTE PROCEDURE update_category();
Run Code Online (Sandbox Code Playgroud)
将记录插入产品后,我收到错误:
[2017-03-20 16:05:05] [55000] ERROR: record "new" is not assigned yet
[2017-03-20 16:05:05] Detail: The tuple structure of a not-yet-assigned record is indeterminate.
[2017-03-20 16:05:05] Where: SQL statement "UPDATE category SET …Run Code Online (Sandbox Code Playgroud) 此代码的目的是创建一个Caesar密码,只用3个密钥对字母数字字符进行编码,其中第一个字母由第一个键增加,第二个字符由第二个键增加,第三个字符由第三个键增加,第四个字符由第一个键增加密钥等...用环绕(Z + 1 - > a),(a - 1 - > Z).
我完全完成了作业,唯一的问题是我的负面包裹不起作用(a - 1 - > Z).它要求输入密钥,接受输入,然后不返回任何内容(但仍然允许用户键入并按Enter键而不会产生任何结果).这是我的代码:
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
char sentence[101] = { '\0' };
char alphabet[52]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'};
int locateletter(char tolocate){
int i=0;
for(i=0; i<52; i++){
if(alphabet[i] == tolocate)
return i;
}
}
int main(void){
int key1 = 0;
int key2 = 0;
int key3 = 0;
printf("Sentence: ");
scanf("%101[^\n]", sentence);
if( sentence[100] != '\0' ){
printf("You entered more than 100 characters. Block Caesar Cipher …Run Code Online (Sandbox Code Playgroud)