File: blog_api.sql

package info (click to toggle)
virtuoso-opensource 6.1.4%2Bdfsg1-7
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 245,116 kB
  • sloc: ansic: 639,631; sql: 439,225; xml: 287,085; java: 61,048; sh: 38,723; cpp: 36,889; cs: 25,240; php: 12,562; yacc: 9,036; lex: 7,149; makefile: 6,093; jsp: 4,447; awk: 1,643; perl: 1,017; ruby: 1,003; python: 329
file content (602 lines) | stat: -rw-r--r-- 18,876 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
-- Weblog APIs
use ODS;

create procedure ODS.ODS_API."weblog.post.new" (
    in inst_id int,
    in categories any := null,
    in date_created datetime := null,
    in description varchar,
    in enclosure any := null,
    in source any := null,
    in title varchar,
    in link varchar := null,
    in author varchar := null,
    in comments varchar := null,
    in allow_comments smallint := 1,
    in allow_pings smallint := 1,
    in convert_breaks smallint := 0,
    in excerpt varchar := null,
    in tb_ping_urls any := null,
    in text_more varchar := null,
    in keywords varchar := null,
    in publish smallint := 1
    ) __soap_http 'text/xml'
{
  declare uname, passwd, blog_id varchar;
  declare rc int;
  declare struct BLOG.DBA."MTWeblogPost";

  declare exit handler for sqlstate '*' {
    rollback work;
    return ods_serialize_sql_error (__SQL_STATE, __SQL_MESSAGE);
  };
  if (not ods_check_auth (uname, inst_id, 'author'))
    return ods_auth_failed ();

  struct := new BLOG.DBA."MTWeblogPost" ();
  struct.categories := split_and_decode (categories, 0, '\0\0,');
  struct.dateCreated := date_created;
  struct.description := description;
  -- struct.enclosure := blog_deserialize_enclosure (enclosure);
  -- struct.source := blog_deserialize_source (source);
  struct.title := title;
  struct.link := link;
  struct.author := author;
  struct.comments := comments;
  struct.mt_allow_comments := allow_comments;
  struct.mt_allow_pings := allow_pings;
  struct.mt_convert_breaks := convert_breaks;
  struct.mt_excerpt := excerpt;
  struct.mt_tb_ping_urls := split_and_decode (tb_ping_urls, 0, '\0\0,');
  struct.mt_text_more := text_more;
  struct.mt_keywords := keywords;

  whenever not found goto ret;
  select BI_BLOG_ID into blog_id from BLOG.DBA.SYS_BLOG_INFO, DB.DBA.WA_INSTANCE where WAI_NAME = BI_WAI_NAME and WAI_ID = inst_id;
  passwd := __user_password (uname);
  rc := BLOG.DBA."metaWeblog.newPost" (blog_id, uname, passwd, struct, publish);

ret:
  return ods_serialize_int_res (rc);
}
;

