Re: Motif and Pro*C

From: Alligator Descartes <v_at_istellar.demon.co.uk>
Date: Tue, 14 Jun 1994 18:27:47 +0000
Message-ID: <771618467snz_at_istellar.demon.co.uk>


In article <2tjf6n$1gh_at_sun.cais.com>

           sarek_at_cais.cais.com "Scott T Johnson" writes:

> Hi folks:
>
> I am a programmer with a logistics problem. The project I am working
> on uses Oracle as the database and X-Windows/Motif as the front end.
> At this point, I have written all the Oracle (Pro*C) code in seperate
> modules from the Motif code and passed the data retrieved from Oracle
> back and forth using linked lists. My problem is interacting with the
> Oracle database. I have written a routine to import data from a ASCII
> file and place it into the database. Each record begins with a unique
> ID number. Once I activate the button to import the data, all the data is
> placed into the tables and then control is passed back to the Motif modules.
> I need to be able to stop the import if a duplicate record ID is found and
> prompt the user to ignore or replace the existing record. How do I suspend
> operation of the Oracle module, manage a Warning dialog and return
> return back to the Oracle module based on the user response to the
> Warning dialog.

I've been writing something similar recently ( see XDBA - Abstract post if it's still available ). What you need to do is use the Pro*C error handlers in SQLCA to flag when an error of some type has occurred, then call the function that'll pop up the dialog.

Something like:

void some_bit_of_motif_code( some_error_message )

     char *some_error_message;
{
  /* Popup dialog code here */
}

void main_code()
{
  EXEC SQL INSERT( :val1 ) INTO ( :table_name );

  if ( sqlca.sqlcode == ERROR_VALUE ) /* Whatever ERROR_VALUE is... */     some_bit_of_motif_code( some_error_message ); }

might give you a clue.....Or not!

Hope this helps!

> Thanks,
>
> Scott
 

-- 
Alligator Descartes
v_at_istellar.demon.co.uk
Received on Tue Jun 14 1994 - 20:27:47 CEST

Original text of this message