22 using NUnit.Framework;
24 namespace Deveel.Data.Sql.Objects {
41 using (var streamWriter =
new StreamWriter(stream, encoding)) {
42 streamWriter.Write(text);
65 var obj = CreateLargeObject(2048,
false);
67 Assert.IsNotNull(stringObj);
68 Assert.IsFalse(stringObj.IsNull);
73 const string testLine =
"A simple test string that can span several characters, " +
74 "that is trying to be the longest possible, just to prove" +
75 "the capacity of a LONG VARCHAR to handle very long strings. " +
76 "Anyway it is virtually impossible to reach the maximum size " +
77 "of a long object, that is organized in 64k byte pages and " +
78 "spans within the local system without any constraint of size. " +
79 "For sake of memory anyway, the maximum size of the test object " +
80 "is set to just 2048 bytes.";
82 var obj = CreateLargeObject(2048,
false);
84 WriteToObject(obj, Encoding.Unicode, testLine);
91 Assert.IsNotNull(stringObj);
92 Assert.IsFalse(stringObj.IsNull);
94 obj = GetLargeObject(objId);
95 Assert.IsTrue(obj.IsComplete);
96 Assert.IsFalse(obj.IsCompressed);
99 var reader = stringObj.
GetInput(Encoding.Unicode);
100 Assert.IsNotNull(reader);
103 Assert.DoesNotThrow(() => line = reader.ReadLine());
104 Assert.IsNotNull(line);
105 Assert.IsNotEmpty(line);
107 Assert.AreEqual(testLine, line);
InMemoryStorageSystem storageSystem
ILargeObject CreateLargeObject(long size, bool compressed)
ILargeObject CreateNewObject(long maxSize, bool compressed)
Creates a new large object returning a reference to it.
Defines a referenced object that can be accessed on a multi-phase level.
static SqlLongString Unicode(ILargeObject largeObject)
TextReader GetInput(Encoding encoding)
ILargeObject GetObject(ObjectId id)
Gets an object that was previously created for the given unique identifier.
bool IStoreSystem. DeleteStore(IStore store)
Permanently deletes a store from the system - use with care!
An implementation of IStore that persists data in the application memory.
void WriteAndRead_Unicode()
void WriteToObject(ILargeObject obj, Encoding encoding, string text)
A unique identifier of an object within a database system, that is composed by a reference to the sto...
void Create_Unicode_Uncompressed()
IStore IStoreSystem. CreateStore(string name)
ILargeObject GetLargeObject(ObjectId id)