dbTalk Databases Forums  

Does the PRINT command simply not work?

comp.databases.btrieve comp.databases.btrieve


Discuss Does the PRINT command simply not work? in the comp.databases.btrieve forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Fardreamer
 
Posts: n/a

Default Does the PRINT command simply not work? - 09-14-2005 , 01:59 PM






I'm using Pervasive.SQL 8.6 server. I simply can't get a PRINT
statement to work from within a stored procedure. Whenever I run a
procedure with a PRINT, the client application hangs, whether it's a
query window of the PCC ("SQL Data Manager" as it's called), a third
party application, or my own code using the .NET provider.
My goal is to use the PsqlInfoMessageEventHandler to display status and
error messages that I return from my procedures, like the example in
the .NET provider's reference.

I couldn't find any documentation on the issue. Does anyone have
information they could share on the subject?


Reply With Quote
  #2  
Old   
Fardreamer
 
Posts: n/a

Default Re: Does the PRINT command simply not work? - 09-14-2005 , 02:11 PM






I forgot to mention that the server process does not seem to hang, only
the client - the thread on the server terminates successfully.


Reply With Quote
  #3  
Old   
Fardreamer
 
Posts: n/a

Default Re: Does the PRINT command simply not work? - 09-15-2005 , 03:13 PM



Update: So, I went to the database server and logged in as an
administrator. What do I see? 3 message boxes with the title "SSP
PrintVal" showing the three messages I tried to PRINT from my stored
procedure! What kind of weird behavior is that? Is there any way to
disable it?


Reply With Quote
  #4  
Old   
Bill Bach
 
Posts: n/a

Default Re: Does the PRINT command simply not work? - 09-15-2005 , 10:02 PM



Fardreamer wrote:

Quote:
Update: So, I went to the database server and logged in as an
administrator. What do I see? 3 message boxes with the title "SSP
PrintVal" showing the three messages I tried to PRINT from my stored
procedure! What kind of weird behavior is that? Is there any way to
disable it?

This is actually documented behavior -- and mainly useless for
developers. The PRINT function seems to have been solely implemented
to enable debugging, and was designed for the local engine. When you
issue the PRINT command, the dialog box does indeed show up whereever
the engine is located (on the server for a client/server engine).

Want one better? Your procedures did not hang -- they were awaiting
the completion of the PRINT command. If you had simply gone to the
server and clicked OK on the dialog box, it would have proceeded and
terminated normally.

In short, use PRINT **ONLY** for debugging your procs. If you must
return some message, consider building an entry in a Log File somewhere
and having the user view that periodically.
Goldstar Software Inc.
Building on Btrieve(R) for the Future(SM)
Bill Bach
BillBach (AT) goldstarsoftware (DOT) com
http://www.goldstarsoftware.com
*** Chicago: Pervasive.SQL Service & Support - November, 2005 ***
*** Chicago: Pervasive DataExchange Class - November, 2005 ***


Reply With Quote
  #5  
Old   
Fardreamer
 
Posts: n/a

Default Re: Does the PRINT command simply not work? - 09-16-2005 , 10:24 AM



Thanks for the reply. This may be true, but completely in conflict with
the documentation for the .NET provider which is clearly stated as
being for 8.x databases (NOT 9.x). In the following excerpt from the
documentation they show how to generate warnings and capture them in
code:

Retrieving Warning Information
The data providers handle database server warnings through the
InfoMessage delegates on the Connection objects.

The following example shows how to retrieve a warning from a
Pervasive.SQL server:

// Define an event handler
public void myHandler(object sender, PsqlInfoMessageEventArgs e)
{
// Display any warnings in a messagebox
MessageBox.Show (e.Message,"This is a Warning.");
}

Add the following code to a method and call it.

PsqlConnection Conn;
Conn = new PsqlConnection(
"ServerDSN=Demodata; UID=test; PWD=test; Server=localhost;"
);
PsqlCommand DBCmd = new PsqlCommand("print 'This is a Warning.'",
Conn);
PsqlDataReader myDataReader;
try
{
Conn.InfoMessage +=
new PsqlInfoMessageEventHandler(myHandler);
Conn.Open();
myDataReader = DBCmd.ExecuteReader();
// This will throw a PsqlInfoMessageEvent as the print
// statement generates a warning.
}
catch (Exception ex)
{
// Display any exceptions in a messagebox
MessageBox.Show (ex.Message);
}
// Close the connection
Conn.Close();


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.