Mats codemix

Mats codemix

A little c#, a litte .NET and throw in some c++ and you get a nice Spaghetti

Mats codemix RSS Feed
 
 
 
 

Archive for Programming

Disadvantage with having code in Database

I suddenly realized one big disadvantage about having code in the database (stored procedures etc) - Restoring
Restoring a database disrupts the versioning. Code and data are not versioned together. Database structure and code are usually tied together.
Say i have a procedure i want to modify.

I edit the SP,
update it in the database
run it.

I find an [...]

Some good links on SCM - software configuration management

Henrik Kniberg has written some very interesting things on agile version control. He has some links to other interesting sources as well. Go there, read it!
From Perforce I found this writing about High level best practices in SCM.
Is SCM the acronym for:

Software Configuration Management
Source Code Management

Both searches on Google seems to to point in the [...]

Regex for SQL

Found a regex for getting SQL-code here.
“(/\*[^\*/]*\*/)|(\r\n\s*)|\t|\s{2,}”

Making groups unique - fixing a duplicate key problem in SQL

I ran into a problem where updating a key column caused duplicate key errors.  The table in question had several columns that formed the Primary Key.  One of those columns was userd for a  serial number making groups of keys unique.
Example

Group

GroupSerial

Apple

1

Apple

1

Pear

1

Pear

1

Here we see that each row is not unique.
So how can we fix this?
First [...]

Generate SQL-code with line breaks from metadata

I’m  updating a system with lots of tables and i wanted to perform the same operation on more than 20 of the tables.  Writing all those update statements by hand is errorprone and using copy-paste is equally worse.
I wanted to write good code with linebreaks, logmessages  and comments. What to do?
Code-generation to the rescue!

1 [...]