示例#1
0
int main(int argc, char * *argv) {
	int index = my_get_opt(argc, argv);
	

	//parameter
	char * table = argv[index];
	char * action = argv[index+1];
	
	struct DatabaseConfig config;
	config.server = "localhost";
	config.database = "mytable";
	config.table = table;

	FooOBJ fobj;
	fobj=newFooOBJ(config); /* create a new object of type "FooOBJ" */
	
	memset(username,0,SIZE);
	memset(password,0,SIZE);

	/*read config*/
	if(!readConfig()){
		fprintf(stderr,"read config fail!");
		return 1;
	}
	
	
	
	/* Change me */
	char * server = "localhost";
	char * database = "mytable";

	//use oop db connection
	connetDatabase(fobj, username, password);
	if( strcmp(action,"list") == 0 ){
		listData(fobj);
	}
	if( strcmp(action,"add") == 0 ){
		addData(fobj, argv[index+2]);
	}
	if( strcmp(action,"del") == 0 ){
		delData(fobj, atoi(argv[index+2]));		
	}
	if( strcmp(action,"update") == 0 ){
		updateData(fobj, atoi(argv[index+2]), argv[index+3]);
	}
	
	closeConnection(fobj);
	
	deleteFooOBJ(fobj);

	return 0;
}
示例#2
0
文件: seie.c 项目: Zaukey/SchoolDB
void Del()
{
	String del;
	del=(String)malloc(STLEN);
	puts("削除する出席番号を入力してください");
	printf("→");
	scanf("%s",del);
	fflush(stdin);
	delData(atoi(del));
	printf("No%sのデータを削除しました\n",del);
	Closer();
	puts("出席番号を詰めました");
	Rank();
	preno--;
}
示例#3
0
//-----------------------------------------------------------------------------
MemPanel::MemPanel(QWidget *parent) : QWidget(parent)
{
	QHBoxLayout *h;
	QVBoxLayout *v;
	QToolButton *b;

	infoDlg = new InfoDialog(this);
	infoDlg->setModal(true);	infoDlg->allowRefresh=false;

	v = new QVBoxLayout(this);	h = new QHBoxLayout();	v->addLayout(h);
	b = new QToolButton(this);	b->setIcon(QPixmap(":/png/document-new.png"));
	b->setToolTip(tr("Create new data array"));		h->addWidget(b);
	connect(b, SIGNAL(clicked()), this, SLOT(newTable()));
	b = new QToolButton(this);	b->setIcon(QPixmap(table_xpm));
	b->setToolTip(tr("Edit selected data array"));	h->addWidget(b);
	connect(b, SIGNAL(clicked()), this, SLOT(editData()));
	b = new QToolButton(this);	b->setIcon(QPixmap(":/png/edit-delete.png"));
	b->setToolTip(tr("Delete selected data array"));		h->addWidget(b);
	connect(b, SIGNAL(clicked()), this, SLOT(delData()));
	b = new QToolButton(this);	b->setIcon(QPixmap(preview_xpm));
	b->setToolTip(tr("Properties of selected data array"));	h->addWidget(b);
	connect(b, SIGNAL(clicked()), this, SLOT(infoData()));
	b = new QToolButton(this);	b->setIcon(QPixmap(":/png/view-refresh.png"));
	b->setToolTip(tr("Update list of data arrays"));		h->addWidget(b);
	connect(b, SIGNAL(clicked()), this, SLOT(refresh()));
	h->addStretch(1);
	b = new QToolButton(this);	b->setIcon(QPixmap(":/png/edit-clear.png"));
	b->setToolTip(tr("Delete ALL data arrays"));	h->addWidget(b);
	connect(b, SIGNAL(clicked()), this, SLOT(delAllData()));

	colSort = 0;
	tab = new QTableWidget(this);	tab->setColumnCount(3);	v->addWidget(tab);
	QStringList sl;	sl<<tr("Name")<<tr("Sizes")<<tr("Memory");
	tab->setHorizontalHeaderLabels(sl);
	connect(tab, SIGNAL(cellClicked(int,int)), this, SLOT(tableClicked(int,int)));
	connect(tab, SIGNAL(cellDoubleClicked(int,int)), this, SLOT(tableDClicked(int,int)));

	setWindowTitle(tr("Memory"));
}
////////////////////////////////////////////////////////////
//        NAME: chkCurId()
// DESCRIPTION: init.
//   ARGUMENTS: None.
//     RETURNS: None.
//      AUTHOR: Chensi
//        DATA: 2012-2-22
////////////////////////////////////////////////////////////
bool QGenieTray_Communication_Verify::chkCurId(int session)
{
    bool bRet = delData(session);
    return bRet;
}
示例#5
0
VolumeWrap::~VolumeWrap()
{
    virStorageVolFree(_volume_ptr);

    delData(_data);
}
示例#6
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    setWindowTitle(tr("Title"));
    setWindowIcon(QIcon(":/icons/icon.png"));

    ui->lineEdit->setPlaceholderText(tr("Search"));
    ui->label->setPixmap(QPixmap(":/icons/about.jpg"));
    ui->label_2->setTextFormat(Qt::RichText);
    ui->label_2->setText("<h3>Зроблена Яремчуком Олександром</h3>");
    ui->toolButton->setIcon(QPixmap(":/icons/back.png"));
    ui->pushButton->setIcon(QPixmap(":/icons/add.png"));
    ui->toolButton->setHidden(true);

    ui->pushButton_2->setToolTip("Відкрити файл довідки");
    ui->pushButton_2->setText("Довідка");

    ui->pushButton->setToolTip("Натисніть, щоб додати новий елемент");
    ui->lineEdit->setToolTip("Починайте вводити слово для пошуку потрібного елемента.");

    QShortcut *helpShortcut = new QShortcut(QKeySequence("F1"), this);
    QObject::connect(helpShortcut, SIGNAL(activated()), ui->pushButton_2, SLOT(animateClick()));

    QShortcut *addShortcut = new QShortcut(QKeySequence("Ctrl+a"), this);
    QObject::connect(addShortcut, SIGNAL(activated()), ui->pushButton, SLOT(animateClick()));

    listView = new QListView(this);
    ui->catTab->layout()->addWidget(listView);
    listView->setContextMenuPolicy(Qt::ActionsContextMenu);
    connect(listView, SIGNAL(doubleClicked(QModelIndex)),this,  SLOT(catalogCliked(QModelIndex)));
    connect(ui->lineEdit, SIGNAL(textChanged(QString)), this, SLOT(search(QString)));

    ui->tabWidget->setTabText(0,tr("Catalog"));
    ui->tabWidget->setTabText(1,tr("About"));
    listView->setEditTriggers(QAbstractItemView::NoEditTriggers);

    QAction *delAct = new QAction(tr("Delete"), this);
    delAct->setIcon(QIcon(":/icons/remove.svgz"));
    QAction *editAct = new QAction(tr("Edit"), this);
    editAct->setIcon(QIcon(":/icons/edit.svgz"));

    connect(delAct, SIGNAL(triggered()), this, SLOT(delData()));
    connect(editAct, SIGNAL(triggered()), this, SLOT(editData()));

    QShortcut *delShortcut = new QShortcut(QKeySequence("Ctrl+d"), this);
    QObject::connect(delShortcut, SIGNAL(activated()), this, SLOT(delData()));

    QShortcut *editShortcut = new QShortcut(QKeySequence("Ctrl+e"), this);
    QObject::connect(editShortcut, SIGNAL(activated()), this, SLOT(editData()));

    listView->addAction(delAct);
    listView->addAction(editAct);

    model = new QStringListModel(this);
    catModel = new QStringListModel(this);
    subModel = new QStringListModel(this);
    comModel = new QStringListModel(this);
    sql = new BaseManager();
    sql->createBase();
    currentPos = 0;

    updateCategory();
}