mysql -NB -u root my_database -e 'show create procedure `myProcedure`' |\
xargs -n 1 -d '\t' echo |\
egrep '^CREATE' |\
xargs --null echo -e >
'분류 전체보기'에 해당되는 글 666건
- 2021.04.06 mysql, dump procedure
- 2021.04.02 windows, 기본 연결 프로그램 변경
- 2021.04.02 javascript, || {} namespace
- 2021.04.02 mysql 테이블 명세
- 2021.03.29 find grep 파일이름에 공백 있을 때
- 2021.03.24 JPA, No enum constant , mysql
- 2021.03.24 windows path 설정
- 2021.03.23 mysql TABLE_NAME, TABLE_COMMENT
- 2021.03.19 cygwin alternative
- 2021.03.18 java8 stream simple sample
select -- *
COLUMN_NAME, COLUMN_COMMENT, DATA_TYPE, CHARACTER_MAXIMUM_LENGTH, COLUMN_KEY,
CASE
WHEN IS_NULLABLE = 'YES'
THEN 'N'
ELSE 'Y'
END as NOTNULL
, COLUMN_DEFAULT
from information_schema.columns
where table_schema = 'mytableschema'
and table_name = 'MY_TABLE'
order by ordinal_position
;
find /c/pjt -type f -print0| xargs -0 grep -i 02356
* Error Message :
org.springframework.dao.InvalidDataAccessApiUsageException: No enum constant
* 원인:JPA 쪽에서 enum 으로 선언된 mysql table 컬럼에 ''(빈문자열) 이 들어있다
* 조치
UPDATE MYTABLE SET ENUM_COLUMN = NULL WHERE ENUM_COLUMN = ''
SELECT TABLE_NAME, TABLE_COMMENT
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_SCHEMA='myschema'
ORDER BY 1
git bash (included in git gui)
( .bashrc 설정은 https://emflant.tistory.com/122 )
package com.test.sample;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
public class StreamTest {
final static int FETCH_MAX_SIZE = 2;
public static void main (String[] args) {
List<Map<String, Object>> prdList = new ArrayList<Map<String, Object>>();
List<Map<String, Object>> prdList2 = new ArrayList<Map<String, Object>>();
for (int i=0; i < 10; i++) {
Map<String, Object> product = new HashMap<>();
product.put("prdNo", i + 1000);
product.put("ordQty", i + 30);
if (i%2 == 0) {
product.put("useYn", "N");
}
else {
product.put("useYn", "Y");
}
prdList.add(product);
}
System.out.printf("\n\n");
System.out.printf("prdList:" + prdList);
prdList2 =
prdList.stream().filter(distinctByPrdNo(m -> m.get("prdNo")))
.filter(t->t.get("useYn").equals("Y"))
.limit(FETCH_MAX_SIZE).collect(Collectors.toList());
System.out.printf("\n\n");
System.out.printf("prdList:" + prdList);
System.out.printf("\n\n");
System.out.printf("prdList2:" + prdList2);
}
private static <T> Predicate<T> distinctByPrdNo(Function<? super T, ?> keyExtractor) {
Set<Object> seen = ConcurrentHashMap.newKeySet();
return t -> seen.add(keyExtractor.apply(t));
}
}