create procedure ODS.ODS_API."weblog.post.edit" (
    in post_id int,
    in categories any := null,
    in date_created datetime := null,
    in description varchar,
    in enclosure any := null,
    in source any := null,
    in title varchar,
    in link varchar := null,
    in author varchar := null,
    in comments varchar := null,
    in allow_comments smallint := 1,
    in allow_pings smallint := 1,
    in convert_breaks smallint := 0,
    in excerpt varchar := null,
    in tb_ping_urls any := null,
    in text_more varchar := null,
    in keywords varchar := null,
    in publish smallint := 1
    ) __soap_http 'text/xml'
{
  declare uname, passwd, blog_id varchar;
  declare rc int;
  declare struct BLOG.DBA."MTWeblogPost";
  declare inst_id int;

  declare exit handler for sqlstate '*' {
    rollback work;
    return ods_serialize_sql_error (__SQL_STATE, __SQL_MESSAGE);
  };
  whenever not found goto ret;
  select WAI_ID into inst_id from DB.DBA.WA_INSTANCE, BLOG.DBA.SYS_BLOG_INFO, BLOG.DBA.SYS_BLOGS where
      BI_BLOG_ID = B_BLOG_ID and B_POST_ID = post_id and BI_WAI_NAME = WAI_NAME;

  if (not ods_check_auth (uname, inst_id, 'author'))
    return ods_auth_failed ();

  struct := new BLOG.DBA."MTWeblogPost" ();
  struct.categories := split_and_decode (categories, 0, '\0\0,');
  struct.dateCreated := date_created;
  struct.description := description;
  -- struct.enclosure := blog_deserialize_enclosure (enclosure);
  -- struct.source := blog_deserialize_source (source);
  struct.title := title;
  struct.link := link;
  struct.author := author;
  struct.comments := comments;
  struct.mt_allow_comments := allow_comments;
  struct.mt_allow_pings := allow_pings;
  struct.mt_convert_breaks := convert_breaks;
  struct.mt_excerpt := excerpt;
  struct.mt_tb_ping_urls := split_and_decode (tb_ping_urls, 0, '\0\0,');
  struct.mt_text_more := text_more;
  struct.mt_keywords := keywords;

  whenever not found goto ret;
  passwd := __user_password (uname);
  rc := BLOG.DBA."metaWeblog.editPost" (post_id, uname, passwd, struct, publish);
ret:
  return ods_serialize_int_res (rc);
}
;

create procedure ODS.ODS_API."weblog.post.delete" (in post_id varchar) __soap_http 'text/xml'
{
  declare uname, passwd varchar;
  declare rc int;
  declare inst_id int;

  declare exit handler for sqlstate '*' {
    rollback work;
    return ods_serialize_sql_error (__SQL_STATE, __SQL_MESSAGE);
  };
  whenever not found goto ret;
  select WAI_ID into inst_id from DB.DBA.WA_INSTANCE, BLOG.DBA.SYS_BLOG_INFO, BLOG.DBA.SYS_BLOGS where
      BI_BLOG_ID = B_BLOG_ID and B_POST_ID = post_id and BI_WAI_NAME = WAI_NAME;

  if (not ods_check_auth (uname, inst_id, 'author'))
    return ods_auth_failed ();

  passwd := __user_password (uname);
  rc := BLOG.DBA."blogger.deletePost" ('ODS-API', post_id, uname, passwd, 1);
ret:
  return ods_serialize_int_res (rc);
}
;

create procedure ODS.ODS_API."weblog.post.get" (in post_id varchar) __soap_http 'text/xml'
{
  declare uname varchar;
  declare rc int;
  declare q, iri, blog_id varchar;
  declare inst_id int;

  declare exit handler for sqlstate '*' {
    rollback work;
    return ods_serialize_sql_error (__SQL_STATE, __SQL_MESSAGE);
  };
  whenever not found goto ret;
  select WAI_ID, BI_BLOG_ID into inst_id, blog_id from DB.DBA.WA_INSTANCE, BLOG.DBA.SYS_BLOG_INFO, BLOG.DBA.SYS_BLOGS where
      BI_BLOG_ID = B_BLOG_ID and B_POST_ID = post_id and BI_WAI_NAME = WAI_NAME;

  if (not ods_check_auth (uname, inst_id, 'reader'))
    return ods_auth_failed ();

  ods_describe_iri (sioc..blog_post_iri (blog_id, post_id));
ret:
  return '';
}
;

create procedure ODS.ODS_API."weblog.comment.get" (in post_id varchar, in comment_id int := null) __soap_http 'text/xml'
{
  declare uname varchar;
  declare rc int;
  declare q, iri, blog_id varchar;
  declare inst_id int;

  declare exit handler for sqlstate '*' {
    rollback work;
    return ods_serialize_sql_error (__SQL_STATE, __SQL_MESSAGE);
  };
  whenever not found goto ret;
  select WAI_ID, BI_BLOG_ID into inst_id, blog_id from DB.DBA.WA_INSTANCE, BLOG.DBA.SYS_BLOG_INFO, BLOG.DBA.SYS_BLOGS where
      BI_BLOG_ID = B_BLOG_ID and B_POST_ID = post_id and BI_WAI_NAME = WAI_NAME;

  if (not ods_check_auth (uname, inst_id, 'reader'))
    return ods_auth_failed ();

  if (comment_id is null)
    {
      iri := sioc..fix_uri (sioc..blog_post_iri (blog_id, post_id));
      q := sprintf ('describe ?x from <%s> where { <%s> sioc:has_reply ?x }', ods_graph (), iri);
    }
  else
    {
      iri := sioc..fix_uri (sioc..blog_comment_iri (blog_id, post_id, comment_id));
      q := sprintf ('describe <%s> from <%s>', iri, ods_graph ());
    }
  exec_sparql (q);
ret:
  return '';
}
;

