Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
ccan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
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
mirror
ccan
Commits
4d553425
Commit
4d553425
authored
Aug 16, 2008
by
dinesh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fix for duplicate module name upload
parent
845cdae3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
tools/_infotojson/infotojson.c
tools/_infotojson/infotojson.c
+8
-5
No files found.
tools/_infotojson/infotojson.c
View file @
4d553425
...
@@ -94,20 +94,23 @@ static int storejsontodb(const struct json *jsonobj, const char *db)
...
@@ -94,20 +94,23 @@ static int storejsontodb(const struct json *jsonobj, const char *db)
struct
db_query
*
q
;
struct
db_query
*
q
;
handle
=
db_open
(
db
);
handle
=
db_open
(
db
);
query
=
talloc_asprintf
(
NULL
,
"SELECT module from search where module=
\"
%s
\"
;"
,
jsonobj
->
module
);
query
=
talloc_asprintf
(
NULL
,
"SELECT module
, author
from search where module=
\"
%s
\"
;"
,
jsonobj
->
module
);
q
=
db_query
(
handle
,
query
);
q
=
db_query
(
handle
,
query
);
desc
=
strjoin
(
NULL
,
jsonobj
->
desc
,
"
\n
"
);
desc
=
strjoin
(
NULL
,
jsonobj
->
desc
,
"
\n
"
);
strreplace
(
desc
,
'\''
,
' '
);
strreplace
(
desc
,
'\''
,
' '
);
depends
=
strjoin
(
NULL
,
jsonobj
->
depends
,
"
\n
"
);
depends
=
strjoin
(
NULL
,
jsonobj
->
depends
,
"
\n
"
);
if
(
!
q
->
num_rows
)
if
(
q
->
num_rows
&&
streq
(
jsonobj
->
author
,
q
->
rows
[
0
][
1
]))
cmd
=
talloc_asprintf
(
NULL
,
"UPDATE search set author=
\"
%s
\"
, title=
\"
%s
\"
, desc=
\'
%s
\'
depends=
\'
%s
\'
where module=
\"
%s
\"
;"
,
jsonobj
->
author
,
jsonobj
->
title
,
desc
,
depends
,
jsonobj
->
module
);
else
if
(
!
q
->
num_rows
)
cmd
=
talloc_asprintf
(
NULL
,
"INSERT INTO search VALUES(
\"
%s
\"
,
\"
%s
\"
,
\"
%s
\"
,
\'
%s
\'
,
\'
%s
\'
, 0);"
,
cmd
=
talloc_asprintf
(
NULL
,
"INSERT INTO search VALUES(
\"
%s
\"
,
\"
%s
\"
,
\"
%s
\"
,
\'
%s
\'
,
\'
%s
\'
, 0);"
,
jsonobj
->
module
,
jsonobj
->
author
,
jsonobj
->
title
,
depends
,
desc
);
jsonobj
->
module
,
jsonobj
->
author
,
jsonobj
->
title
,
depends
,
desc
);
else
else
cmd
=
talloc_asprintf
(
NULL
,
"
UPDATE search set author=
\"
%s
\"
, title=
\"
%s
\"
, desc=
\'
%s
\'
depends=
\'
%s
\'
where module=
\"
%s
\"
;"
,
cmd
=
talloc_asprintf
(
NULL
,
"
INSERT INTO search VALUES(
\"
%s-%s
\"
,
\"
%s
\"
,
\"
%s
\"
,
\'
%s
\'
,
\'
%s
\'
, 0)
;"
,
jsonobj
->
author
,
jsonobj
->
title
,
desc
,
depends
,
jsonobj
->
module
);
jsonobj
->
module
,
jsonobj
->
author
,
jsonobj
->
author
,
jsonobj
->
title
,
depends
,
desc
);
db_command
(
handle
,
cmd
);
db_command
(
handle
,
cmd
);
db_close
(
handle
);
db_close
(
handle
);
talloc_free
(
depends
);
talloc_free
(
depends
);
...
...
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