예제 #1
0
        public override async void Process(SqlServer server)
        {
            SqlPacket packet = await DatabaseManager.GetDataAs2DArray(Query, ExpectedColumns);

            ApiResponse response;

            if (packet.Success)
            {
                string[][] result = (string[][])packet.Data;
                response = Sql2DArrayResponse.Create(result);
            }
            else
            {
                response = SqlErrorResponse.Create(packet.ErrorMessage);
            }
            SerializedSqlApiResponse serializedApiResponse = SerializedSqlApiResponse.Create(response);
            string data = serializedApiResponse.Serialize();

            server.Network.Send(data);
        }
예제 #2
0
        public override void Process(ApiServer server)
        {
            if (server.AssertServerSetup(this) || server.AssertUserOnline())
            {
                return;
            }
            using DatabaseManager databaseManager = new DatabaseManager(server);
            string             query              = "SELECT hid FROM Tbl_event" + (IncludeExpired ? string.Empty : " WHERE expires > " + DatabaseEssentials.GetTimeStamp().ToString()) + ";";
            SqlApiRequest      sqlRequest         = SqlApiRequest.Create(SqlRequestId.Get2DArray, query, 1);
            Sql2DArrayResponse sql2DArrayResponse = databaseManager.Await2DArrayResponse(sqlRequest, out bool success);

            if (!success)
            {
                return;
            }
            GetAllEventsResponse  response = new GetAllEventsResponse(ResponseId.GetAllEvents, sql2DArrayResponse.Result);
            SerializedApiResponse serializedApiResponse = SerializedApiResponse.Create(response);
            string json = serializedApiResponse.Serialize();

            server.Send(json);
            server.UnitTesting.MethodSuccess = true;
        }