create procedure ODS.ODS_API."weblog.comment.approve" (in post_id int, in comment_id int, in flag smallint) __soap_http 'text/xml'
{
  declare uname, blog_id varchar;
  declare rc int;
  declare inst_id int;
  declare msg varchar;

  declare exit handler for sqlstate '*' {
    rollback work;
    return ods_serialize_sql_error (__SQL_STATE, __SQL_MESSAGE);
  };
  whenever not found goto ret;
  msg := 'No such post';
  rc := -1;
  select WAI_ID, BI_BLOG_ID into inst_id, blog_id from DB.DBA.WA_INSTANCE, BLOG.DBA.SYS_BLOG_INFO, BLOG.DBA.SYS_BLOGS where
      BI_BLOG_ID = B_BLOG_ID and B_POST_ID = post_id and BI_WAI_NAME = WAI_NAME;

  if (not ods_check_auth (uname, inst_id, 'author'))
    return ods_auth_failed ();

  if (flag not in (-1, 0, 1))
    {
      rc := -1;
      msg := 'Flag must be 0, 1 or -1.';
    }
  else
    {
      declare spam int;
      spam := 1;
      if (flag = 1 or flag = 0)
	spam := 0;
      update BLOG..BLOG_COMMENTS set BM_IS_PUB = abs(flag), BM_IS_SPAM = spam
	  where BM_BLOG_ID = blog_id and BM_POST_ID = post_id and BM_ID = comment_id;
      rc := row_count ();
      msg := '';
    }
ret:
  return ods_serialize_int_res (rc, msg);
}
;

create procedure ODS.ODS_API."weblog.comment.delete" (in post_id int, in comment_id int) __soap_http 'text/xml'
{
  declare uname, blog_id varchar;
  declare rc int;
  declare inst_id int;
  declare msg varchar;

  declare exit handler for sqlstate '*' {
    rollback work;
    return ods_serialize_sql_error (__SQL_STATE, __SQL_MESSAGE);
  };
  whenever not found goto ret;
  msg := 'No such post';
  rc := -1;
  select WAI_ID, BI_BLOG_ID into inst_id, blog_id from DB.DBA.WA_INSTANCE, BLOG.DBA.SYS_BLOG_INFO, BLOG.DBA.SYS_BLOGS where
      BI_BLOG_ID = B_BLOG_ID and B_POST_ID = post_id and BI_WAI_NAME = WAI_NAME;

  if (not ods_check_auth (uname, inst_id))
    return ods_auth_failed ();
  delete from BLOG..BLOG_COMMENTS
	  where BM_BLOG_ID = blog_id and BM_POST_ID = post_id and BM_ID = comment_id;
  rc := row_count ();
  msg := '';
ret:
  return ods_serialize_int_res (rc);
}
;

