-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserial.cpp
More file actions
37 lines (35 loc) · 1.06 KB
/
serial.cpp
File metadata and controls
37 lines (35 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "serial.h"
#include <QtSql>
Serial::Serial()
{
}
void Serial::addEntry(QString newTitle, QString newKey, QString newNotes,QString gID, QString id)
{
//Validation Required!!!!
title=newTitle;key=newKey;notes=newNotes;dbID=id;groupID=gID;
QSqlQuery entry;
entry.prepare("insert into serials(title,serialKey,dbID,notes,groupID) values('"+title+"','"+key+"','"+dbID+"','"+notes+"','"+groupID+"')");
if(entry.exec())
{
qDebug()<<"Serial entry added...";
}
else
{
qDebug()<<"Serial entry not added"<<entry.lastError().text();
}
}
void Serial::editEntry(QString newTitle, QString newKey,QString newNotes, QString id)
{
//validation required!!!!!!
title=newTitle; key=newKey;notes=newNotes;keyID=id;
QSqlQuery edit;
edit.prepare("update serials set title='"+title+"',serialKey='"+key+"',notes='"+notes+"' where keyID='"+keyID+"'");
if(edit.exec())
{
qDebug()<<"Serial Key Entry edited...";
}
else
{
qDebug()<<"Serial Key Entry not edited..."<<edit.lastError().text();
}
}