Showing entries 1 to 3
Displaying posts with tag: Discoveries (reset)
Who is the Subversion King in your Company?

Have you ever wanted to know who’s the top committer in your company?
In my previous company we etablished the term “CVS King”, a title comparable to “Employee of the month”. The developer with the most cvs commits was the “CVS King of the month”. We determined who was the “CSV King” using commit emails that were sent to all developers on each cvs commit.
Two years ago we switched to Subversion, so now we’re talking about the “Subversion King”. Naturally all this is anything but serious ;)

Anyway, today i programmed a little php script that uses a different approach to determine who is the “Subversion King of the Month”. It’s counting the line delta directly from the svn repository using svnlook. So the developer with the most lines added to …

[Read more]
MySQL: Collation matters when using unique indexes

When using a uniqie index on a text field in mysql, the column collation setting is very important. The collation settings of a column does not only affect sorting and comparsion, but also unique indexes. So you can not insert "a" and "A" into a table that has a unique index on a column that has a case-insensitive collation. The mysql manual about collations: "A character set is a set of symbols and encodings. A collation is a set of rules for comparing characters in a character set."

Here is an example:
The column text in table text1 has a case-sensitive collation (_cs suffix), the column in text2 has a case-insensitive collation (_ci suffix).

PLAIN TEXT CODE:

  1.  
  2. CREATE TABLE text1 (
  3.   `text` varchar(50) character set latin1 collate latin1_general_cs NOT NULL …
[Read more]
Dynamic Materialized Views in MySQL

In one of my latest postings I mentioned a way to create semi materialized views in MySQL. The problem was that the solution required a stored procedure for every materialized view. That's very annoying. So I looked for a more general and dynamic approach. The result is another stored procedure with 3 parameters:

  • the name for the source table / view
  • the primary key columns of the source table / view
  • the desired name for the materialized view

Basically this procedure does the following:

  • It drops the materialized view if it already exists
  • It creates the materialized view with the structure and data of the source table
  • It adds a primary key to the newly created materialized view

However the procedure does not create triggers on the table. This could be an improvement for a …

[Read more]
Showing entries 1 to 3