MySQL等同于MATCH上的MERGE

时间:2018-06-19 19:04:19

标签: mysql

我有以下MS SQL查询:

const currentDate = new Date();
const currentTime = currentDate.getTime();
return `${environment.VIMEO_SRC}${videoInput.video}${environment.VIMEO_SPEC_TRAIL}?${currentTime}`;

如何在mySQL中执行类似的查询?

注意:SKU和SKU_num不是表中的键(这是唯一的)。

1 个答案:

答案 0 :(得分:1)

在mysql中,您需要加入此操作

import java.util.LinkedList;
import java.util.List;

interface BlockingQueueCustom<E> {

      void put(E item)  throws InterruptedException ;

      E take()  throws InterruptedException;
}

class LinkedBlockingQueueCustom<E> implements BlockingQueueCustom<E> {

    private List<E> queue;
    private int maxSize; // maximum number of elements queue can hold at a time.

    public LinkedBlockingQueueCustom(int maxSize) {
        this.maxSize = maxSize;
        queue = new LinkedList<E>();
    }

    public synchronized void put(E item) throws InterruptedException {

         while(queue.size() == maxSize) {
            this.wait();
        }

        queue.add(item);
        this.notifyAll();
    }

    public synchronized E take() throws InterruptedException {

        while(queue.size() == 0) {
            this.wait();
        }

        this.notifyAll();
        return queue.remove(0);

    }

}

public class BlockingQueueCustomTest {
    public static void main(String[] args) throws InterruptedException {
        BlockingQueueCustom<Integer> b = new LinkedBlockingQueueCustom<Integer>(10);
        System.out.println("put(11)");
        b.put(11);
        System.out.println("put(12)");
        b.put(12);
        System.out.println("take() > " + b.take());
        System.out.println("take() > " + b.take());

    }
}