
  ** 3.0   static _SQCURSOR _SQ1;
           static struct sqlda *q_desc;

  ** 4.0   static _SQCURSOR _SQ2, _SQ1;

  ** 5.0   extern _SQCURSOR *_iqnprep();
           static _SQCURSOR *_SQ2 = 0;
           static _SQCURSOR *_SQ1 = 0;

$database data;
    ** 3.0     {   static char *_sqlcmdtxt[] = { "                            ", 0};
	           static _SQSTMT _SQ0 = {0};
                   strcpy( _sqlcmdtxt[0], " database ");
                   strcat( _sqlcmdtxt[0], argv[1]);
	           _iqstmt( &_SQ0, _sqlcmdtxt, 0, (char *)0, (char *)0);
               }
    ** 4.0     { _iqdatabase("data", 0, 0, (char *) 0); }
    ** 5.0     { _iqdbase("data", 0); }

$prepare  q_id  from $q_string;
    ** 3.0     {_iqprepare( &_SQ1, q_string);} 

    ** 4.0     { _iqprepare(&_SQ1, q_string); }
    ** 5.0     { _SQ1 = _iqnprep("q_id", q_string, 0); }
$describe   q_id into q_desc;
    ** 3.0     {_iqdescribe( &_SQ1, &q_desc);} 
    ** 4.0     { _iqdscribe(&_SQ1, &q_desc); }
    ** 5.0     { if (!_SQ1) _SQ1 = _iqlocate_cursor("q_id", 1, 1, 0);
                 _iqdescribe(_SQ1, &q_desc, (char *) 0); }
$declare democursor cursor for q_id; 
    ** 3.0     {_iqdyndcl( &_SQ1, "q_cursor");}  
    ** 4.0     { _iqddclcur(&_SQ1, "democursor", 0); }
    ** 5.0     { if (!_SQ2) _SQ2 = _iqlocate_cursor("dempcursor", 0, 0, 0);
                 if (!_SQ1) _SQ1 = _iqlocate_cursor("q_id", 1, 1, 0);
                 _iqcddcl(_SQ2, "democursor", _SQ1, 0); }

$open democursor;
    ** 3.0     {_iqopen( &_SQ1, 0, (char *)0, (char *)0, (char *)0, 0);}
    ** 4.0     { _iqcopen(&_SQ1, 0, (char *) 0, (char *) 0, (char *) 0, 0); }
    ** 5.0     { if (!_SQ2) _SQ2 = _iqlocate_cursor("democursor", 0, 1, 0);
                 _iqdcopen(_SQ2, (struct sqlda *)0, (char *)0, (char *)0, 0); }
$fetch NEXT democursor using descriptor q_desc;
    ** 3.0     {_iqfetch( &_SQ1, mode, (char *)0, q_desc);} 
    ** 4.0     { _iqnftch(&_SQ1, 0, (char *) 0, q_desc, 1, (long) 0, 0, (char *) 0, (char *) 0, 0); }
    ** 5.0     { static _FetchSpec _FS0 = { 0, 1, 0 };
                 if (!_SQ2) _SQ2 = _iqlocate_cursor("democursor", 0, 1, 0);
                 _iqcftch(_SQ2, (struct sqlda *)0, q_desc, (char *)0, &_FS0); }
$close democursor;
    ** 3.0     {_iqclose( &_SQ1);} 
    ** 4.0     { _iqclose(&_SQ1); }
    ** 5.0     { if (!_SQ2) _SQ2 = _iqlocate_cursor("democursor", 0, 1, 0);
                 _iqclose(_SQ2); }

$close database;
    ** 3.0     { static char *_sqlcmdtxt[] = { "close database    ", 0};
         	 static _SQSTMT _SQ0 = {0};
	             _iqstmt( &_SQ0, _sqlcmdtxt, 0, (char *)0, (char *)0);
                 }
    ** 4.0     { _iqdbclose(); }
    ** 5.0     { _iqdbclose(); }





$execute q_id;
  ** 4.0       { _iqxecute(&_SQ1, 0, (char *) 0, (char *) 0, (char *) 0); }
  ** 5.0       { if (!_SQ1) _SQ1 = _iqlocate_cursor(_Cn1, 1, 1, 0);
                _iqexecute(_SQ1, (char *)0, (char *)0, (char *)0); }


$update customer set * =  (0, "field1", "field2", "field3")
          where current of democursor;

   ** 4.0   {
 static char *sqlcmdtxt[] =
    {
   " update customer set * = ( 0 , \"field1\" , \"field2\" , \"field3\" )",
   " where current of democursor",
  (char *) 0
       };
 static _SQSTMT _SQ0 = {0};
 _iqstmnt(&_SQ0, sqlcmdtxt, 0, (char *) 0, (char *) 0);
 }
}

 ** 5.0   {
  static char *sqlcmdtxt[] =
    {
    " update customer set * = ( 0 , 'field1' , 'field2' , 'field3' ) where current of democursor",
    0
    };
  static _SQSTMT _SQ0 = {0};
  _iqstmnt(&_SQ0, sqlcmdtxt, 0, (char *)0, (char *)0);
  }
