Example #1
0
void main(void)
{
	EA = 0;
	t0_init();
	t1_init();
	init_t2(100000);

	EA = 1;
	for (;;)
	{
		process();
		display();
	}
}
Example #2
0
int
main (int argc, char ** argv)
{
  char* uid = "dba", * pwd = "dba";

  if (argc < 2) {
    printf ("Usage: scroll dsn delete-n [user] [password]\n");
    exit (1);
  }

  if (argc > 2) {
    uid = argv [3];
    pwd = argv [4];
  }

  SQLAllocEnv (& henv);
  SQLAllocConnect (henv, &hdbc1);
  SQLAllocConnect (henv, &hdbc2);

  if (SQL_ERROR == SQLConnect (hdbc1, (UCHAR *) argv [1], SQL_NTS,
			       (UCHAR *) uid, SQL_NTS,
			       (UCHAR *) pwd, SQL_NTS)) {
    print_error (SQL_NULL_HENV, hdbc1, SQL_NULL_HSTMT);
    exit (1);
  }
  if (SQL_ERROR == SQLConnect (hdbc2, (UCHAR *) argv [1], SQL_NTS,
			       (UCHAR *) uid, SQL_NTS,
			       (UCHAR *) pwd, SQL_NTS)) {
    print_error (SQL_NULL_HENV, hdbc2, SQL_NULL_HSTMT);
    exit (1);
  }

  t1_init ();

  tsc_lock (SQL_CURSOR_DYNAMIC);

  tsc_bm (SQL_CURSOR_STATIC, 0, 1);
  tsc_bm (SQL_CURSOR_KEYSET_DRIVEN, 5, 1);
  tsc_bm (SQL_CURSOR_KEYSET_DRIVEN, 0, 1);
  tsc_bm (SQL_CURSOR_DYNAMIC, 0, 1);

  tsc_values (SQL_CURSOR_DYNAMIC);
  tsc_values (SQL_CURSOR_KEYSET_DRIVEN);

  tsc_pos (SQL_CURSOR_KEYSET_DRIVEN, T1_BASE_TEXT);
  tsc_pos (SQL_CURSOR_DYNAMIC, T1_BASE_TEXT);

#if 0
  tsc_co (SQL_CURSOR_DYNAMIC, 0, SQL_AUTOCOMMIT_ON);
  tsc_co (SQL_CURSOR_DYNAMIC, 0, 0);
  tsc_co (SQL_CURSOR_FORWARD_ONLY, 0, 0);
#endif

  tsc_fwd ();

  tsc_scroll (SQL_CURSOR_STATIC, 0, 1, 0, 2,
	      T1_BASE_TEXT);
  tsc_scroll (SQL_CURSOR_DYNAMIC, 0, 1, 0, 2,
	      T1_BASE_TEXT);
  tsc_scroll (SQL_CURSOR_DYNAMIC, 0, 0, 0, 2,
	      T1_BASE_TEXT);


  tsc_scroll (SQL_CURSOR_KEYSET_DRIVEN, 7, 1, 0, 2,
	      T1_BASE_TEXT);
  tsc_scroll (SQL_CURSOR_KEYSET_DRIVEN, 5, 1, 0, 2,
	      T1_BASE_TEXT);
  tsc_scroll (SQL_CURSOR_KEYSET_DRIVEN, 2000, 1, 0, 2,
	      T1_BASE_TEXT);

  tw_exec (&tw1, "delete from T1");
  t1_lines (&tw1, 0, 1100, 100);
  tsc_readtable (SQL_CURSOR_STATIC,0,1,0,2,T1_BASE_TEXT);
  tsc_readtable (SQL_CURSOR_DYNAMIC,0,1,0,2,T1_BASE_TEXT);


/*
  tsc_update (SQL_CURSOR_KEYSET_DRIVEN, SQL_CONCUR_VALUES,
	      T1_BASE_TEXT);
  */

  tsc_commit_cursor (&tw1, SQL_CURSOR_FORWARD_ONLY, SQL_COMMIT);
  tsc_commit_cursor (&tw2, SQL_CURSOR_FORWARD_ONLY, SQL_ROLLBACK);
  tsc_commit_cursor (&tw1, SQL_CURSOR_STATIC,  SQL_COMMIT);
  tsc_commit_cursor (&tw1, SQL_CURSOR_STATIC,  SQL_ROLLBACK);
  tsc_commit_cursor (&tw1, SQL_CURSOR_DYNAMIC, SQL_COMMIT);
  tsc_commit_cursor (&tw2, SQL_CURSOR_DYNAMIC, SQL_ROLLBACK);

  printf ("========== SCROLL TEST COMPLETE\n");

  SQLDisconnect (hdbc1);
  SQLDisconnect (hdbc2);
  SQLFreeConnect (hdbc1);
  SQLFreeConnect (hdbc2);

  return 0;
}
Example #3
0
inline void _t1_start(byte pre_scale){
	t1_init();
	TCCR1B |= pre_scale; //set prescale
}