Исправлено дублирвоание для host записей, добавлены CMake-конфиги FreeRDP
This commit is contained in:
parent
a5434746f5
commit
1514150672
8
db.c
8
db.c
|
@ -252,10 +252,11 @@ int dbAddServer(char *ip, char *dns)
|
||||||
}
|
}
|
||||||
|
|
||||||
sqlite3_stmt *res;
|
sqlite3_stmt *res;
|
||||||
char *sql = "SELECT * FROM `hosts` WHERE `ip` = ?";
|
char *sql = "SELECT * FROM `hosts` WHERE `ip` = ? OR `dns` = ?";
|
||||||
if (sqlite3_prepare_v2(db, sql, -1, &res, 0) == SQLITE_OK)
|
if (sqlite3_prepare_v2(db, sql, -1, &res, 0) == SQLITE_OK)
|
||||||
{
|
{
|
||||||
sqlite3_bind_text(res, 1, ip, -1, 0);
|
sqlite3_bind_text(res, 1, ip, -1, 0);
|
||||||
|
sqlite3_bind_text(res, 2, dns, -1, 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -272,12 +273,13 @@ int dbAddServer(char *ip, char *dns)
|
||||||
sql = "UPDATE `hosts` set `set` = 0";
|
sql = "UPDATE `hosts` set `set` = 0";
|
||||||
if (sqlite3_exec(db, sql, NULL, NULL, NULL) == SQLITE_OK)
|
if (sqlite3_exec(db, sql, NULL, NULL, NULL) == SQLITE_OK)
|
||||||
{
|
{
|
||||||
sql = "UPDATE `hosts` set `dns` = ?, `set` = 1 where id = ?";
|
sql = "UPDATE `hosts` set `dns` = ?, `ip` = ?, `set` = 1 where id = ?";
|
||||||
|
|
||||||
if (sqlite3_prepare_v2(db, sql, -1, &res, 0) == SQLITE_OK)
|
if (sqlite3_prepare_v2(db, sql, -1, &res, 0) == SQLITE_OK)
|
||||||
{
|
{
|
||||||
sqlite3_bind_text(res, 1, dns, -1, 0);
|
sqlite3_bind_text(res, 1, dns, -1, 0);
|
||||||
sqlite3_bind_int(res, 2, id);
|
sqlite3_bind_text(res, 2, ip, -1, 0);
|
||||||
|
sqlite3_bind_int(res, 3, id);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sqlite3_step(res) == SQLITE_BUSY)
|
if (sqlite3_step(res) == SQLITE_BUSY)
|
||||||
|
|
2
gui.c
2
gui.c
|
@ -47,9 +47,9 @@ static int guiConnect(Ihandle *self)
|
||||||
|
|
||||||
// if (free_rdp_connect(args.argc, args.argv) != XF_EXIT_DNS_NAME_NOT_FOUND)
|
// if (free_rdp_connect(args.argc, args.argv) != XF_EXIT_DNS_NAME_NOT_FOUND)
|
||||||
// {
|
// {
|
||||||
dbInsertHistory(login, host);
|
|
||||||
if (!dbAddServer(result, host))
|
if (!dbAddServer(result, host))
|
||||||
{
|
{
|
||||||
|
dbInsertHistory(login, host);
|
||||||
IupSetAttribute(IupGetDialogChild(self, "SERVER"), "APPENDITEM", host);
|
IupSetAttribute(IupGetDialogChild(self, "SERVER"), "APPENDITEM", host);
|
||||||
}
|
}
|
||||||
dbSetUserNameCurrent(login);
|
dbSetUserNameCurrent(login);
|
||||||
|
|
Loading…
Reference in New Issue