Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
platform_frameworks_base-old
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Farzin Kazemzadeh
platform_frameworks_base-old
Commits
c8a01666
Commit
c8a01666
authored
10 months ago
by
Charles Munger
Browse files
Options
Downloads
Patches
Plain Diff
Simplify query for tables_used; no need to count when we only care if there's one.
Change-Id: I63c9f4a057b7f470c9f44be6f73e61e1cb31f3c6
parent
0bf06c23
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/jni/android_database_SQLiteConnection.cpp
+6
-9
6 additions, 9 deletions
core/jni/android_database_SQLiteConnection.cpp
with
6 additions
and
9 deletions
core/jni/android_database_SQLiteConnection.cpp
+
6
−
9
View file @
c8a01666
...
...
@@ -436,7 +436,7 @@ static jboolean nativeUpdatesTempOnly(JNIEnv* env, jclass,
int
result
=
SQLITE_OK
;
if
(
connection
->
tableQuery
==
nullptr
)
{
static
char
const
*
sql
=
"SELECT
COUNT(*)
FROM tables_used(?) WHERE schema != 'temp' AND wr != 0"
;
"SELECT
NULL
FROM tables_used(?) WHERE schema != 'temp' AND wr != 0"
;
result
=
sqlite3_prepare_v2
(
connection
->
db
,
sql
,
-
1
,
&
connection
->
tableQuery
,
nullptr
);
if
(
result
!=
SQLITE_OK
)
{
ALOGE
(
"failed to compile query table: %s"
,
...
...
@@ -455,17 +455,14 @@ static jboolean nativeUpdatesTempOnly(JNIEnv* env, jclass,
return
false
;
}
result
=
sqlite3_step
(
query
);
if
(
result
!=
SQLITE_ROW
)
{
// Make sure the query is no longer bound to the statement SQL string.
sqlite3_clear_bindings
(
query
);
if
(
result
!=
SQLITE_ROW
&&
result
!=
SQLITE_DONE
)
{
ALOGE
(
"tables query error: %d/%s"
,
result
,
sqlite3_errstr
(
result
));
// Make sure the query is no longer bound to the statement.
sqlite3_clear_bindings
(
query
);
return
false
;
}
int
count
=
sqlite3_column_int
(
query
,
0
);
// Make sure the query is no longer bound to the statement SQL string.
sqlite3_clear_bindings
(
query
);
return
count
==
0
;
return
result
==
SQLITE_DONE
;
}
static
jint
nativeGetColumnCount
(
JNIEnv
*
env
,
jclass
clazz
,
jlong
connectionPtr
,
...
...
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