creating your db.xml file - guide and cheat sheet

Permalink 1 user found helpful
Just posted a cheat sheet and guide on creating your db.xml file using AXMLS (AdoDB XML Schema). This should be very helpful for creating complex blocks that need special table requirements.

http://www.concrete5.org/documentation/how-tos/developers/creating-...

LucasAnderson
 
psp21prashant replied on at Permalink Reply
psp21prashant
I like your website lucasanderson.com
but this link not works!
LucasAnderson replied on at Permalink Best Answer Reply
LucasAnderson
That's odd, it seems to work for me when I click it.

Try this link:

http://bit.ly/a94FKD
zoinks replied on at Permalink Reply
Is this just down temporarily or this gone for good? Thanks!
LucasAnderson replied on at Permalink Reply
LucasAnderson
It was made into a How-To and posted on this site! I've updated the link in the top post. Thanks for the heads up.
zoinks replied on at Permalink Reply
thank you!!
zoinks replied on at Permalink Reply
Is this just down temporarily or this gone for good? Thanks!
zoinks replied on at Permalink Reply
Is this just down temporarily or this gone for good? Thanks!
cherrycake replied on at Permalink Reply
cherrycake
great add! i've spent some time in the past trying to find info on adodb xml schema and it looks pretty pale out there.

you (or anyone else) don't happen to know if references are supported and applied accordingly in the adodb used in c5? and if so, how you would actually define them?
ThomasJ replied on at Permalink Reply
ThomasJ
Not very helpful and not very complete.
How do you create an entry for a Decimal as 6 digits and 2 decimal places in the XML schema?
I've been Googling now for hours looking for a good reference that shows all the portable data type codes and examples on how to use each and every one of them in a db.xml file. I find that even ADOdb's website is lacking in explanation especially when it comes to axmls
JohntheFish replied on at Permalink Reply
JohntheFish
You are right that the ADODB documentation is not easy to use.

w.r.t your problem, as an example, you can do
field name="my_number" type="N" size="10.6"

The number spec is similar to numbers in format strings. The above is 10 digits with 6 after the decimal point.

I can't remember or find where I originally dug that out from :(

You still need validation in PHP before attempting to save to such a field or you will get mySQL errors when users provide data that does not fit. In general, I find the most reliable strategy is to be more relaxed about the database and very strict in the PHP that prepares data for saving.
ThomasJ replied on at Permalink Reply
ThomasJ
Thank you very much for your response. Due to the age of the last entry, I was wondering if this discussion was dead.

I concur with your strategy, do all data filtering and manipulation with php and the database is for storage, sorting, and collating.

I went ahead to create my db.xml file placing the attribute, size="6.2" to store prices but I wasn't sure whether this was correct or not. I am still working on the first block creation. I surmised this was correct because I am specifying a size for this field even though in the earlier documentation explaining how to specify it's structure when calling an ADOdb method they show the structure as part of the data type, 'N(6.2)'.

Another thing that documentation is laking for AXMLS is that there are a lot more data types available for SQL but the list of portable type codes is missing a lot. For instance, There are a lot more Char and string types than the "varchar", yet the varchar is the only one represented in the portable type codes list. How do I implement other types in the db.xml file. It would be great if someone that has good knowledge of AXMLS would write a complete reference for creating a db.xml file including a complete reference with examples of every attribute and data type that can be used and their implementation.

I started another thread yesterday, "What is the best approach for creating a DB", that has more to do with what I am trying to achieve. I landed here on this thread while looking for answers. This discussion is based on another c5 posting which is just an iteration of phplens.com's incomplete work on ADOdb.