Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mmt-errorView
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Christian Maeder
mmt-errorView
Commits
5466872d
Commit
5466872d
authored
Feb 5, 2015
by
cmaeder
Browse files
Options
Downloads
Patches
Plain Diff
allow for counting as batch job
parent
7112d4f7
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/scala/QueryDB.scala
+6
-5
6 additions, 5 deletions
src/main/scala/QueryDB.scala
src/test/data/strings.txt
+12
-0
12 additions, 0 deletions
src/test/data/strings.txt
with
18 additions
and
5 deletions
src/main/scala/QueryDB.scala
+
6
−
5
View file @
5466872d
...
@@ -14,8 +14,9 @@ class QueryDB extends RouteBuilder {
...
@@ -14,8 +14,9 @@ class QueryDB extends RouteBuilder {
try
{
try
{
(
b
.
asInstanceOf
[
util.ArrayList
[
_
]].
asScala
map
{
(
b
.
asInstanceOf
[
util.ArrayList
[
_
]].
asScala
map
{
case
jm
if
count
=>
case
jm
if
count
=>
"count where "
+
field
+
" contains "
+
subString
+
": "
+
// "count where " + field + " contains " + subString + ": " +
jm
.
asInstanceOf
[
util.HashMap
[
String
,
Integer
]].
asScala
.
getOrElse
(
"COUNT(*)"
,
0
)
jm
.
asInstanceOf
[
util.HashMap
[
String
,
Integer
]].
asScala
.
getOrElse
(
"COUNT(*)"
,
0
)
+
" \""
+
subString
+
"\""
case
jm
if
!
count
=>
case
jm
if
!
count
=>
val
sm
=
jm
.
asInstanceOf
[
util.HashMap
[
String
,
String
]].
asScala
val
sm
=
jm
.
asInstanceOf
[
util.HashMap
[
String
,
String
]].
asScala
sm
.
getOrElse
(
Table
.
columns
(
0
),
""
).
stripPrefix
(
dirPrefix
)
+
sm
.
getOrElse
(
Table
.
columns
(
0
),
""
).
stripPrefix
(
dirPrefix
)
+
...
@@ -27,7 +28,7 @@ class QueryDB extends RouteBuilder {
...
@@ -27,7 +28,7 @@ class QueryDB extends RouteBuilder {
}
}
def
queryValues
(
dirPrefix
:
String
,
count
:
Boolean
,
subString
:
String
,
field
:
String
)
:
Unit
=
{
def
queryValues
(
dirPrefix
:
String
,
count
:
Boolean
,
subString
:
String
,
field
:
String
)
:
Unit
=
{
val
w
=
field
+
" LIKE '%"
+
subString
+
"%'"
val
w
=
field
+
" LIKE '%"
+
subString
.
replaceAll
(
"'"
,
"''"
)
+
"%'"
val
q
=
"db:SELECT "
+
(
if
(
count
)
"COUNT(*)"
else
"*"
)
+
" FROM "
+
Table
.
name
+
" WHERE "
+
w
val
q
=
"db:SELECT "
+
(
if
(
count
)
"COUNT(*)"
else
"*"
)
+
" FROM "
+
Table
.
name
+
" WHERE "
+
w
val
d
=
"direct:"
+
q
val
d
=
"direct:"
+
q
val
r
:
RouteDefinition
=
d
==>
{
val
r
:
RouteDefinition
=
d
==>
{
...
@@ -61,11 +62,11 @@ object QueryDB {
...
@@ -61,11 +62,11 @@ object QueryDB {
dirPrefix
=
if
(
dir
.
endsWith
(
"/"
))
dir
else
dir
+
"/"
dirPrefix
=
if
(
dir
.
endsWith
(
"/"
))
dir
else
dir
+
"/"
var
ok
=
true
var
ok
=
true
while
(
ok
)
{
while
(
ok
)
{
println
(
"Enter field or search string:"
)
//
println("Enter field or search string:")
val
ln
=
readLine
val
ln
=
readLine
ok
=
ln
!=
null
ok
=
ln
!=
null
if
(
ok
)
{
if
(
ok
)
{
dbSearch
.
queryValues
(
QueryDB
.
dirPrefix
,
false
,
ln
,
QueryDB
.
field
)
//
dbSearch.queryValues(QueryDB.dirPrefix, false, ln, QueryDB.field)
dbSearch
.
queryValues
(
QueryDB
.
dirPrefix
,
true
,
ln
,
QueryDB
.
field
)
dbSearch
.
queryValues
(
QueryDB
.
dirPrefix
,
true
,
ln
,
QueryDB
.
field
)
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/test/data/strings.txt
0 → 100644
+
12
−
0
View file @
5466872d
already declared
Expected `=', found token `.'
Expected constant name or pragma keyword
skipped big file
XML error in omdoc file (likely too big for Twelf to write)
Prolog initialisation failed
exception for file
Type mismatch
Undeclared identifier
Expected `:' or `=', found `('
prefix tptp already bound to http://latin.omdoc.org/logics/tptp
Syntax error:
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment