Hi All


Actually i have small doubt.
Can any one clarify which one is best logic and pls before justifying the
answer i want disadvantage for other one also..

Here i am trying to retrive query results into structure.

Developer A. written this logic
                <cfset Selstruct=structnew()> 
                <cfset arrfields = arraynew(1)> 
                <cfset a=#trim(ucase(query1.columnlist))#> 
                <cfset ln = ListLen(#a#)> 
         
                        <cfif #attributes.fields# EQ "*">
                                <CFLOOP From="1" To="#ln#" INDEX="i">
                                        <cfset
arrfields[i]=#ListGetAt(query1.columnlist, i)#>
                                </CFLOOP>
                        <cfelseif #attributes.fields# NEQ "*">
                            <CFLOOP From="1" To="#ln#" INDEX="i">
                                        <cfset
arrfields[i]=#ListGetAt(ATTRIBUTES.fields, i)#>
                        </CFLOOP>
                        </cfif> 
                        
                        <CFLOOP From="1" To="#ln#" INDEX="i">
                                <cfscript>
                                        selstruct['#arrfields[i]#'] =
arraynew(1);
                                </cfscript>
                        </cfloop>
                         <cfloop query="query1">
                                <cfloop from="1" to = "#ln#" index="i">
                                    <cfscript>
        
selstruct[#arrfields[i]#][query1.currentrow]=#evaluate(arrfields[i])#;
                                        </cfscript>
                                </cfloop>
                        </cfloop>

See here develop A logic also giveing correct results.
Retrurns results of query into Selstruct.
Example :

Selstruct.eno[1]   <-- eno is column name of table-->
Selstruct.eno[2] 

Here i noticed is for every column we will be creating array..
(Colmns of table : max 15 to 20)



Developer B. written this logic


                <cfloop query="qselect">    <--qselect is structure-->
                        <cfset RowCount = qselect.CurrentRow>
                        <cfset Selstruct[RowCount]=StructNew()>
                        <cfloop index="FieldName"
list="#qselect.ColumnList#">
                                <cfset
tmp=StructInsert(Selstruct[RowCount],FieldName,Evaluate("qselect.#FieldName#
"))>
                        </cfloop>
                </cfloop>


See here develop B logic also working correctly 
Retrurns results of query into Selstruct.
Example :

Selstruct[1].eno   <-- eno is column name of table-->
Selstruct[2].eno

Here i noticed is for every row willbe creating one structred array..
So that if table may contain 10,000 rows.


Is there any disadvantage if i use this logic(Developer-B)..


if u prefer Developer A logic then pls tell me Developer B logic
disadvantage.

I am expecting answer from u.

I think u understood my cocern.



Thanx in advance.
Ramesh
[EMAIL PROTECTED]
[EMAIL PROTECTED]

------------------------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message 
with 'unsubscribe' in the body to [EMAIL PROTECTED]

Reply via email to