Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
recommender_C-stateofart
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alexandre Peres Arias
recommender_C-stateofart
Commits
d98924df
Commit
d98924df
authored
Jul 13, 2016
by
Giovanne Marcelo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change strcat to sprintf
parent
36c471ce
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
11 deletions
+4
-11
src/db_api.c
src/db_api.c
+4
-11
No files found.
src/db_api.c
View file @
d98924df
...
...
@@ -28,11 +28,8 @@ void read_conf(const char *path, char * conninfo) {
// Iterate over json and build connection info
json_object_foreach
(
config
,
key
,
value
)
{
strcat
(
k_v
,
key
);
strcat
(
k_v
,
"="
);
strcat
(
k_v
,
json_string_value
(
value
));
strcat
(
conninfo
,
k_v
);
strcat
(
conninfo
,
" "
);
sprintf
(
k_v
,
"%s = %s"
,
key
,
json_string_value
(
value
));
sprintf
(
conninfo
,
"%s %s "
,
conninfo
,
k_v
);
strcpy
(
k_v
,
""
);
}
}
...
...
@@ -67,13 +64,9 @@ DBresult* db_select( char *columns, char *table, char *where) {
DBresult
*
result
;
// Build query
strcpy
(
query
,
"SELECT "
);
strcat
(
query
,
columns
);
strcat
(
query
,
" FROM "
);
strcat
(
query
,
table
);
sprintf
(
query
,
"SELECT %s FROM %s"
,
columns
,
table
);
if
(
where
&&
strcmp
(
where
,
""
))
strcat
(
query
,
" WHERE "
);
strcat
(
query
,
where
);
sprintf
(
query
,
"%s WHERE %s "
,
query
,
where
);
strcat
(
query
,
";"
);
// Execute query
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment