Questions about tempates

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Questions about tempates

Milan Babuskov-4
Hi,

I'm trying to create a new template and run into some problems. Maybe
I don't understand the templating language anymore, please help...

1. I'm trying to create trigger at position 999. In confdef file I wrote:

        <setting type="int">
            <caption>Trigger position (0..32767)</caption>
            <key>{%object_path%}/triggerPosition</key>
            <default>999</default>
            <relation>{%object_handle%}</relation>
            <aligngroup>1</aligngroup>
        </setting>

but it offers a value of 100 when dialog is shown. I make that 999
again, and when I submit and get generated code, it is reverted back
to 100.

2. I have an exception string inside, so case is important. However,
it spits out the text in uppercase. My .template file looks like this:

--------------------------------------
{%--:Uncomment to edit template info
visually.%}{%--:{%edit_info%}{%abort%}%}{%edit_conf%}{%kw:set term !!
;

create trigger%} CT_{%object_name%} {%kw:for%} {%object_name%}
{%kw:active after update or delete position
{%getconf:{%object_path%}/triggerPosition:999%}
as
declare variable id bigint;
declare variable operacija varchar(3);
begin
{%tab%}if (updating and new.ID is distinct from old.ID) then
{%tab%}{%tab%}exception GRESKA 'THE FOLLOWING TEXT SHOULD NOT be lowercase!';
{%tab%}if%} (deleting or {%foreach:column:
{%tab%}{%tab%}{%kw:or%}
:{%ifcontains:{%getconf:{%object_path%}/columnNames%}:{%object_name%}:{%kw:old%}.{%object_name%}
{%kw:is distinct from new%}.{%object_name%}
%}%})
{%tab%}{%kw:then
{%tab%}begin%}
{%tab%}{%tab%}id = gen_id(gen_audit_id, 1);
{%tab%}{%tab%}insert into audit_log(id, korisnik, datum, id)
{%tab%}{%tab%}alues (:id, current_user, current_timestamp, old.ID);
{%tab%}{%kw:end
end!!

set term%} ; !!
--------------------------------------

any ideas?

--
Milan Babuskov
http://www.guacosoft.com

------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
user administration capabilities and model configuration. Take
the hassle out of deploying and managing Subversion and the
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
Flamerobin-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/flamerobin-devel
Reply | Threaded
Open this post in threaded view
|

Re: Questions about tempates

Milan Babuskov-4
On Tue, Aug 23, 2011 at 12:04 PM, Milan Babuskov
<[hidden email]> wrote:

