/*
文件名:Marry_sql.nut
路径:Dps_A/ProjectClass/MarrySystem/Marry_sql.nut
创建日期:2024-10-03	20:57
文件用途:结婚系统数据库命令
*/

MARRY_SQL_LIST <- {};

//查询婚姻状态
MARRY_SQL_LIST.CheckMarryState <- "SELECT state FROM zyk.marry WHERE cid = %d;";
//查询婚姻对象
MARRY_SQL_LIST.CheckMarryTarget <- "SELECT target_cid FROM zyk.marry WHERE cid = %d;";
//查询婚姻对象名字
MARRY_SQL_LIST.CheckMarryTargetName <- "SELECT name FROM zyk.marry WHERE cid = %d;";
//通过cid删除一条婚姻信息
MARRY_SQL_LIST.DeleteMarryInfo <- "DELETE FROM zyk.marry WHERE cid = %d;";
//新增婚姻信息
MARRY_SQL_LIST.InseartMarryInfo <- @"INSERT INTO zyk.marry (cid, name, target_cid, job, level, experience, equip, state)
                            VALUES (%d, '%s', %d, %d, %d, %d,'%s',%d)
                            ON DUPLICATE KEY UPDATE
                            target_cid = %d,
                            equip = '%s',
                            state = %d;";
//通过cid修改婚姻状态
MARRY_SQL_LIST.ChangeMarryState <- "UPDATE zyk.marry SET state = %d WHERE cid = %d;";
//新增礼堂信息
MARRY_SQL_LIST.InsertMarryRoom <- @"INSERT INTO zyk.marry_room (cid, name, time, level, target_cid, target_name, state, rindex)
                            VALUES (%d, '%s', %d, %d, %d, '%s', %d, %d);";


//查询礼堂列表
MARRY_SQL_LIST.GetAuditoriumList <- @"SELECT * FROM zyk.marry_room";

//根据cid查询自己的礼堂编号
MARRY_SQL_LIST.GetAuditoriumIndexById <- @"SELECT target_cid FROM zyk.marry_room WHERE cid =  %d";

//根据cid查询自己的礼堂编号
MARRY_SQL_LIST.GetAuditoriumTimeById <- @"SELECT rindex FROM zyk.marry_room WHERE cid =  %d";

MARRY_SQL_LIST.GetAuditoriumName2ById <- @"SELECT name, FROM zyk.marry_room WHERE cid =  %d or target_cid = %d";

MARRY_SQL_LIST.RomoveRoom <- @"DELETE FROM marry_room where rindex < UNIX_TIMESTAMP();";

