SQExplain
Posted in 1999
Topics: Performance & Tuning, Connectivity: ESQL/C, 4GL & Embedded SQL
I was wondering if someone could do a favor for me. I would like a quick esql/c program that would simply prepare an SQL and then exit. The reason for this is I would like to get an sqexplain file without having to run a lengthy query (I realize you can _Sometimes_ stop it early on). I figured this would be a pretty easy program, the problem is I haven't ever used ESQL/C. TIA -- Rob Wilson
ESQL/C for what system? Unix or Windows32 bit? Rob Wilson wrote: > I was wondering if someone could do a favor for me. I would like a quick > esql/c program that would simply prepare an SQL and then exit. The reason for > this is I would like to get an sqexplain file without having to run a lengthy > query (I realize you can _Sometimes_ stop it early on). I figured this > would be a pretty easy program, the problem is I haven't ever used ESQL/C. > > TIA > > -- > Rob Wilson -- Mit freundlichen Grüßen / with best regards :-) -\\|/- )ø^o( +=========oOOo==(_)==oOOo=======Mail-Client: Netscape V4.5==+ | Ernst Sauerwein Siemens ITService GmbH & Co. oHG| | =============== ISC-D 144 | | Microsoft Certified OLTP-Systems | | Professional INFORMIX® Database Support | | Tel: +49 89 3601 2699 Area South Europe | | FAX: +49 89 3601 2402 Berliner Str.95,III/C190-193 | | NERV: mailto:sauerwein.muc@sni.de | | EMAIL: mailto:ernst.sauerwein@mch.siemens.de | | EMAIL: mailto:ernsts@informix.com | | FTP: ftp://ftp.mch.sni.de/ (external) | | ftp://MB184060.mch.sni.de/ (internal) | | WWW: http://its.mch.sni.de/ (external) | | http://MB184060.mch.sni.de/ (internal) | +===========================================================+
Well, I am currently in a role that supports a few hundred instances. Mostly we're running on AIX, NT, and Solaris. We have almost every version of ESQL/C and the engine (post 5.0), so whatever is available to you should be fine for me. Again, thanks in advance. Ernst Sauerwein (ernst@mb184060.mch.sni.de) wrote: : This is a multi-part message in MIME format. : --------------C81282C33A9312041E78381A : Content-Type: text/plain; charset=iso-8859-1 : Content-Transfer-Encoding: 8bit : ESQL/C for what system? Unix or Windows32 bit? : Rob Wilson wrote: : > I was wondering if someone could do a favor for me. I would like a quick : > esql/c program that would simply prepare an SQL and then exit. The reason for : > this is I would like to get an sqexplain file without having to run a lengthy : > query (I realize you can _Sometimes_ stop it early on). I figured this : > would be a pretty easy program, the problem is I haven't ever used ESQL/C. : > : > TIA : > : > -- : > Rob Wilson : -- : Mit freundlichen Gr''en / with best regards :-) : -\\|/- : )'^o( : +=========oOOo==(_)==oOOo=======Mail-Client: Netscape V4.5==+ : | Ernst Sauerwein Siemens ITService GmbH & Co. oHG| : | =============== ISC-D 144 | : | Microsoft Certified OLTP-Systems | : | Professional INFORMIX' Database Support | : | Tel: +49 89 3601 2699 Area South Europe | : | FAX: +49 89 3601 2402 Berliner Str.95,III/C190-193 | : | NERV: mailto:sauerwein.muc@sni.de | : | EMAIL: mailto:ernst.sauerwein@mch.siemens.de | : | EMAIL: mailto:ernsts@informix.com | : | FTP: ftp://ftp.mch.sni.de/ (external) | : | ftp://MB184060.mch.sni.de/ (internal) | : | WWW: http://its.mch.sni.de/ (external) | : | http://MB184060.mch.sni.de/ (internal) | : +===========================================================+ -- Rob Wilson
Ernst Sauerwein wrote: > > ESQL/C for what system? Unix or Windows32 bit? > > Rob Wilson wrote: > > > I was wondering if someone could do a favor for me. I would like a quick > > esql/c program that would simply prepare an SQL and then exit. The reason for > > this is I would like to get an sqexplain file without having to run a lengthy > > query (I realize you can _Sometimes_ stop it early on). I figured this > > would be a pretty easy program, the problem is I haven't ever used ESQL/C. ----------------------------------------------------------------------- EXEC SQL INCLUDE sqlca; EXEC SQL INCLUDE sqltypes; int main( int argc, char **argv ) { int beginOK=0, commitOK=0; EXEC SQL BEGIN DECLARE SECTION; string statement[4096], datab[100]; EXEC SQL END DECLARE SECTION; fprintf( stderr, "Enter database: " ); fgets( datab, 100, stdin ); EXEC SQL DATABASE :datab; if (sqlca.sqlcode < 0) { fprintf( stderr, "Cannot open database: %s.\\n", datab ); exit(1); } commitOK = (sqlca.sqlwarn.sqlwarn1 == 'W'); beginOK = (commitOK && sqlca.sqlwarn.sqlwarn2 != 'W'); fprintf( stderr, "Enter statement: \\n> " ); fgets( statement, 4096, stdin ); EXEC SQL SET EXPLAIN ON; if (beginOK) EXEC SQL BEGIN WORK; EXEC SQL PREPARE stmt FOR :statement; if (commitOK) EXEC SQL ROLBACK WORK; EXEC SQL CLOSE DATABASE; } ---------------------------------------------------------------------- Obviously this can be enhanced to accept multi-line input etc. Art S. Kagel
Related threads
- Conversion to differeent characters sets
- Problem in changing locale via dbexport/dbimport
- RE: openlink error "Unable to load locale categories"