~myodbc-developers/myodbc/dsn-upgrade-util

« back to all changes in this revision

Viewing changes to installer/myodbc3i.c

  • Committer: Jess Balint
  • Date: 2008-11-04 21:41:34 UTC
  • Revision ID: jbalint@mysql.com-20081104214134-v3intkbzuqc3cx8a
add DSN upgrade utility

Show diffs side-by-side

added added

removed removed

Lines of Context:
521
521
 
522
522
 
523
523
/*
524
 
 * Handler for "remove data source" command (-s -r -n drivername)
525
 
 */
526
 
int remove_datasource(DataSource *ds)
527
 
{
528
 
  /*
529
 
     First check that it exists, because SQLRemoveDSNFromIni
530
 
     returns true, even if it doesn't.
531
 
   */
532
 
  if (ds_exists(ds->name))
533
 
  {
534
 
    fprintf(stderr, "[ERROR] Data source doesn't exist\n");
535
 
    return 1;
536
 
  }
537
 
 
538
 
  if (SQLRemoveDSNFromIniW(ds->name) != TRUE)
539
 
  {
540
 
    print_installer_error();
541
 
    return 1;
542
 
  }
543
 
 
544
 
  printf("Success\n");
545
 
 
546
 
  return 0;
547
 
}
548
 
 
549
 
 
550
 
/*
551
524
 * Handle driver actions. We setup a data source object to be used
552
525
 * for all actions. Config/scope set+restore is wrapped around the
553
526
 * action.
602
575
    }
603
576
    break;
604
577
  case ACTION_REMOVE:
605
 
    rc= remove_datasource(ds);
 
578
    if (!(rc= ds_remove(ds->name)))
 
579
      printf("Success\n");
 
580
    else
 
581
      print_installer_error();
606
582
    break;
607
583
  }
608
584