Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Re: [SMARTY] large result sets
You can use assign_by_ref() instead of plain old assign to use a
reference, so you have one copy of the data instead of two.

-bok

On Fri, 30 Jul 2004 11:04:17 -0400, Travis Low <travis@dawnstar.com> wrote:
> How does one handle very large result sets in Smarty?  Normally, I try to 
page
> DB results, but I have a client who wants to generate a very large page in
 the
> browser.  If I have to assign everything first, I run out of memory.  Is t
here
> a way to use Smarty to pull the results from the db, or should I just writ
e a
> vanilla PHP page for that?
>
> cheers,
>
> Travis
>
> --
> Travis Low
> <mailto:travis@dawnstar.com>
> <http://www.dawnstar.com>
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Report this thread to moderator Post Follow-up to this message
Old Post
Robert Amos
07-30-04 08:58 PM


Re: [SMARTY] large result sets
> You can use assign_by_ref() instead of plain old assign to use a
> reference, so you have one copy of the data instead of two.

There should be no difference, unless either the original or the copy is
subsequently changed (which is unlikely in a template variable). PHP
maintains copied variables as references until their values diverge.

--
Mark Rogers,
More Solutions Ltd :: Tel: 0845 45 89 555

Report this thread to moderator Post Follow-up to this message
Old Post
Mark Rogers
08-04-04 09:02 PM


Re: [SMARTY] large result sets
On Wed, Aug 04, 2004 at 05:35:04PM +0100, Mark Rogers wrote: 
>
> There should be no difference, unless either the original or the copy is
> subsequently changed (which is unlikely in a template variable). PHP
> maintains copied variables as references until their values diverge.

correct. but i think there is a caveat in php4 with foreach. the
internal array pointer (http://php.net/current) is a property of the
assigned array. if you do foreach($array as $item), the internal
array-pointer gets reset. this is considered a change of the array and
the whole thing gets copied.

i didn't look for evidence of that in the php-source, but
memory-consumption with foreach on large arrays makes me assume that.

it would be great if anybody could confirm or rebut this.

> --
> Mark Rogers,
> More Solutions Ltd :: Tel: 0845 45 89 555
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

Report this thread to moderator Post Follow-up to this message
Old Post
Messju Mohr
08-04-04 09:02 PM


RE: [SMARTY] large result sets
> > > You can use assign_by_ref() instead of plain old assign to use a 
>
> correct. but i think there is a caveat in php4 with foreach. the
> internal array pointer (http://php.net/current) is a property of the
> assigned array. if you do foreach($array as $item), the internal
> array-pointer gets reset. this is considered a change of the array and
> the whole thing gets copied.
>
> i didn't look for evidence of that in the php-source, but
> memory-consumption with foreach on large arrays makes me assume that.
>
> it would be great if anybody could confirm or rebut this.

This is correct. See
http://www.php.net/manual/en/contro...res.foreach.php for details.

David

Report this thread to moderator Post Follow-up to this message
Old Post
David zülke
08-04-04 09:02 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

PHP Smarty Templates archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 04:30 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.