Page 1 of 1

how to get the data from server database???

Posted: 09 Dec 2009, 09:44
by liverol
hi there,i am using sfs pro demo+unity3d for a testing mmo project,so far so good,but i got a question:


i created a database using h2 database,i used the h2 database console to create a simple database with a table like this:

id name
0 amy
1 jack
2 bob

also i copied ths internaldb.as extension and modified a little for the my own database!

in unity3d,i just use the sfsisland demo for testing, some test functions:

Code: Select all

....
if(Input.GetKeyDown(KeyCode.LeftControl))
            {
                
Hashtable h=new Hashtable();
                 smartFoxClient.SendXtMessage("myDataBase", "getList",h,SmartFoxClient.XTMSG_TYPE_XML);
            }
...


i can see the "GetResponse" in unity3d console,and here comes the question:
how should i get the right data returnen from server in the delegate?
i tried convert the data to sfsobject but didn't work...
what should i do if i want to get more data from a bigger database??

public void OnExtensionResponse(object data, string type)
{
print("GetResponse!!!");


how to convert the data to a hashtable like object?????
.....
}

thanks for hints!!

Posted: 10 Dec 2009, 08:38
by Lapo
Hi,
data from server to client (and viceversa) is sent via SFSObject, which works as a "neutral" type for transporting data across the network.
Data coming from a database is no exception to this system. Can you show how you are sending your data from server to client?