Skip to main content

Posts

A Christian's view of death

Being concerned with the pro-life movement as I am and following news related to it I have heard some disturbing propositions posed by some critics of the pro-life stance. Actually two disturb me most. The first is that the pro-life mentality does not respect a woman's rights. That is so wrong, but I am not going to deal with that now, maybe later if I feel like it. But just to clarify, while the pro-life movement gets most of it's press with regards to abortion, it's much more than that. We value all life form conception to natural death so that includes among other things standing firm against euthanasia, assisted suicide, and any other way the culture of death would seek to invade our society. However even more disturbing than the "woman's rights" lie is the supposition that Christian's are afraid of or somehow find death distasteful. Nothing could be further than the truth. While we must acknowledge that there are different stages of maturity for a...

I Believe

Ok, I know this has been around for a couple of weeks now and I am a little late. Quite honestly, I wasn’t sure if I wanted to go down this route or not. In the end, I cannot sit idly by while the media portrays a society that is losing faith and non believers in general grow more and more militant. As you may have seen on the news a couple of weeks ago, the 2008 ARIS (American Religious Identification Survey) is out. You can read the findings here Since no one contacted me I just wanted to state……. I believe in one God, the Father, the Almighty, maker of heaven and earth, of all that is seen and unseen. I believe in one Lord, Jesus Christ, the only Son of God, eternally begotten of the Father, God from God, Light from Light, true God from true God, begotten, not made, one in being with the Father. Through Him all things were made. For us men and our salvation He came down from heaven: by the power of the Holy Spirit, He was born of the Virgin Mary , and became man. For our sake He wa...

Data Validation with MySQL Triggers

One of the applications that I get to play with on a regular basis is a PHP, Javascript AJAX environment that acts as a frontend for a MySQL database. I wanted to add range constraints to some of the fields in order to reduce typo's. I created before triggers with the following basic skeleton for each table that I wanted to add the range constraint to. if NEW.columnname > theupperrange then SELECT `**columnname is out of range**` from thetable into @str_val; end if; This will cause the insert to fail with the follow error message Unknown column `**columnname is out of range**` because of the nature of the application (if an error occurs in MySQL the PHP returns the error message) it then becomes the JavaScript's XMLHttprequest.responseText. so on the javascript side of the application i look for the Unknown column like this //req is the name of the XMLHttpRequest object i create to handle interaction between //the javascript and PHP. if(req.responseTest.indexOf("Unknown...

Insert into a foreign key field looks like it should match.....

You bring data into a referenced column through LOAD DATA LOCAL INFILE but when you try to insert data into the referencing column you get the "Cannot add or update a foreign key constraint fails...." error. You have looked at the referenced column and the referencing data again and again and you don't see the problem. If you open up Query Browser and look at the referenced data you may find paragraph marks. This problem confounded me for quite some time. I understood that the paragraph marks were causing the problem but I didn't understand how they were getting there. This is a classic case where "RTFM" applies. MySQL by default understands line termination by the return character "\r". The Windows OS by default writes line termination as a carriage return and a new line "\r\n". The extra \n is causing the problem. How to deal with this is right in the MySQL manual. But I thought I would post it because I do and did "RTFM" and...

Find unmatched referenced column values

When you use LOAD DATA LOCAL INFILE on a table that contains a foreign key constraint you get an error with an explanation that a the table cannot be updated because a foreign key constraint fails..... 1. Turn off foreign key checks with the following command at the MySQL command line client a. set foreign_key_checks = 0; 3. issue your load data command again 4. once the data is loaded issue the following query select referencing_table . referencing_column FROM referencing_table LEFT JOIN referenced_table ON ( referencing_table . referencing_column = referenced_table.referenced_column ) WHERE referenced_table.referenced_column IS NULL; This will give you a list of all the column values in the offending table that do not match a value in the referenced table. 5. Update all of the values listed in the query results from above 6. turn the foreign_key_checks back on with the following a. set foreign_key_checks = 1; Why this works We are doing a LEFT JOIN which means that everything on t...