Welcome to Dream.In.Code
Become an Expert!

Join 149,588 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,800 people online right now. Registration is fast and FREE... Join Now!




mysql not storing trailing zero

 
Reply to this topicStart new topic

mysql not storing trailing zero, records inserted from xml dom trailing zero discarded

captainhaha
16 Oct, 2007 - 10:36 PM
Post #1

New D.I.C Head
*

Joined: 5 Jun, 2007
Posts: 5


My Contributions
Hi There,
I have a problem.
I have a database of history reels for an editing department I have successfully (for the most part) transferred this from filemaker pro to xml and then using xmlDOM inserted this into the database.
The issue is that we have to store timecode locations down to the frame i.e HH:MM:SS:ff. I have used a varchar column for this. I know that the php xmldom script pulls the correct time code from the xml record e.g. 01:16:22:10 however when the records are viewed in mysql the trailing zero is lost i.e. 01:16:22:1. this happens for every record where the final character is a zero.
i am running mysql-5.0.37 and mysql-5.0.45 on 2 different mac 0s x servers.

Any pointers to webpages etc, would be apreciated.

Thnkyou
captainhaha
User is offlineProfile CardPM
+Quote Post

Amadeus
RE: Mysql Not Storing Trailing Zero
19 Oct, 2007 - 07:44 AM
Post #2

g++ -o drink whiskey.cpp
Group Icon

Joined: 12 Jul, 2002
Posts: 12,349



Thanked: 51 times
Dream Kudos: 25
My Contributions
What is the field length of your varchar column? Also, if you extract and display the record, is the trailing 0 there?
User is offlineProfile CardPM
+Quote Post

captainhaha
RE: Mysql Not Storing Trailing Zero
20 Oct, 2007 - 03:32 AM
Post #3

New D.I.C Head
*

Joined: 5 Jun, 2007
Posts: 5


My Contributions
QUOTE(Amadeus @ 19 Oct, 2007 - 08:44 AM) *

What is the field length of your varchar column? Also, if you extract and display the record, is the trailing 0 there?


Amadeus, thnx for the response sorry for my delay in replying(my day to look after the baby:)

I should have been more specific; initially i had a varchar(11) field as i know that the value for that field must be 11 characters as it is a timecode for a digital tape.As this didn't work I have increased it to 15 characters.
This is based on no sensible reason i just anted to make sure i had extra capacity in the field till i resolve this.

The trailing zero is not there when you extract the record. So to clarify, the entire recordet is in XML and i can see that it has been parsed out of the old database correctly, all characters like '&' have been dealt with correctly within the xml recordset.
So when the php script runs it echos 2 items to the screen.
1. a 'production no' this is non unique as a production will have different edits,
2. a timecode, this is unique(as obviously no 2 edits can occupy the sme space on a tape).
But then when i
a) use the php-web interface to search any item, and,
b) use mysql and query database on the CLI,
i see that the trailing zero has been removed, it's important to note that the format is HH:MM:SS:ff so if ff=00 then _only_ the trailing zero is removed and if HH=00 then both of them are entered into the database correctly

So really it's a very consistent error and i can just reprogram either the database to add the zero maybe or the web interface to just display an extra zero on the end when it comes across this situation, but i would rather know why this is happening, than just apply some 'ugly hack':/

Anyway any help appreciated although possibly not really a mysql issue at at all although i have no idea how it could be the xml dom script especilly as it is showing me the correct values on screen.
Regards
captainhaha
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 11:05PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month