473,569 Members | 2,751 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

vacuum from ecpg



The following program produces the output below...
It is built with:

vrfy_prob: vrfy_prob.cpg
/usr/local/pgsql/bin/ecpg -I/usr/local/pgsql/include -o vrfy_prob.c vrfy_prob.cpg
gcc -g${DEBUG} -I/usr/include/pgsql -o vrfy_prob -lm -lc -lecpg -lpq vrfy_prob.c

I am not using a BEGIN/END block, though the error messages indicate
that I am.

How can I do a vacuum analyze from within embedded sql in a c program
that works?

Thanks for your help!

Lynn Tilby
lt****@asu.edu

*************** *************** * PROGRAM *************** *************** **
#include <stdlib.h>
#include <ctype.h>

EXEC SQL INCLUDE sqlca; /* include the sql debugging stuff... */

/********* !!!!!!!!!! POSTGRES SQL DEBUGGING STRUCTURE FIELDS ************/
#define DEBUG_SQL printf("sqlcaid = %s\n", sqlca.sqlcaid); printf("sqlabc =
%f\n", sqlca.sqlabc); printf("sqlcode = %f\n", sqlca.sqlcode);
printf("sqlca.s qlerrm.sqlerrml = %d\n", sqlca.sqlerrm.s qlerrml);
printf("sqlca.s qlerrm.sqlerrmc = %s\n", sqlca.sqlerrm.s qlerrmc); printf("sqlerrp
= %s\n", sqlca.sqlerrp); printf("sqlerrd = %f\n", sqlca.sqlerrd); printf("sqlext
= %s\n", sqlca.sqlext);

int main()
{

EXEC SQL BEGIN DECLARE SECTION; /* declare the variables used by sql */

EXEC SQL END DECLARE SECTION; /* declare the variables used by sql */

EXEC SQL CONNECT TO pma;
EXEC SQL WHENEVER sqlerror sqlprint; /* turn on verbose sql error ckg */

DEBUG_SQL
EXEC SQL VACUUM ANALYZE optn_cent_xref;
DEBUG_SQL
}

*************** *************** * OUTPUT *************** *************** **

[lynn@polaris strdl_sim]$ ./vrfy_prob
sqlcaid = SQLCA Ś
sqlabc = -1.998680
sqlcode = -1.998680
sqlca.sqlerrm.s qlerrml = 0
sqlca.sqlerrm.s qlerrmc =
sqlerrp = NOT SET
sqlerrd = -1.998680
sqlext =
sql error Postgres error: ERROR: VACUUM cannot run inside a BEGIN/END block
line 23.
sqlcaid = SQLCA Ś
sqlabc = -1.998680
sqlcode = -1.998681
sqlca.sqlerrm.s qlerrml = 76
sqlca.sqlerrm.s qlerrmc = Postgres error: ERROR: VACUUM cannot run inside a
BEGIN/END block
line 23.
sqlerrp = 23.
sqlerrd = -1.998680
sqlext =
[lynn@polaris strdl_sim]$
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 12 '05 #1
3 1992
Hello,

I might be wrong on this but I think that ecpg using transactions by
default for each query.
Perhaps turning on autocommit?

J
Ly********@asu. edu wrote:
The following program produces the output below...
It is built with:

vrfy_prob: vrfy_prob.cpg
/usr/local/pgsql/bin/ecpg -I/usr/local/pgsql/include -o vrfy_prob.c vrfy_prob.cpg
gcc -g${DEBUG} -I/usr/include/pgsql -o vrfy_prob -lm -lc -lecpg -lpq vrfy_prob.c

I am not using a BEGIN/END block, though the error messages indicate
that I am.

How can I do a vacuum analyze from within embedded sql in a c program
that works?

Thanks for your help!

Lynn Tilby
lt****@asu.e du

************** *************** ** PROGRAM *************** *************** **
#include <stdlib.h>
#include <ctype.h>

EXEC SQL INCLUDE sqlca; /* include the sql debugging stuff... */

/********* !!!!!!!!!! POSTGRES SQL DEBUGGING STRUCTURE FIELDS ************/
#define DEBUG_SQL printf("sqlcaid = %s\n", sqlca.sqlcaid); printf("sqlabc =
%f\n", sqlca.sqlabc); printf("sqlcode = %f\n", sqlca.sqlcode);
printf("sqlca. sqlerrm.sqlerrm l = %d\n", sqlca.sqlerrm.s qlerrml);
printf("sqlca. sqlerrm.sqlerrm c = %s\n", sqlca.sqlerrm.s qlerrmc); printf("sqlerrp
= %s\n", sqlca.sqlerrp); printf("sqlerrd = %f\n", sqlca.sqlerrd); printf("sqlext
= %s\n", sqlca.sqlext);

int main()
{

EXEC SQL BEGIN DECLARE SECTION; /* declare the variables used by sql */

EXEC SQL END DECLARE SECTION; /* declare the variables used by sql */

EXEC SQL CONNECT TO pma;
EXEC SQL WHENEVER sqlerror sqlprint; /* turn on verbose sql error ckg */

DEBUG_SQL
EXEC SQL VACUUM ANALYZE optn_cent_xref;
DEBUG_SQL
}

************** *************** ** OUTPUT *************** *************** **

[lynn@polaris strdl_sim]$ ./vrfy_prob
sqlcaid = SQLCA Ś
sqlabc = -1.998680
sqlcode = -1.998680
sqlca.sqlerrm. sqlerrml = 0
sqlca.sqlerrm. sqlerrmc =
sqlerrp = NOT SET
sqlerrd = -1.998680
sqlext =
sql error Postgres error: ERROR: VACUUM cannot run inside a BEGIN/END block
line 23.
sqlcaid = SQLCA Ś
sqlabc = -1.998680
sqlcode = -1.998681
sqlca.sqlerrm. sqlerrml = 76
sqlca.sqlerrm. sqlerrmc = Postgres error: ERROR: VACUUM cannot run inside a
BEGIN/END block
line 23.
sqlerrp = 23.
sqlerrd = -1.998680
sqlext =
[lynn@polaris strdl_sim]$
---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings


--
Command Prompt, Inc., home of Mammoth PostgreSQL - S/ODBC - S/JDBC
Postgresql support, programming, shared hosting and dedicated hosting.
+1-503-222-2783 - jd@commandpromp t.com - http://www.commandprompt.com
PostgreSQL.Org - Editor-N-Chief - http://www.postgresql.org

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #2
Joshua D. Drake wrote:
Hello,

I might be wrong on this but I think that ecpg using transactions by
default for each query.
Perhaps turning on autocommit?


Yep, use:

EXEC SQL SET AUTOCOMMIT = ON;

--
Bruce Momjian | http://candle.pha.pa.us
pg***@candle.ph a.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

http://archives.postgresql.org

Nov 12 '05 #3
On Sat, Nov 15, 2003 at 11:31:08PM -0500, Bruce Momjian wrote:
I might be wrong on this but I think that ecpg using transactions by
default for each query.
Perhaps turning on autocommit?


Yep, use:

EXEC SQL SET AUTOCOMMIT = ON;


Or use 'ecpg -t'.

Michael
--
Michael Meskes
Email: Michael at Fam-Meskes dot De
ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: me****@jabber.o rg
Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 12 '05 #4

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

Similar topics

2
2337
by: Thierry Missimilly | last post by:
Hi, I'm not sure it's a bug or it's normal, so i don't send it to pgsq-bugs. Well, i have written pgbench in PRO*C to have a common pgbench.pgc source for Postgres and Oracle. However, there are some differences between the Postgres Pro*c and Oracle Pro*c. So, i use #ifdef ORACLE #else #endif preprocessing instructions to
3
2626
by: Carmen Gloria Sepulveda Dedes | last post by:
Hello. I have a problem with ecpg precompiler. In a code like: **** main() { .... some calls to EXEC SQL
5
8129
by: Carmen Gloria Sepulveda Dedes | last post by:
Hello! Can I execute VACUUM ANALYZE from ecpg? How I do that??? /* I do: EXEC SQL VACUUM ANALYZE <table>; But I get error: 'ERROR: VACUUM cannot run inside a transaction block'
3
1401
by: Lynn.Tilby | last post by:
I am running 7.1.3... The docs for ecpg in 7.1.3 don't have the -e option in them! YET, ecpg -e WORKS!!! for solving the vacuum problem. Just WHAT does the -e option in ecpg do???? Thanks for the info... Lynn
0
1155
by: Lynn.Tilby | last post by:
I am running 7.1.3 at the moment and upgrading in the near future. I am noticing that some cursor declare statements are commented out in the .c after running the ecpg pre-processor with no error message or explanation from ecpg. It took me a while to figure this out when I got the 'cursor does not exist' message during execution. The...
1
349
by: George Gensure | last post by:
I wanted to ask this on here before going any further. I've got functions that return rowsets, which from the psql shell require me to write selects with AS TBL( ... ) to define the return types. When I try to put a query together in ECPG to get values from these functions, I discovered some nasty ecpg behavior. EXEC SQL SELECT * FROM...
0
2684
by: Christian Rank | last post by:
Today I ran into problems when combining a C program with SQL statements with the ECPG interface of PostgreSQL: According to the documentation, it should be possible with EXEC SQL WHENEVER NOT FOUND action to trigger an action when a query does not return a row. This does not seem to function. Here is the C program I tested: ...
0
1385
by: Valerie Schneider DSI/DEV | last post by:
Hi, I have a set of libraries and C/C++ programs with embedded access to a PG database. I'm using ecpg. I'm working on a Linux RedHat9 platform. Until now I was in PG 7.4.2 : $ ecpg --version ecpg (PostgreSQL 7.4.2) 3.1.1 $ g++ --version g++ (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
1
1580
by: Richard Connamacher | last post by:
I was looking through the docs, ECPG looks like a great tool for developing client applications. Anyone know if it's possible to set it up for use with Objective C in XCode on Mac OS X? XCode allows you to set your own custom build tool, which I could replace with a shell script that calls ecpg, saves a converted file, which it then passes...
0
7609
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...
0
7921
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. ...
0
8118
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...
1
7666
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...
0
6278
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
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...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
936
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...

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.