Skip to content
This repository has been archived by the owner on Jan 3, 2022. It is now read-only.

Commit

Permalink
Fixing an issue on service resolution preventing the creation of the …
Browse files Browse the repository at this point in the history
…TableCellCache instance (and preventing cache, slowing performances)
  • Loading branch information
tsutomi committed May 4, 2016
1 parent 85ee231 commit 13e1c0e
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/deveeldb-nunit/Deveel.Data.Client/DbCommandTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public sealed class DbCommandTest : ContextBasedTest {
command.Parameters.Add(22);

var result = command.ExecuteScalar();

Assert.IsNotNull(result);
Assert.IsInstanceOf<int>(result);
Assert.AreEqual(22, result);
Expand Down
9 changes: 9 additions & 0 deletions src/deveeldb-nunit/Deveel.Data/ShowTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@ public sealed class ShowTests : ContextBasedTest {

Assert.AreEqual("APP", schemaName);
Assert.AreEqual("DEFAULT", schemaType);

Assert.DoesNotThrow(() => row = result.ElementAt(1));
Assert.IsNotNull(row);

schemaName = row.GetValue(0).Value.ToString();
schemaType = row.GetValue(1).Value.ToString();

Assert.AreEqual("INFORMATION_SCHEMA", schemaName);
Assert.AreEqual("SYSTEM", schemaType);
}

[Test]
Expand Down
6 changes: 3 additions & 3 deletions src/deveeldb/Deveel.Data.Caching/TableCellCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public sealed class TableCellCache : ITableCellCache, IDisposable {

public const int DefaultMaxCellSize = 1024*64;

public TableCellCache(IContext context) {
public TableCellCache(ISystemContext context) {
Configure(context);
}

Expand All @@ -45,7 +45,7 @@ public sealed class TableCellCache : ITableCellCache, IDisposable {

public int MaxCellSize { get; private set; }

public IContext Context { get; private set; }
public ISystemContext Context { get; private set; }

public long Size {
get {
Expand Down Expand Up @@ -73,7 +73,7 @@ public sealed class TableCellCache : ITableCellCache, IDisposable {
size -= value;
}

private void Configure(IContext context) {
private void Configure(ISystemContext context) {
var config = context.ResolveService<IConfiguration>();
var hashSize = DefaultHashSize;
var maxSize = config.GetInt32("system.tableCellCache.maxSize", DefaultMaxSize);
Expand Down
21 changes: 0 additions & 21 deletions src/deveeldb/Deveel.Data.Routines/SystemFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -383,26 +383,5 @@ public static class SystemFunctions {
var s = String.Join(", ", array);
return Field.String(s);
}

//internal static Field HasPrivilege(Field priv, Field arg) {
// var privileges = ToPrivileges(priv);
// var other = ToPrivileges(arg);
// return Field.Boolean((privileges & other) != 0);
//}

//private static Privileges ToPrivileges(Field value) {
// Privileges priv;
// if (value.Type is StringType) {
// var s = value.Value.ToString();
// priv = (Privileges)Enum.Parse(typeof(Privileges), s, true);
// } else if (value.Type is NumericType) {
// var i = ((SqlNumber)value.Value).ToInt32();
// priv = (Privileges)i;
// } else {
// throw new ArgumentException(String.Format("Invalid argument of type '{0}' in HASPRIV", value.Type));
// }

// return priv;
//}
}
}
6 changes: 0 additions & 6 deletions src/deveeldb/Deveel.Data.Routines/SystemFunctionsProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -473,12 +473,6 @@ class DistinctComparer : IComparer<int> {
.WhenExecute(context => Simple(context, args => SystemFunctions.PrivilegeString(args[0])))
.ReturnsString());

//Register(config => config.Named("haspriv")
// .WithDynamicParameter("priv")
// .WithDynamicParameter("other")
// .WhenExecute(context => Simple(context, args => SystemFunctions.HasPrivilege(args[0], args[1])))
// .ReturnsBoolean());

// VERSION
Register(config => config
.Named("version")
Expand Down

0 comments on commit 13e1c0e

Please sign in to comment.