Skip to content

Commit bc8083d

Browse files
Merge branch 'future'
2 parents 6bf85ae + 6af3460 commit bc8083d

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

+dj/GeneralRelvar.m

+4-9
Original file line numberDiff line numberDiff line change
@@ -326,10 +326,8 @@ function restrict(self, varargin)
326326
for arg = varargin
327327
if iscell(arg{1})
328328
self.restrict(arg{1}{:})
329-
end
330-
% unless duplicate, append restriction
331-
if ~any(cellfun(@(x) isequal(arg{1},x), self.restrictions))
332-
self.restrictions = [self.restrictions arg{1}];
329+
else
330+
self.restrictions = [self.restrictions arg(1)];
333331
end
334332
end
335333
end
@@ -346,11 +344,8 @@ function restrict(self, varargin)
346344
% tp.Scans & struct('mouse_id',3, 'scannum', 4);
347345
% tp.Scans & 'lens=10'
348346
% tp.Mice & (tp.Scans & 'lens=10')
349-
if ~iscell(arg)
350-
arg = {arg};
351-
end
352347
ret = self.copy;
353-
ret.restrictions = [ret.restrictions arg];
348+
ret.restrict(arg)
354349
end
355350

356351
function ret = or(self, arg)
@@ -406,7 +401,7 @@ function restrict(self, varargin)
406401
'Antijoin only accepts single restrictions'))
407402
end
408403
ret = self.copy;
409-
ret.restrictions = [ret.restrictions {'not' arg}];
404+
ret.restrict('not', arg)
410405
end
411406

412407
function ret = pro(self, varargin)

+dj/Schema.m

+6-5
Original file line numberDiff line numberDiff line change
@@ -493,11 +493,12 @@ function reload(self, force)
493493
% reload schema information into memory: table names and field named.
494494
fprintf('loading table definitions from %s... ', self.dbname)
495495
tic
496-
self.tables = self.conn.query(sprintf([...
497-
'SELECT table_name AS name, table_comment AS comment ' ...
498-
'FROM information_schema.tables ' ...
499-
'WHERE table_schema="%s" AND table_name REGEXP "{S}"'], ...
500-
self.dbname),self.tableRegexp);
496+
self.tables = self.conn.query(sprintf(...
497+
'SHOW TABLE STATUS FROM `%s` WHERE name REGEXP "{S}"', ...
498+
self.dbname),self.tableRegexp,'bigint_to_double');
499+
self.tables.name = self.tables.Name;
500+
self.tables.comment = self.tables.Comment;
501+
self.tables = dj.struct.pro(self.tables,'name','comment');
501502

502503
% determine table tier (see dj.Table)
503504
re = cellfun(@(x) sprintf('^%s%s[a-z][a-z0-9_]*$',self.prefix,x), ...

0 commit comments

Comments
 (0)