> 2. I have an exception string inside, so case is important. However,
> it spits out the text in uppercase. My .template file looks like this:
>
> --------------------------------------
> {%--:Uncomment to edit template info
> visually.%}{%--:{%edit_info%}{%abort%}%}{%edit_conf%}{%kw:set term !!
> ;
>
> create trigger%} CT_{%object_name%} {%kw:for%} {%object_name%}
> {%kw:active after update or delete position

I figured out this one, {%kw is never closed. I copy/pasted from the
create_change_trigger, and added stuff in the middle of it.

Sorry for false alarm. The other issue still remains though.

--
Milan Babuskov
http://www.guacosoft.com

------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
user administration capabilities and model configuration. Take
the hassle out of deploying and managing Subversion and the
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
Flamerobin-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/flamerobin-devel
Reply | Threaded
Open this post in threaded view
|

Re: Questions about tempates

Nando Dessena
In reply to this post by Milan Babuskov-4
Milan,

> 1. I'm trying to create trigger at position 999. In confdef file I
> wrote:
>
> <setting type="int"> <caption>Trigger position (0..32767)</caption>
> <key>{%object_path%}/triggerPosition</key> <default>999</default>
> <relation>{%object_handle%}</relation> <aligngroup>1</aligngroup>
> </setting>

<relation> is not relevant for "int" parameters, AFAIR. This should not
cause any harm, anyway.

> but it offers a value of 100 when dialog is shown. I make that 999
> again, and when I submit and get generated code, it is reverted back
> to 100.

I'd need to see the other related files: .info and .template. And find
the .conf file in the user folder: that's where it should be storing the
999 value under {%object_path%}/triggerPosition.

Ciao
--
Nando Dessena


------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
user administration capabilities and model configuration. Take
the hassle out of deploying and managing Subversion and the
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
Flamerobin-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/flamerobin-devel
Reply | Threaded
Open this post in threaded view
|

Re: Questions about tempates

Milan Babuskov-4
On Tue, Aug 23, 2011 at 12:20 PM, Nando Dessena <[hidden email]> wrote:
> I'd need to see the other related files: .info and .template.

.info:
[templateInfo]
menuCaption=Create audit log trigger for {%object_name%}
menuPosition=40
matchesType=^TABLE$
matchesWhen={%!:{%is_system%}%}

.template:
------------------------------------------------------------------------------
{%--:Uncomment to edit template info
visually.%}{%--:{%edit_info%}{%abort%}%}{%edit_conf%}{%kw:set term !!
;

create trigger%} CT_{%object_name%} {%kw:for%} {%object_name%}
{%kw:active after update or delete position%}
{%getconf:{%object_path%}/triggerPosition:999%}
as
declare variable id bigint;
begin
{%tab%}if (updating and new.ID is distinct from old.ID) then
{%tab%}{%tab%}exception GRESKA 'ID se ne sme menjati zbog audit loga!';
{%tab%}id = gen_id(gen_audit_log_id, 1);
{%foreach:column:
:{%ifcontains:{%getconf:{%object_path%}/columnNames%}:{%object_name%}:
{%tab%}{%tab%}if (deleting or old.{%object_name%} is distinct from
new.{%object_name%}) then
{%tab%}{%tab%}{%tab%}insert into audit_log_field(id, kolona, vrednost)
{%tab%}{%tab%}{%tab%}values ({%colon%}id, '{%object_name%}',
old.{%object_name%});
%}%}
{%tab%}{%kw:end
end!!

set term%} ; !!
------------------------------------------------------------------------------

> And find
> the .conf file in the user folder: that's where it should be storing the
> 999 value under {%object_path%}/triggerPosition.

This file contains:

triggerPosition=100


--
Milan Babuskov
http://www.guacosoft.com

------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
user administration capabilities and model configuration. Take
the hassle out of deploying and managing Subversion and the
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
Flamerobin-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/flamerobin-devel
Reply | Threaded
Open this post in threaded view
|

Re: Questions about tempates

Nando Dessena
Milan,
seems everything ok to me. What happens if you delete the .conf file?
--
Nando Dessena


------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management
Up to 160% more powerful than alternatives and 25% more efficient.
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
Flamerobin-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/flamerobin-devel
Reply | Threaded
Open this post in threaded view
|

Re: Questions about tempates

Milan Babuskov-4
On Wed, Aug 24, 2011 at 8:49 AM, Nando Dessena <[hidden email]> wrote:
> seems everything ok to me.

Files seem ok, but when the dialog opens the wxSpinCtrl contains a
value of 100 instead of 999.

The same happens if I delete the conf file. I change the spin ctrl.
value to 999, and generated SQL contains 100 instead.

> What happens if you delete the .conf file?

A new one gets created with a value of 100.

--
Milan Babuskov
http://www.guacosoft.com

------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management
Up to 160% more powerful than alternatives and 25% more efficient.
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
Flamerobin-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/flamerobin-devel
Reply | Threaded
Open this post in threaded view
|

Re: Questions about tempates

Nando Dessena
Milan,

> Files seem ok, but when the dialog opens the wxSpinCtrl contains a
> value of 100 instead of 999.

Got it:

PrefDlgIntEditSetting::PrefDlgIntEditSetting(wxPanel* page,
        PrefDlgSetting* parent)
    : PrefDlgSetting(page, parent), captionAfterM(0), captionBeforeM(0),
        spinctrlM(0), maxValueM(100), minValueM(0), defaultM(0)
{
}

You should use <maxvalue> and <minvalue>, but I also suggest that the
default is changed to something more sensible. Maybe the largest
possible unsigned int, or -1 to mean "no limits".

Ciao
--
Nando Dessena


------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management
Up to 160% more powerful than alternatives and 25% more efficient.
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
Flamerobin-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/flamerobin-devel
Reply | Threaded
Open this post in threaded view
|

Re: Questions about tempates

Nando Dessena
I think that, short of making an explicit "smallint" setting type, the
most useful default for <maxvalue> is 32767.
--
Nando Dessena


------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management
Up to 160% more powerful than alternatives and 25% more efficient.
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
Flamerobin-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/flamerobin-devel