Skip to content

Commit

Permalink
ignite-sql-tests - throw exception if table not found
Browse files Browse the repository at this point in the history
  • Loading branch information
S.Vladykin committed Feb 25, 2015
1 parent 9ed2a39 commit 03c6702
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 175 deletions.
Expand Up @@ -407,7 +407,7 @@ public <K, V> GridCloseableIterator<IgniteBiTuple<K, V>> query(String space, Str
TypeDescriptor type = typesByName.get(new TypeName(space, resType));

if (type == null || !type.registered())
return new GridEmptyCloseableIterator<>();
throw new CacheException("Failed to find SQL table for type: " + resType);

return idx.query(space, clause, params, type, filters);
}
Expand Down Expand Up @@ -485,7 +485,7 @@ public <K,V> Iterator<Cache.Entry<K,V>> queryLocal(String space, String type, St
TypeDescriptor typeDesc = typesByName.get(new TypeName(space, type));

if (typeDesc == null || !typeDesc.registered())
return new GridEmptyCloseableIterator<>();
throw new CacheException("Failed to find SQL table for type: " + type);

final GridCloseableIterator<IgniteBiTuple<K,V>> i = idx.query(space, sqlQry, F.asList(params), typeDesc,
idx.backupFilter());
Expand Down Expand Up @@ -663,7 +663,7 @@ public <K, V> GridCloseableIterator<IgniteBiTuple<K, V>> queryText(String space,
TypeDescriptor type = typesByName.get(new TypeName(space, resType));

if (type == null || !type.registered())
return new GridEmptyCloseableIterator<>();
throw new CacheException("Failed to find SQL table for type: " + resType);

return idx.queryText(space, clause, type, filters);
}
Expand Down Expand Up @@ -1141,11 +1141,11 @@ public Collection<GridQueryTypeDescriptor> types(@Nullable String space) {
}

/**
* Gets type for space and type name.
* Gets type descriptor for space and type name.
*
* @param space Space name.
* @param typeName Type name.
* @return Type.
* @return Type descriptor.
* @throws IgniteCheckedException If failed.
*/
public GridQueryTypeDescriptor type(@Nullable String space, String typeName) throws IgniteCheckedException {
Expand Down
Expand Up @@ -55,6 +55,7 @@
import org.jdk8.backport.*;
import org.jetbrains.annotations.*;

import javax.cache.*;
import javax.cache.Cache;
import java.io.*;
import java.lang.reflect.*;
Expand Down Expand Up @@ -681,7 +682,7 @@ public void bindParameters(PreparedStatement stmt, @Nullable Collection<Object>
final TableDescriptor tbl = tableDescriptor(spaceName, type);

if (tbl == null)
return new GridEmptyCloseableIterator<>();
throw new CacheException("Failed to find SQL table for type: " + type.name());

setFilters(filters);

Expand All @@ -707,7 +708,7 @@ public void bindParameters(PreparedStatement stmt, @Nullable Collection<Object>
TableDescriptor tblDesc = tableDescriptor(type, space);

if (tblDesc == null)
return new QueryCursorImpl<>(Collections.<Cache.Entry<K,V>>emptyIterator());
throw new CacheException("Failed to find SQL table for type: " + type);

String qry;

Expand Down

0 comments on commit 03c6702

Please sign in to comment.