Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
pike
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pikelang
pike
Commits
57c80fe4
Commit
57c80fe4
authored
7 years ago
by
Stephen R. van den Berg
Browse files
Options
Downloads
Patches
Plain Diff
pgsql: Make affected_rows() and status_command_complete() wait for a meaningful result.
parent
acdac0b8
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/modules/Sql.pmod/pgsql_util.pmod
+14
-6
14 additions, 6 deletions
lib/modules/Sql.pmod/pgsql_util.pmod
with
14 additions
and
6 deletions
lib/modules/Sql.pmod/pgsql_util.pmod
+
14
−
6
View file @
57c80fe4
...
@@ -749,26 +749,34 @@ class sql_result {
...
@@ -749,26 +749,34 @@ class sql_result {
//! Returns the command-complete status for this query.
//! Returns the command-complete status for this query.
//!
//!
//! @seealso
//! @note
//! @[affected_rows()]
//! This method should normally be called after EOF has been reached.
//! If it is called before, all unfetched result rows will be discarded.
//!
//!
//! @note
//! @note
//! This function is PostgreSQL-specific.
//! This function is PostgreSQL-specific.
//!
//! @[affected_rows()], @[eof()]
/*semi*/final string status_command_complete() {
/*semi*/final string status_command_complete() {
if (!statuscmdcomplete)
while (fetch_row_array());
return statuscmdcomplete;
return statuscmdcomplete;
}
}
//! Returns the number of affected rows by this query.
//! Returns the number of affected rows by this query.
//!
//!
//! @seealso
//! @note
//! @[status_command_complete()]
//! This method should normally be called after EOF has been reached.
//! If it is called before, all unfetched result rows will be discarded.
//!
//!
//! @note
//! @note
//! This function is PostgreSQL-specific.
//! This function is PostgreSQL-specific.
//!
//! @seealso
//! @[status_command_complete()], @[eof()]
/*semi*/final int affected_rows() {
/*semi*/final int affected_rows() {
int rows;
int rows;
if (statuscmdcomplete)
sscanf(status_command_complete(), "%*s %d %d", rows, rows);
sscanf(statuscmdcomplete, "%*s %d %d", rows, rows);
return rows;
return rows;
}
}
...
...
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