473,666 Members | 2,065 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pl/tcl auto-load problem

How do I use the pltcu unknown module to auto-load a return value from a
select query? I'm trying to boost performance in our databases by
preloading
certain frequently-used variables. Ultimately I'd like to auto-load
prepared queries this way too.

I've figured out how to use pltcu to auto-load a global variable and access
that variable by appending the following lines to unknown.pltcl:
global var1
set var1 abc
Then, in a pltcu procdure, I can access it:
create function get_var1() returns varchar as '
global var1
return $var1
' language 'pltcu';
(returns abc)

What I'd like to do is something like the following in unknown.pltcl:
global ret
spi_exec "select col1 from tablename where col2 = ''xyz''"
set ret $col1
and return the global $ret in pltcu functions.

When I try use spi_exec in unknown.pltcu, I get an error when loading the
module:
New/updated unknown: too many nested calls to Tcl_EvalObj (infinite
loop?)
Abort

I've tried a few other variations, all without success. Any suggestions?
(I'm
using pltcu because I need a trigger function that can write to system
files, and I don't think that can be done with plperl or plpython.
Performance
boosting through hardware upgrades is not a viable option because the
databases are on tablets running Linux with 245 MB ram and damnably limited
battery life.)

Craig Addleman
DBA
www.sharechive.com

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Nov 22 '05 #1
1 1797
It seems that something you added to the unknown handler triggers it to
be called again. Might be that spi_exec isn't defined at the time that
script is evaluated.
Jan
Craig Addleman wrote:
How do I use the pltcu unknown module to auto-load a return value from a
select query? I'm trying to boost performance in our databases by
preloading
certain frequently-used variables. Ultimately I'd like to auto-load
prepared queries this way too.

I've figured out how to use pltcu to auto-load a global variable and access
that variable by appending the following lines to unknown.pltcl:
global var1
set var1 abc
Then, in a pltcu procdure, I can access it:
create function get_var1() returns varchar as '
global var1
return $var1
' language 'pltcu';
(returns abc)

What I'd like to do is something like the following in unknown.pltcl:
global ret
spi_exec "select col1 from tablename where col2 = ''xyz''"
set ret $col1
and return the global $ret in pltcu functions.

When I try use spi_exec in unknown.pltcu, I get an error when loading the
module:
New/updated unknown: too many nested calls to Tcl_EvalObj (infinite
loop?)
Abort

I've tried a few other variations, all without success. Any suggestions?
(I'm
using pltcu because I need a trigger function that can write to system
files, and I don't think that can be done with plperl or plpython.
Performance
boosting through hardware upgrades is not a viable option because the
databases are on tablets running Linux with 245 MB ram and damnably limited
battery life.)

Craig Addleman
DBA
www.sharechive.com

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

--
#============== =============== =============== =============== ===========#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#============== =============== =============== ====== Ja******@Yahoo. com #
---------------------------(end of broadcast)---------------------------
TIP 8: explain analyze is your friend

Nov 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2599
by: Manlio Perillo | last post by:
Hi. This post follows "does python have useless destructors". I'm not an expert, so I hope what I will write is meaningfull and clear. Actually in Python there is no possibility to write code that follows C++ RAII pattern. Of course Python objects are not statics like in C++, but in C++ the auto_ptr class is used for enforcing this pattern for dynamical
1
34312
by: Lew | last post by:
Hi all, I'm trying to create a page that has a user-selectable page auto-refresh option (IE 5.5). Essentially, it's a page that contains a checkbox, when the user checks the checkbox, I'd like the page to auto-refresh every 4 seconds....if the user un-checks the checkbox, I'd like to turn off the auto refresh. The page is as follows:
5
6100
by: Robert Downes | last post by:
I'm using the following in a page that I'm testing in Mozilla: p.actionLinkBlock {border: 1px #000000 dashed; padding: 0.2cm; width: auto} But the dashed border is extending to the right-edge of the screen. I want it to only extend as far as it needs to to nicely contain the content within (a couple of links). Is width: auto the wrong property to do this? Is Mozilla rendering the style wrong?
9
2510
by: Alan Mackenzie | last post by:
To all those who use (X)Emacs's CC Mode to edit C, C++, Java, Objective-C, Pike, AWK or IDL: To help direct the development of CC Mode, it would be useful to find out how people use the auto-newline "minor mode" facility. If you could spare a little time, would you answer these questions, please: o Do you program with auto-newline switched on (e.g. do you get NLs inserted automatically after typing a `;' or `{')? o Did you configure...
20
2856
by: Vijay Kumar R. Zanvar | last post by:
Hello, Unlike register, auto keyword can not be used to declare formal parameter(s). Is there any specific reason for this? Kind regards, Vijay Kumar R. Zanvar
6
5062
by: Alpha | last post by:
I retrieve a table with only 2 columns. One is a auto-generated primary key column and the 2nd is a string. When I add a new row to the dataset to be updated back to the database. What should I do with the 1st column ? (Below I have a "1" in place for now). Also, Does the datase.AcceptChanges(); updates the changes to the database? Which command do I use to update the changes in dataset back to the Access database table? Thanks, Alpha...
7
22689
by: Brian | last post by:
hello, I am looking for a way to auto refresh a web page that I created, but also let the user choose to stop the auto refresh. I can not figure out how to stop the auto refresh. Any help would be appreciated. Thanks, Brian
5
3263
by: maya | last post by:
at work they decided to center divs thus: body {text-align:center} #content {width: 612px; text-align:left; margin: 0 auto 0 auto; } this works fine in IE & FF, EXCEPT in FF it doesn't work if I change 'auto' to 0 for left and right margin values; I have to leave those at 'auto'.. so I would like to know what exactly means 'auto' -- what value it represents exactly (and does it apply for all elements/values you might apply 'auto' to?)
22
3062
by: nospam_news | last post by:
I currently get asked about my usage of "auto". What is it for? The keyword is clearly superflous here. In contrast to the huge majority of C/C++ developers I write definitions very explicitly like that: int main(char argc, char *argv, char *env) { try { auto Exception mainException(1); mainException.setErrNo(42);
21
6331
by: JOYCE | last post by:
Look the subject,that's my problem! I hope someone can help me, thanks
0
8356
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8869
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8781
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8551
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4368
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2771
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1775
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.