create procedure ODS.ODS_API."weblog.comment.new" (
	in post_id varchar,
	in name varchar,
	in title varchar,
	in email varchar,
	in url varchar,
	in text varchar
	) __soap_http 'text/xml'
{
  declare uname, blog_id varchar;
  declare rc, inst_id, auth_rc, comment_id int;
  declare msg varchar;

  rc := -1;
  declare exit handler for sqlstate '*' {
    rollback work;
    return ods_serialize_sql_error (__SQL_STATE, __SQL_MESSAGE);
  };
  whenever not found goto ret;
  select WAI_ID, BI_BLOG_ID into inst_id, blog_id from DB.DBA.WA_INSTANCE, BLOG.DBA.SYS_BLOG_INFO, BLOG.DBA.SYS_BLOGS where
      BI_BLOG_ID = B_BLOG_ID and B_POST_ID = post_id and BI_WAI_NAME = WAI_NAME;
  auth_rc := ods_check_auth (uname, inst_id, 'author');

  msg := MT.MT.comments (post_id, title, sprintf ('%s <%s>', name, email), url, text);
  if (auth_rc)
    {
      comment_id := identity_value ();
      update BLOG.DBA.BLOG_COMMENTS set BM_IS_PUB = 1 where BM_BLOG_ID = blog_id and BM_POST_ID = post_id and BM_ID = comment_id;
    }
  if (strstr (msg, 'success') is not null)
    rc := 1;
ret:
  return ods_serialize_int_res (rc, msg);
}
;

create procedure ODS.ODS_API."weblog.get" (in inst_id int) __soap_http 'text/xml'
{
  declare uname, inst_name, blog_id varchar;
  declare rc int;

  declare exit handler for sqlstate '*' {
    rollback work;
    return ods_serialize_sql_error (__SQL_STATE, __SQL_MESSAGE);
  };
  if (not ods_check_auth (uname, inst_id, 'reader'))
    return ods_auth_failed ();

  whenever not found goto ret;
  select WAI_NAME into inst_name from DB.DBA.WA_INSTANCE where WAI_ID = inst_id;

  ods_describe_iri (sioc..blog_iri (inst_name));
ret:
  return '';
}
;

create procedure ODS.ODS_API."weblog.options.set" (
  in inst_id int, in options any) __soap_http 'text/xml'
{
  declare uname varchar;
  declare rc int;
  declare msg varchar;

  declare exit handler for sqlstate '*' {
    rollback work;
    return ods_serialize_sql_error (__SQL_STATE, __SQL_MESSAGE);
  };
  if (not ods_check_auth (uname, inst_id, 'author'))
    return ods_auth_failed ();

  if (not exists (select 1 from DB.DBA.WA_INSTANCE where WAI_ID = inst_id and WAI_TYPE_NAME = 'WEBLOG2'))
    return ods_serialize_sql_error ('37000', 'The instance is not found');

  msg := '';

  -- TODO: not implemented
ret:
  return ods_serialize_int_res (rc);
}
;

create procedure ODS.ODS_API."weblog.options.get" (
  in inst_id int) __soap_http 'text/xml'
{
  declare uname varchar;
  declare rc int;

  declare exit handler for sqlstate '*' {
    rollback work;
    return ods_serialize_sql_error (__SQL_STATE, __SQL_MESSAGE);
  };
  if (not ods_check_auth (uname, inst_id, 'author'))
    return ods_auth_failed ();

  if (not exists (select 1 from DB.DBA.WA_INSTANCE where WAI_ID = inst_id and WAI_TYPE_NAME = 'WEBLOG2'))
    return ods_serialize_sql_error ('37000', 'The instance is not found');

  -- TODO: not implemented
ret:
  return ods_serialize_int_res (rc);
}
;

