[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
Re: Yet another idea
- To: uu@total-knowledge.com
- Subject: Re: Yet another idea
- From: "Alexey Parshin" <alexeyp@gmail.com>
- Date: Tue, 1 Jul 2008 18:02:57 +1000
- Delivered-to: mailing list uu@total-knowledge.com
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=CeZmuR9bFrd8PQ+Pu17cuY/uCukz/1EKopGcEno4csw=; b=Do5ddPBs4OQLZBJiaTFfUUBLqVs8v42WLCBhtLCwzWZc/j9JDI6uGNmclR8JVuncb0 UBRAGpiNAT6wSUpy8qoCUsIeoyd11eUsFevcgO5WNG0IhwFhJ97sxJ7uVzcAIvFhtj2H zbdZ3muatjPq794icwgSqkbPk+i5XrE2txMBo=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=AKaHRV8VnqZH8SsE/wVrsPY/L4ThDFeMFVpwjm/7vvMt0dZL9u0lnqlFlwuuniVhes lxve3LeT76cvTyCV/QrBLOxAVadD4CN5lZWAM57WSwvFAAVj55jhlsP+7es4CZRYcLRv 0S64T2iuCnomkzkID/w7osshi2BPNm16cmZJQ=
- In-reply-to: <4869DD10.70004@total-knowledge.com>
- Mailing-list: contact uu-help@total-knowledge.com; run by ezmlm
- References: <a75bc3cf0806301656n29b16505l37ab6dd8ecdb4c26@mail.gmail.com> <4869CAD5.6050605@total-knowledge.com> <a75bc3cf0806302354l224937f1q6b763b918271383f@mail.gmail.com> <4869DD10.70004@total-knowledge.com>
If the list isn't result of the query - it's not related to the
database and should be static.
Most likely, I'd have wrappers for all the queries - to keep 'em
auto-prepared and re-used.
Topic is a UMO. UMOs are stored in umo_version table. There is no name
or title for a UMO in that table, so we need some query to get it.
Otherwise, it's trivial.
2008/7/1 Ilya A. Volynets-Evenbakh <ilya@total-knowledge.com>:
> Where is the guarantee that every object list is direct result of a query?
> Plus, will you have a separate wrapper for every query?
>
> IOW: what class is "topics" object in your example?
>
> Alexey Parshin wrote:
>>
>> I'm seeing a bit differently. The implementation should use not the
>> members of the class but fields in the underlying query. And the
>> parser should just once per loop, converting a template into a vector
>> of pairs of text an following field index, so the template:
>>
>> <A href='HomeServlet?id={uv_id}'> {uv_name} </A>
>>
>> is parsed (once, before the loop) into vector of pairs:
>>
>> { "<A href='HomeServlet?id=", 0 },
>> { "'> ", 1 },
>> { "</A>", -1}
>>
>> The following loop would work really fast cause it doesn't parse anything.
>>
>> Alexey
>>
>> 1 июля 2008 г. 16:12 пользователь Ilya A. Volynets-Evenbakh
>> <ilya@total-knowledge.com> написал:
>>
>>>
>>> In other words, what you are suggesting, is writing wrapper class for
>>> each
>>> possible UMO collection, that would allow easy printing of enumerations
>>> of such objects?
>>>
>>> That may be a good idea, although parsing such templates will be
>>> time consuming, I'm afraid. Another obvious problem is maintaining
>>> such wrappers, whenever object structure changes (e.g. a new field
>>> is added to UMO and needs to be exposed to list generators).
>>>
>>> Ilya.
>>>
>>> Alexey Parshin wrote:
>>>
>>>>
>>>> Илья,
>>>>
>>>> Я тут подумал над тем, как бы избавиться от C++ циклов в .csp, в пользу
>>>> чего-нибудь более прозрачного, и вот что придумал. Почему бы нам, вместо
>>>> циклов, не предоставить генерацию по шаблону.
>>>>
>>>> Вместо:
>>>>
>>>> for (vector<CTopic>::iterator itor = topics.begin(); itor !=
>>>> topic.end();
>>>> itor++)
>>>> out << "<A href='TopicServlet?topic_id=" << (*itor)->id << ">" <<
>>>> itor->title << "'</A>";
>>>>
>>>> сделаем более простое и прозрачное:
>>>>
>>>> topics.forEach("<A href='TopicServlet?topic_id={id}> {title} </A>");
>>>>
>>>> --
>>>> Alexey Parshin,
>>>> http://www.sptk.net
>>>>
>>>
>>>
>>
>>
>>
>>
>
>
>
--
Alexey Parshin,
http://www.sptk.net