/* DB함수 실행 후, 리턴 값 할당 */
Long prd_no = context.select(fnGetSchPoint(keyword)).fetchOne(0, Long.class);
www.jooq.org/doc/3.14/manual/sql-execution/stored-procedures/
/* DB함수 실행 후, 리턴 값 할당 */
Long prd_no = context.select(fnGetSchPoint(keyword)).fetchOne(0, Long.class);
www.jooq.org/doc/3.14/manual/sql-execution/stored-procedures/
THEN 뒤에 실행한 조건문이 두 개 이상일 경우 THEN DO문장을 사용합니다.
(www.mysas.co.kr/SAS_tiptech/a_question.asp?B_NO=2041&gotopage=4&cmd=content)
<canvas width="600" height="300"></canvas>
<script>
let cx = document.querySelector("canvas").getContext("2d");
function branch(length, angle, scale) {
cx.fillRect(0, 0, 1, length);
if (length < 8) return;
cx.save();
cx.translate(0, length);
cx.rotate(-angle);
branch(length * scale, angle, scale);
cx.rotate(2 * angle);
branch(length * scale, angle, scale);
cx.restore();
}
cx.translate(300, 0);
branch(60, 0.5, 0.8);
</script>
(https://eloquentjavascript.net)
function* idMaker(){
var index = 0;
while(true)
yield index++;
}
var gen = idMaker(); // "Generator { }"
console.log(gen.next().value); // 0
console.log(gen.next().value); // 1
console.log(gen.next().value); // 2
(https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Generator)
let myFirstPromise = new Promise((resolve, reject) => {
// We call resolve(...) when what we were doing asynchronously was successful, and reject(...) when it failed.
// In this example, we use setTimeout(...) to simulate async code.
// In reality, you will probably be using something like XHR or an HTML5 API.
setTimeout(function(){
resolve("Success!"); // Yay! Everything went well!
}, 250);
});
myFirstPromise.then((successMessage) => {
// successMessage is whatever we passed in the resolve(...) function above.
// It doesn't have to be a string, but if it is only a succeed message, it probably will be.
console.log("Yay! " + successMessage);
});
(https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Promise)
function parseINI(string) {
// Start with an object to hold the top-level fields
let result = {};
let section = result;
string.split(/\r?\n/).forEach(line => {
let match;
if (match = line.match(/^(\w+)=(.*)$/)) {
section[match[1]] = match[2];
} else if (match = line.match(/^\[(.*)\]$/)) {
section = result[match[1]] = {};
} else if (!/^\s*(;.*)?$/.test(line)) {
throw new Error("Line '" + line + "' is not valid.");
}
});
return result;
}
console.log(parseINI(`
name=Vasilis
[address]
city=Tessaloniki`));
(https://eloquentjavascript.net/code/#9)
//Abstracting array traversal
function forEach ( array , action ) {
for ( var i = 0; i < array . length ; i ++)
action ( array [ i ]) ;
}
forEach ([" Wampeter " , " Foma " , " Granfalloon "] , console . log ) ;
see, function repeat
function multiplier(factor) {
return number => number * factor;
}
let twice = multiplier(2);
console.log(twice(5));
// → 10