create procedure ODS.ODS_API."weblog.upstreaming.set" (
    in inst_id int,
    in target_rpc_url varchar,
    in target_blog_id varchar,
    in target_protocol_id varchar,
    in target_uname varchar,
    in target_password varchar,
    in acl_allow any := '',
    in acl_deny any := '',
    in sync_interval int := 10,
    in keep_remote smallint := 1,
    in max_retries int := -1,
    in max_retransmits int := 5,
  in initialize_log int := 0) __soap_http 'text/xml'
{
  declare uname, blog_id varchar;
  declare rc int;
  declare jid int;
  declare msg varchar;

  declare exit handler for sqlstate '*' {
    rollback work;
    return ods_serialize_sql_error (__SQL_STATE, __SQL_MESSAGE);
  };
  if (not ods_check_auth (uname, inst_id, 'author'))
    return ods_auth_failed ();

  whenever not found goto ret;
  msg := 'No such blog';
  rc := -1;
  select BI_BLOG_ID into blog_id from BLOG.DBA.SYS_BLOG_INFO, DB.DBA.WA_INSTANCE where WAI_NAME = BI_WAI_NAME and WAI_ID = inst_id;

  jid := coalesce((select top 1 R_JOB_ID from BLOG.DBA.SYS_ROUTING order by R_JOB_ID desc), 0)+1;

  insert into BLOG.DBA.SYS_ROUTING (
                              R_JOB_ID,
                              R_DESTINATION,
                              R_AUTH_USER,
                              R_AUTH_PWD,
                              R_ITEM_ID,
                              R_TYPE_ID,
                              R_PROTOCOL_ID,
                              R_DESTINATION_ID,
                              R_FREQUENCY,
                              R_EXCEPTION_ID,
			      R_INCLUSION_ID,
			      R_KEEP_REMOTE,
			      R_MAX_ERRORS,
			      R_ITEM_MAX_RETRANSMITS
			      )
                            values (
                              jid,
                              target_rpc_url,
                              target_uname,
                              target_password,
                              blog_id,
                              1,
                              target_protocol_id,
                              target_blog_id,
                              sync_interval,
                              acl_deny,
			      acl_allow,
			      keep_remote,
			      max_retries,
			      max_retransmits
			      );
    if (row_count ())
      {
      rc := jid;
	msg := 'Created';
      }

    if (initialize_log)
      {
	for select B_POST_ID from BLOG.DBA.SYS_BLOGS where B_STATE = 2 and B_BLOG_ID = blog_id
	  do
	    {
	      insert soft BLOG.DBA.SYS_BLOGS_ROUTING_LOG (RL_JOB_ID, RL_POST_ID, RL_TYPE) values (jid, B_POST_ID, 'I');
	    }
      }
ret:
  return ods_serialize_int_res (rc);
}
;

create procedure ODS.ODS_API."weblog.upstreaming.get" (
    in job_id int := null
    ) __soap_http 'text/xml'
{
  declare uname varchar;
  declare rc, inst_id int;

  declare exit handler for sqlstate '*' {
    rollback work;
    return ods_serialize_sql_error (__SQL_STATE, __SQL_MESSAGE);
  };
  whenever not found goto ret;
  select WAI_ID into inst_id from DB.DBA.WA_INSTANCE, BLOG.DBA.SYS_BLOG_INFO, BLOG.DBA.SYS_ROUTING where
      R_JOB_ID = job_id and BI_WAI_NAME = WAI_NAME and R_ITEM_ID = BI_BLOG_ID;

  if (not ods_check_auth (uname, inst_id, 'author'))
    return ods_auth_failed ();

  -- TODO: not implemented
ret:
  return ods_serialize_int_res (rc);
}
;


create procedure ODS.ODS_API."weblog.upstreaming.remove" (
  in job_id int) __soap_http 'text/xml'
{
  declare uname varchar;
  declare rc int;
  declare inst_id int;
  declare msg varchar;

  declare exit handler for sqlstate '*' {
    rollback work;
    return ods_serialize_sql_error (__SQL_STATE, __SQL_MESSAGE);
  };
  whenever not found goto ret;
  msg := 'No such blog';
  rc := -1;
  select WAI_ID into inst_id from DB.DBA.WA_INSTANCE, BLOG.DBA.SYS_BLOG_INFO, BLOG.DBA.SYS_ROUTING where
      R_JOB_ID = job_id and BI_WAI_NAME = WAI_NAME and R_ITEM_ID = BI_BLOG_ID;

  if (not ods_check_auth (uname, inst_id, 'author'))
    return ods_auth_failed ();

  delete from BLOG.DBA.SYS_ROUTING where R_JOB_ID = job_id;
  rc := row_count ();
  msg := '';
ret:
  return ods_serialize_int_res (rc);
}
;

