public virtual void Test2_ClientServer() { string baseName = GetBaseName(); Println(baseName); string currentEncoding = NeoDatis.Odb.OdbConfiguration.GetDatabaseCharacterEncoding (); NeoDatis.Odb.OdbConfiguration.SetDatabaseCharacterEncoding("ISO8859-5"); NeoDatis.Odb.ODBServer server = null; try { server = NeoDatis.Odb.ODBFactory.OpenServer(NeoDatis.Odb.Test.ODBTest.PORT + 1); server.AddBase(baseName, baseName); server.StartServer(true); Thread.Sleep(200); NeoDatis.Odb.ODB odb = NeoDatis.Odb.ODBFactory.OpenClient("localhost", NeoDatis.Odb.Test.ODBTest .PORT + 1, baseName); string nameWithCyrillicCharacters = "\u0410 \u0430 \u0431 \u0448 \u0429"; NeoDatis.Odb.Test.VO.Login.Function f = new NeoDatis.Odb.Test.VO.Login.Function(nameWithCyrillicCharacters ); NeoDatis.Odb.OID oid = odb.Store(f); odb.Close(); Println(f); odb = NeoDatis.Odb.ODBFactory.OpenClient("localhost", NeoDatis.Odb.Test.ODBTest.PORT + 1, baseName); NeoDatis.Odb.Test.VO.Login.Function f2 = (NeoDatis.Odb.Test.VO.Login.Function)odb .GetObjectFromId(oid); odb.Close(); AssertEquals(nameWithCyrillicCharacters, f2.GetName()); AssertEquals('\u0410', f2.GetName()[0]); AssertEquals('\u0430', f2.GetName()[2]); AssertEquals('\u0431', f2.GetName()[4]); AssertEquals('\u0448', f2.GetName()[6]); AssertEquals('\u0429', f2.GetName()[8]); } finally { NeoDatis.Odb.OdbConfiguration.SetDatabaseCharacterEncoding(currentEncoding); if (server != null) { server.Close(); } } }
/// <exception cref="System.Exception"></exception> public virtual void Step20() { // Create instance NeoDatis.Odb.Test.Tutorial.Sport sport = new NeoDatis.Odb.Test.Tutorial.Sport("volley-ball" ); NeoDatis.Odb.ODB odb = null; NeoDatis.Odb.ODBServer server = null; try { // Creates the server on port 8000 server = OpenServer(8000); // Tells the server to manage base 'base1' that points to the file // tutorial2.odb server.AddBase("base1", OdbName); // Then starts the server to run in background server.StartServer(true); // Open the databse client on the localhost on port 8000 and specify // which database instance odb = OpenClient("localhost", 8000, "base1"); // Store the object odb.Store(sport); } finally { if (odb != null) { // First close the client odb.Close(); } if (server != null) { // Then close the database server server.Close(); } } }
public virtual void AddBase(string baseIdentifier, string fileName) { serverImpl.AddBase(baseIdentifier, fileName); }