RE: Structures, Arrays, Array of Structures
is there any way to dump the whole content of the "GetYPs" query into the structure all at once without having to Loop through the query? something like... CFSET STTEMP = STRUCTNEW() !--- temporary structure --- CFSET STTEMP = "#GetYPs#" also, what will be the scope of the STTEMP structure, I assume it will be the page, unless you specify otherwise (client, server, etc), am I right... Bismarck Perez -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 31, 2000 4:27 PM To: [EMAIL PROTECTED] Cc: Robert Everland Subject: Re: Structures, Arrays, Array of Structures Here's an example: CFQUERY NAME="GetYPs" DATASOURCE="#DSN#" USERNAME="#user#" PASSWORD="#pass#" SELECT Class_ID, Class_Name, Pages, NewPages FROM YellowPages (nolock) /CFQUERY CFSET STTEMP = STRUCTNEW() !--- temporary structure --- CFSET APPLICATION.YPS = STRUCTNEW() !--- final structure for Headings --- CFLOOP QUERY="GetYPs" CFSET STTEMP["Class_ID"] = "#Class_ID#" CFSET STTEMP["Class_Name"] = "#Class_Name#" CFSET STTEMP["Pages"] = "#Pages#" CFSET STTEMP["NewPages"] = "#NewPages#" CFSET APPLICATION.YPS[STTEMP["Class_ID"]] = STRUCTCOPY(STTEMP) CFSET TMPVAR = STRUCTCLEAR(STTEMP) /CFLOOP best, paul At 10:45 AM 8/31/00 -0400, you wrote: Is there a way to add multiple records into a structure or do I have to make an array of strucutres. Right now I made an aray of strucutures but I want to make sure that is the most logical way to be doing it. -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
RE: Structures, Arrays, Array of Structures
is there any way to dump the whole content of the "GetYPs" query into the structure all at once without having to Loop through the query? No. also, what will be the scope of the STTEMP structure, I assume it will be the page, unless you specify otherwise (client, server, etc), am I right... Yes. Keep in mind that you can only store complex data objects in memory variables, so you wouldn't be able to put it directly within a Client variable unless you serialized it using CFWDDX into a string. Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ voice: (202) 797-5496 fax: (202) 797-5444 -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
RE: Structures, Arrays, Array of Structures
Robert - Depends on your data layout. I use arrays of structures, structures of arrays, structures of structures, and arrays of arrays, all the time. Whatever is most logical and most efficient for you to use. I'm sure if you want to post a small exaple of your data structures that you'll get a few opinions on how it should be laid out. -Rick -Original Message- From: Robert Everland [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 31, 2000 10:46 AM To: '[EMAIL PROTECTED]' Subject: Structures, Arrays, Array of Structures Is there a way to add multiple records into a structure or do I have to make an array of strucutres. Right now I made an aray of strucutures but I want to make sure that is the most logical way to be doing it. Robert Everland III Web Developer Dixon Ticonderoga -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
RE: Structures, Arrays, Array of Structures
At 10:35 AM 9/1/00 -0400, you wrote: is there any way to dump the whole content of the "GetYPs" query into the structure all at once without having to Loop through the query? something like... Not that I'm aware of. CFSET STTEMP = STRUCTNEW() !--- temporary structure --- CFSET STTEMP = "#GetYPs#" also, what will be the scope of the STTEMP structure, I assume it will be the page, unless you specify otherwise (client, server, etc), am I right... It's page. In my application, this function is executed the first time a browsers accesses this website only. It should be CFLOCKED though. best, paul -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
Re: Structures, Arrays, Array of Structures
Paul, why did you set the data in a temporary structure, then copy it to the application structure? Did you intend to put a lock around the application structure? At 01:26 PM 8/31/00 -0700, paul smith wrote: Here's an example: CFQUERY NAME="GetYPs" DATASOURCE="#DSN#" USERNAME="#user#" PASSWORD="#pass#" SELECT Class_ID, Class_Name, Pages, NewPages FROM YellowPages (nolock) /CFQUERY CFSET STTEMP = STRUCTNEW() !--- temporary structure --- CFSET APPLICATION.YPS = STRUCTNEW() !--- final structure for Headings --- CFLOOP QUERY="GetYPs" CFSET STTEMP["Class_ID"] = "#Class_ID#" CFSET STTEMP["Class_Name"] = "#Class_Name#" CFSET STTEMP["Pages"] = "#Pages#" CFSET STTEMP["NewPages"] = "#NewPages#" CFSET APPLICATION.YPS[STTEMP["Class_ID"]] = STRUCTCOPY(STTEMP) CFSET TMPVAR = STRUCTCLEAR(STTEMP) /CFLOOP best, paul At 10:45 AM 8/31/00 -0400, you wrote: Is there a way to add multiple records into a structure or do I have to make an array of strucutres. Right now I made an aray of strucutures but I want to make sure that is the most logical way to be doing it. -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. --- Peter Theobald, Chief Technology Officer LiquidStreaming http://www.liquidstreaming.com [EMAIL PROTECTED] Phone 1.212.545.1232 Fax 1.212.679.8032 -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
Re: Structures, Arrays, Array of Structures
At 01:48 PM 9/1/00 -0400, you wrote: Paul, why did you set the data in a temporary structure, then copy it to the application structure? Other than that was the way I was taught to do it, I believe it's needed to create a structure with "N-columns" (in my case, Class_ID, Class_Name, Pages, and NewPages, or 4 columns) and "M-rows" (in my case over 7,000 rows), or what I think many must call a "Nested Structure" Did you intend to put a lock around the application structure? Yes. I actually did put a LOCK there but I kept getting some error message. I haven't had time to sort it out. BTW, Dan Switzer has a super tutorial on Structures at: http://www.oacfug.org/dsp_articles.cfm/dsp_Articles.cfm?view=Articles_35 (the page throws a JS error for me, clicking on "No" seemed to work) best, paul At 01:26 PM 8/31/00 -0700, paul smith wrote: Here's an example: CFQUERY NAME="GetYPs" DATASOURCE="#DSN#" USERNAME="#user#" PASSWORD="#pass#" SELECT Class_ID, Class_Name, Pages, NewPages FROM YellowPages (nolock) /CFQUERY CFSET STTEMP = STRUCTNEW() !--- temporary structure --- CFSET APPLICATION.YPS = STRUCTNEW() !--- final structure for Headings --- CFLOOP QUERY="GetYPs" CFSET STTEMP["Class_ID"] = "#Class_ID#" CFSET STTEMP["Class_Name"] = "#Class_Name#" CFSET STTEMP["Pages"] = "#Pages#" CFSET STTEMP["NewPages"] = "#NewPages#" CFSET APPLICATION.YPS[STTEMP["Class_ID"]] = STRUCTCOPY(STTEMP) CFSET TMPVAR = STRUCTCLEAR(STTEMP) /CFLOOP best, paul At 10:45 AM 8/31/00 -0400, you wrote: Is there a way to add multiple records into a structure or do I have to make an array of strucutres. Right now I made an aray of strucutures but I want to make sure that is the most logical way to be doing it. - - Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. --- Peter Theobald, Chief Technology Officer LiquidStreaming http://www.liquidstreaming.com [EMAIL PROTECTED] Phone 1.212.545.1232 Fax 1.212.679.8032 -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body. Paul Smith, Web/Database Droid A: SupportNet, Inc, 3871 Piedmont Ave, Oakland, CA 94611 P: (510) 763-2358 C: (510) 205-6755 F: (510) 763-2370 E: [EMAIL PROTECTED] W: http://www.support.net -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
Re: Structures, Arrays, Array of Structures
At 01:48 PM 9/1/2000 -0400, Peter Theobald wrote: Paul, why did you set the data in a temporary structure, then copy it to the application structure? Did you intend to put a lock around the application structure? I don't know about Paul, but I generally build structures in local scope and then copy them to application (or session) scope with a single cflock for the copy, instead of locking the entire process. Particularly if I'm initializing a bunch of structures, I'll build them all and copy them all under one cflock. Sharon -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
Re: Structures, Arrays, Array of Structures
--=_184807419==_.ALT Content-Type: text/plain; charset="us-ascii"; format=flowed Right. This is what Allaire recommends in "ColdFusion Best Practices" cfquery name="variables.qUser" datasource="#request.dsn#" SELECT FirstName, LastName FROM Users WHERE UserID = #request.UserID# /cfquery cflock scope="application" timeout="2" type="exclusive" cfset application.qUser = variables.qUser /cflock at http://www.allaire.com/handlers/index.cfm?id=17318method=full But for Structures, this was thrashed out recently in the Fusebox list. I thought the consensus there was not to bother with the additional step of copying the structures, and use something like the following in qry_globals.cfm or Application.cfm: cflock scope="Application" type="ReadOnly" ... CFSET Init = (NOT isDefined("Application.MyStruct") OR Not isStruct(Application.MyStruct)) /cflock CFIF Init cflock scope="Application" type="exclusive" ... CFSET Application.MyStruct = StructNew() ...read data here into Application.MyStruct for some time /cflock /CFIF (See the posting by BOROVOY on 29 Aug 2000) best, paul At 09:29 PM 9/1/00 -0400, you wrote: At 01:48 PM 9/1/2000 -0400, Peter Theobald wrote: Paul, why did you set the data in a temporary structure, then copy it to the application structure? Did you intend to put a lock around the application structure? I don't know about Paul, but I generally build structures in local scope and then copy them to application (or session) scope with a single cflock for the copy, instead of locking the entire process. Particularly if I'm initializing a bunch of structures, I'll build them all and copy them all under one cflock. Sharon Paul Smith, Web/Database Droid A: SupportNet, Inc, 3871 Piedmont Ave, Oakland, CA 94611 P: (510) 763-2358 C: (510) 205-6755 F: (510) 763-2370 E: [EMAIL PROTECTED] W: http://www.support.net --=_184807419==_.ALT Content-Type: text/html; charset="us-ascii" html Right.nbsp; This is what Allaire recommends in quot;ColdFusion Best Practicesquot;br br lt;cfquery name=quot;variables.qUserquot; datasource=quot;#request.dsn#quot;gt;br x-tabnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;/x-tabSELECT FirstName, LastNamebr x-tabnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;/x-tabFROM Usersbr x-tabnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;/x-tabWHERE UserID = #request.UserID#br lt;/cfquerygt;br lt;cflock scope=quot;applicationquot; timeout=quot;2quot; type=quot;exclusivequot;gt;br x-tabnbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;nbsp;/x-tablt;cfset application.qUser = variables.qUsergt;br lt;/cflockgt;br br at a href="http://www.allaire.com/handlers/index.cfm?id=17318amp;method=full" eudora="autourl"http://www.allaire.com/handlers/index.cfm?id=17318amp;method=full/abr br But for Structures, this was thrashed out recently in the Fusebox list.nbsp; I thought the consensus there was not to bother with the additional step of copying the structures, and use something like the following in qry_globals.cfm or Application.cfm:br br lt;cflock scope=quot;Applicationquot; type=quot;ReadOnlyquot; ...gt; br lt;CFSET Init = (NOT isDefined(quot;Application.MyStructquot;) OR Not br isStruct(Application.MyStruct))gt; br lt;/cflockgt; br lt;CFIF Initgt; br lt;cflock scope=quot;Applicationquot; type=quot;exclusivequot; ...gt; br lt;CFSET Application.MyStruct = StructNew()gt; br ...read data here into Application.MyStruct for some br time br lt;/cflockgt; br lt;/CFIFgt;br br (See the posting by BOROVOY on 29 Aug 2000)br br best,nbsp; paulbr br At 09:29 PM 9/1/00 -0400, you wrote:br blockquote type=cite citeAt 01:48 PM 9/1/2000 -0400, Peter Theobald wrote:br gt;Paul, why did you set the data in a temporary structure, then copy it tobr the application structure?br gt;Did you intend to put a lock around the application structure?br br I don't know about Paul, but I generally build structures in local scopebr and then copy them to application (or session) scope with a single cflockbr for the copy, instead of locking the entire process.nbsp; Particularly if I'mbr initializing a bunch of structures, I'll build them all and copy them allbr under one cflock.br br Sharonbr /blockquotebr br br br Paul Smith, Web/Database Droid br A: SupportNet, Inc, 3871 Piedmont Ave, Oakland, CA 94611 br P: (510) 763-2358 br C: (510) 205-6755br F: (510) 763-2370br E: [EMAIL PROTECTED]br W: a href="http://www.support.net/" eudora="autourl"font color="#FF"uhttp://www.support.net/abr /font/u/html --=_184807419==_.ALT-- -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
Structures, Arrays, Array of Structures
Is there a way to add multiple records into a structure or do I have to make an array of strucutres. Right now I made an aray of strucutures but I want to make sure that is the most logical way to be doing it. Robert Everland III Web Developer Dixon Ticonderoga -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.
Re: Structures, Arrays, Array of Structures
Here's an example: CFQUERY NAME="GetYPs" DATASOURCE="#DSN#" USERNAME="#user#" PASSWORD="#pass#" SELECT Class_ID, Class_Name, Pages, NewPages FROM YellowPages (nolock) /CFQUERY CFSET STTEMP = STRUCTNEW() !--- temporary structure --- CFSET APPLICATION.YPS = STRUCTNEW() !--- final structure for Headings --- CFLOOP QUERY="GetYPs" CFSET STTEMP["Class_ID"] = "#Class_ID#" CFSET STTEMP["Class_Name"] = "#Class_Name#" CFSET STTEMP["Pages"] = "#Pages#" CFSET STTEMP["NewPages"] = "#NewPages#" CFSET APPLICATION.YPS[STTEMP["Class_ID"]] = STRUCTCOPY(STTEMP) CFSET TMPVAR = STRUCTCLEAR(STTEMP) /CFLOOP best, paul At 10:45 AM 8/31/00 -0400, you wrote: Is there a way to add multiple records into a structure or do I have to make an array of strucutres. Right now I made an aray of strucutures but I want to make sure that is the most logical way to be doing it. -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ To Unsubscribe visit http://www.houseoffusion.com/index.cfm?sidebar=listsbody=lists/cf_talk or send a message to [EMAIL PROTECTED] with 'unsubscribe' in the body.