How CHAR and VARCHAR differ in the way they are stored and retrieved

December 22nd, 2017 | #sql

TIL CHAR and VARCHAR types are similar, but differ in the way they are stored and retrieved.

Read more

Null coalescing operator in C Sharp, PHP, Bash and SQL

November 27th, 2017 | #csharp #php #bash #sql

TIL about the null coalescing operator in C#, PHP, Bash and SQL. In general, the null coalescing operator returns the result of its first operand—if it exists and is not null.

string siteName = suppliedName ?? "Default Name";

/* is logically equivalent to*/

string siteName = suppliedName != null ? suppliedName : "Default Name";
Read more

Keep track of datetime an entity was last modified with Ebean in Play

October 31st, 2017 | #ebean #playframework #java #sql

TIL that Ebean helps you to keep track of the datetime an entity was last modified. I wanted to implement a column last_modified_at, when a colleague showed me this commit. You simply can add a timestamp property to a model with the annotation @WhenModified. Ebean will set the timestamp to the datetime when the entitiy was last modified.

Read more

© 2018 Tonny Garić | With from Nijmegen, The Netherlands