Skip to content

Instantly share code, notes, and snippets.

View lukaseder's full-sized avatar

Lukas Eder lukaseder

View GitHub Profile
import java.io.ByteArrayOutputStream;
import java.io.PrintStream;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import sun.misc.Unsafe;
/*
* Copyright (c) 2009-2015, Data Geekery GmbH (http://www.datageekery.com)
* All rights reserved.
*
* This work is dual-licensed
* - under the Apache Software License 2.0 (the "ASL")
* - under the jOOQ License and Maintenance Agreement (the "jOOQ License")
* =============================================================================
* You may choose which license applies to you:
*
import static java.lang.System.exit;
import static java.lang.System.out;
public class Dafuq {
/**
* This does not do what you think it does.
* <p>
* You think code is documentation? No! Documentation is code!
\u002a\u002f
import static java.lang.System.*;
public class Dafuq {
public static void main(String[] args) {
/*
\u002a\u002f
\u006f\u0075\u0074\u002e\u0070\u0072\u0069\u006e\u0074\u006c\u006e\u0028\u0022\u004e\u006f\u0022\u0029\u003b
\u000d\u000a\u0065\u0078\u0069\u0074\u0028\u0030\u0029\u003b
\u002f\u002a
@lukaseder
lukaseder / count-asterisk-vs-count-1-oracle.sql
Created September 19, 2019 08:41
COUNT(*) vs COUNT(1) in Oracle
-- Copyright Data Geekery GmbH
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
@lukaseder
lukaseder / count-asterisk-vs-count-1-mysql.sql
Created September 19, 2019 08:41
COUNT(*) vs COUNT(1) in MySQL
-- Copyright Data Geekery GmbH
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
@lukaseder
lukaseder / count-asterisk-vs-count-1-postgres.sql
Created September 19, 2019 08:41
COUNT(*) vs COUNT(1) in PostgreSQL
-- Copyright Data Geekery GmbH
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
@lukaseder
lukaseder / count-asterisk-vs-count-1-sqlserver.sql
Created September 19, 2019 08:40
COUNT(*) vs COUNT(1) in SQL Server
-- Copyright Data Geekery GmbH
--
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--
-- http://www.apache.org/licenses/LICENSE-2.0
--
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
@lukaseder
lukaseder / QOM.scala
Last active September 18, 2019 14:57
A simple proof of concept for a new Query Object Model in Scala, using sealed traits and case classes
sealed trait Q {}
trait QField[T] extends Q {}
trait QTable extends Q {}
trait QSchema extends Q {}
trait QCondition extends Q {}
trait QName extends Q {}
trait QQuery extends Q {}
final case class CVal[T](value: T) extends QField[T]
final case class CIdent(name: String) extends QName
@lukaseder
lukaseder / QOM.java
Created September 18, 2019 14:22
A simple proof of concept for a new Query Object Model in Java, using Immutables annotations
/*
* This work is dual-licensed
* - under the Apache Software License 2.0 (the "ASL")
* - under the jOOQ License and Maintenance Agreement (the "jOOQ License")
* =============================================================================
* You may choose which license applies to you:
*
* - If you're using this work with Open Source databases, you may choose
* either ASL or jOOQ License.
* - If you're using this work with at least one commercial database, you must