/[LeafOK_CVS]/lbbs/src/article_del.c
ViewVC logotype

Diff of /lbbs/src/article_del.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.11 by sysadm, Tue Nov 11 00:28:05 2025 UTC Revision 1.13 by sysadm, Sat Jan 3 10:27:14 2026 UTC
# Line 3  Line 3 
3   * article_del   * article_del
4   *   - user interactive feature to delete article   *   - user interactive feature to delete article
5   *   *
6   * Copyright (C) 2004-2025  Leaflet <leaflet@leafok.com>   * Copyright (C) 2004-2026  Leaflet <leaflet@leafok.com>
7   */   */
8    
9  #ifdef HAVE_CONFIG_H  #ifdef HAVE_CONFIG_H
# Line 33  int article_del(const SECTION_LIST *p_se Line 33  int article_del(const SECTION_LIST *p_se
33    
34          if (p_section == NULL || p_article == NULL)          if (p_section == NULL || p_article == NULL)
35          {          {
36                  log_error("NULL pointer error\n");                  log_error("NULL pointer error");
37          }          }
38    
39          if (p_article->excerption) // Delete is not allowed          if (p_article->excerption) // Delete is not allowed
# Line 79  int article_del(const SECTION_LIST *p_se Line 79  int article_del(const SECTION_LIST *p_se
79          db = db_open();          db = db_open();
80          if (db == NULL)          if (db == NULL)
81          {          {
82                  log_error("db_open() error: %s\n", mysql_error(db));                  log_error("db_open() error: %s", mysql_error(db));
83                  ret = -1;                  ret = -1;
84                  goto cleanup;                  goto cleanup;
85          }          }
# Line 87  int article_del(const SECTION_LIST *p_se Line 87  int article_del(const SECTION_LIST *p_se
87          // Begin transaction          // Begin transaction
88          if (mysql_query(db, "SET autocommit=0") != 0)          if (mysql_query(db, "SET autocommit=0") != 0)
89          {          {
90                  log_error("SET autocommit=0 error: %s\n", mysql_error(db));                  log_error("SET autocommit=0 error: %s", mysql_error(db));
91                  ret = -1;                  ret = -1;
92                  goto cleanup;                  goto cleanup;
93          }          }
94    
95          if (mysql_query(db, "BEGIN") != 0)          if (mysql_query(db, "BEGIN") != 0)
96          {          {
97                  log_error("Begin transaction error: %s\n", mysql_error(db));                  log_error("Begin transaction error: %s", mysql_error(db));
98                  ret = -1;                  ret = -1;
99                  goto cleanup;                  goto cleanup;
100          }          }
# Line 105  int article_del(const SECTION_LIST *p_se Line 105  int article_del(const SECTION_LIST *p_se
105    
106          if (mysql_query(db, sql) != 0)          if (mysql_query(db, sql) != 0)
107          {          {
108                  log_error("Query article status error: %s\n", mysql_error(db));                  log_error("Query article status error: %s", mysql_error(db));
109                  ret = -1;                  ret = -1;
110                  goto cleanup;                  goto cleanup;
111          }          }
112          if ((rs = mysql_use_result(db)) == NULL)          if ((rs = mysql_use_result(db)) == NULL)
113          {          {
114                  log_error("Get article status data failed\n");                  log_error("Get article status data failed");
115                  ret = -1;                  ret = -1;
116                  goto cleanup;                  goto cleanup;
117          }          }
# Line 156  int article_del(const SECTION_LIST *p_se Line 156  int article_del(const SECTION_LIST *p_se
156    
157          if (mysql_query(db, sql) != 0)          if (mysql_query(db, sql) != 0)
158          {          {
159                  log_error("Update article status error: %s\n", mysql_error(db));                  log_error("Update article status error: %s", mysql_error(db));
160                  ret = -1;                  ret = -1;
161                  goto cleanup;                  goto cleanup;
162          }          }
# Line 177  int article_del(const SECTION_LIST *p_se Line 177  int article_del(const SECTION_LIST *p_se
177    
178          if (mysql_query(db, sql) != 0)          if (mysql_query(db, sql) != 0)
179          {          {
180                  log_error("Update exp error: %s\n", mysql_error(db));                  log_error("Update exp error: %s", mysql_error(db));
181                  ret = -1;                  ret = -1;
182                  goto cleanup;                  goto cleanup;
183          }          }
# Line 192  int article_del(const SECTION_LIST *p_se Line 192  int article_del(const SECTION_LIST *p_se
192    
193          if (mysql_query(db, sql) != 0)          if (mysql_query(db, sql) != 0)
194          {          {
195                  log_error("Add log error: %s\n", mysql_error(db));                  log_error("Add log error: %s", mysql_error(db));
196                  ret = -1;                  ret = -1;
197                  goto cleanup;                  goto cleanup;
198          }          }
# Line 206  int article_del(const SECTION_LIST *p_se Line 206  int article_del(const SECTION_LIST *p_se
206    
207                  if (mysql_query(db, sql) != 0)                  if (mysql_query(db, sql) != 0)
208                  {                  {
209                          log_error("Update article error: %s\n", mysql_error(db));                          log_error("Update article error: %s", mysql_error(db));
210                          ret = -1;                          ret = -1;
211                          goto cleanup;                          goto cleanup;
212                  }                  }
# Line 215  int article_del(const SECTION_LIST *p_se Line 215  int article_del(const SECTION_LIST *p_se
215          // Commit transaction          // Commit transaction
216          if (mysql_query(db, "COMMIT") != 0)          if (mysql_query(db, "COMMIT") != 0)
217          {          {
218                  log_error("Commit transaction error: %s\n", mysql_error(db));                  log_error("Commit transaction error: %s", mysql_error(db));
219                  ret = -1;                  ret = -1;
220                  goto cleanup;                  goto cleanup;
221          }          }


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1