create procedure ODS.ODS_API."weblog.tagging.set" (
    in inst_id int,
    in flag int
    ) __soap_http 'text/xml'
{
  declare uname, blog_id varchar;
  declare rc int;
  declare msg varchar;

  if (not ods_check_auth (uname, inst_id, 'author'))
    return ods_auth_failed ();

  whenever not found goto ret;
  msg := 'No such blog';
  rc := -1;
  select BI_BLOG_ID into blog_id from BLOG.DBA.SYS_BLOG_INFO, DB.DBA.WA_INSTANCE where WAI_NAME = BI_WAI_NAME and WAI_ID = inst_id;
  update BLOG.DBA.SYS_BLOG_INFO set BI_AUTO_TAGGING = flag where BI_BLOG_ID = blog_id;
  rc := row_count ();
  msg := '';
ret:
  return ods_serialize_int_res (rc);
}
;

create procedure ODS.ODS_API."weblog.tagging.retag" (
    in inst_id int,
    in keep_existing_tags int
    ) __soap_http 'text/xml'
{
  declare uname, blog_id varchar;
  declare rc, flag, job, user_id int;
  declare dummy, ruls any;
  declare msg varchar;

  declare exit handler for sqlstate '*' {
    rollback work;
    return ods_serialize_sql_error (__SQL_STATE, __SQL_MESSAGE);
  };
  if (not ods_check_auth (uname, inst_id, 'author'))
    return ods_auth_failed ();

  whenever not found goto ret;
  msg := 'No such blog';
  rc := -1;
  select BI_BLOG_ID into blog_id from BLOG.DBA.SYS_BLOG_INFO, DB.DBA.WA_INSTANCE where WAI_NAME = BI_WAI_NAME and WAI_ID = inst_id;
  job := (select top 1 R_JOB_ID from BLOG..SYS_ROUTING where R_ITEM_ID = blog_id and R_TYPE_ID = 3 and R_PROTOCOL_ID = 6);
  select U_ID into user_id from DB.DBA.SYS_USERS where U_NAME = uname;

  ruls := DB.DBA.user_tag_rules (user_id);
  for select B_TITLE, B_CONTENT, B_POST_ID from BLOG..SYS_BLOGS where B_BLOG_ID = blog_id do
    {
      flag := BLOG.DBA.RE_TAG_POST (blog_id, B_POST_ID, user_id, inst_id, B_CONTENT, keep_existing_tags, dummy, job, ruls, 1);
      if (job is not null and length (flag))
	{
	  insert replacing BLOG..SYS_BLOGS_ROUTING_LOG (RL_JOB_ID, RL_POST_ID, RL_TYPE) values (job, B_POST_ID, flag);
	}
    }
  rc := 1;
  msg := '';
ret:
  return ods_serialize_int_res (rc);
}
;

grant execute on ODS.ODS_API."weblog.post.new" to ODS_API;
grant execute on ODS.ODS_API."weblog.post.edit" to ODS_API;
grant execute on ODS.ODS_API."weblog.post.delete" to ODS_API;
grant execute on ODS.ODS_API."weblog.post.get" to ODS_API;
grant execute on ODS.ODS_API."weblog.comment.get" to ODS_API;
grant execute on ODS.ODS_API."weblog.comment.approve" to ODS_API;
grant execute on ODS.ODS_API."weblog.comment.delete" to ODS_API;
grant execute on ODS.ODS_API."weblog.comment.new" to ODS_API;
grant execute on ODS.ODS_API."weblog.get" to ODS_API;
grant execute on ODS.ODS_API."weblog.options.set" to ODS_API;
grant execute on ODS.ODS_API."weblog.options.get" to ODS_API;
grant execute on ODS.ODS_API."weblog.upstreaming.set" to ODS_API;
grant execute on ODS.ODS_API."weblog.upstreaming.get" to ODS_API;
grant execute on ODS.ODS_API."weblog.upstreaming.remove" to ODS_API;
grant execute on ODS.ODS_API."weblog.tagging.set" to ODS_API;
grant execute on ODS.ODS_API."weblog.tagging.retag" to ODS_API;

use DB;