EasyCFM.COM ColdFusion Forums / ColdFusion Applications / some common doubts

   Reply to Discussion | New Discussion << previous || next >> 
Posted By Discussion Topic: some common doubts

book mark this topic Printer-friendly Version  send this discussion to a friend  new posts last

anujgarg
11-30-2006 @ 5:24 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
New Member
Posts: 11
Joined: Sep 2006

hi all

I am having some following doubts. Please make them clear:

1) In case of uploading, which option is best and why a) to put file name in database b) to put file on the server in a specific folder (if filename conflicts then make them unique by adding random numbers).

2) If I am having an array and converted it to a comma separated list (ie 1,2,3,4,) then here I find a comma in the last position. How can I omit it from the list to get 1,2,3,4 only?

3) In Cross Join, is it necessary to have a match of records between those two tables on which we are goiong to apply cross join?? Because cross join will only return the product of the rows of each table. Suppose we have 6 rows in first table and 2 rows in another then the result table will have 6*2 = 12 rows. What if there is a match and not match in the records of these two tables??

4) What is the need of checking authenticated user login? What if we dont have a check for authentication and allow user normally to login? Is it for admin part or should we use it in normal user section?? Please describe.

Thanks

Anuj


Webmaster
11-30-2006 @ 10:20 AM
Reply
Edit
Profile
Send P.M.
My Gravatar!
Powered by Gravatar
Administrator
Posts: 4542
Joined: Jan 2002

1) In case of uploading, which option is best and why a) to put file name in database b) to put file on the server in a specific folder (if filename conflicts then make them unique by adding random numbers).

A.) To put the file reference in a database. You would still put the file in the directory (if it is an image, etc) and then in the database you would insert the name of the file. It is cheaper (during processing) to reference a field then it is to check for the existance of a file. Also by putting it in database you can also do other things like return all records with a file only, etc.

2) If I am having an array and converted it to a comma separated list (ie 1,2,3,4,) then here I find a comma in the last position. How can I omit it from the list to get 1,2,3,4 only?

A.) This depends on how you generate the list. Are you looping through the array and generating the list yourself or are you using a built in function? If you are generating the list yourself (which is my suspicion) then you are probably doing:

<cfset listName = listname & "#newvalue#," />

Instead of doing that; use ListAppend()

<cfset listName = ListAppend(listName, NewValue) />

Then there would ne any trailing commas.

3) In Cross Join, is it necessary to have a match of records between those two tables on which we are goiong to apply cross join?? Because cross join will only return the product of the rows of each table. Suppose we have 6 rows in first table and 2 rows in another then the result table will have 6*2 = 12 rows. What if there is a match and not match in the records of these two tables??

A.) This is getting into advanced SQL... what you need to look into is a left join. A left join will allow you to return all 6 records in the main table even if there are no records in the second table.

SELECT T1.fieldID,
       T1.FieldName,
       T2.FieldImage
FROM TableName1 T1
LEFT JOIN TableName2 T2 ON T1.fieldID = T2.FieldID

4) What is the need of checking authenticated user login? What if we dont have a check for authentication and allow user normally to login? Is it for admin part or should we use it in normal user section?? Please describe.
A.) I am not sure I understand this question.. explain a little better and i am sure we can help you here too.

Pablo Varando
Senior Application Architect
EasyCFM.COM, LLC.

904.483.1457 \\ mobile
webmaster@easycfm.com \\email


Website Designed and Developed by Pablo Varando.