Assist Support Guide: Difference between revisions

From Calidus HUB
(Categorisation)
(Updated)
Line 22: Line 22:


== Common Queries ==
== Common Queries ==
<code>
<code><pre>
-- Find the page ID
-- Assist SQL
SELECT * FROM obs_assist.obs_page
WHERE PAGE_TITLE LIKE '%SDD_366558%';


-- Find all revisions (to change comments)
-- Find the page ID
SELECT * FROM obs_assist.obs_revision
SELECT * FROM obs_assist.obs_page
where rev_page IN
WHERE PAGE_TITLE LIKE '%SDD_366558%';
(SELECT page_id FROM obs_assist.obs_page
WHERE PAGE_TITLE LIKE '%SDD_366558%'
);


-- Find unpatrolled pages to set them patrolled
SELECT *
FROM obs_assist.obs_recentchanges
where rc_patrolled = 0;
UPDATE obs_assist.obs_recentchanges
SET rc_patrolled = 1
where rc_user_text = 'StylesC'
and rc_patrolled = 0;


-- Check the logs for details of PDF production
-- Find all revisions (to change comments)
SELECT * FROM obs_assist.obs_logging
SELECT * FROM obs_assist.obs_revision
where log_action ='PdfBook'
where rev_page IN
order by log_id desc;
(SELECT page_id FROM obs_assist.obs_page
</code>
WHERE PAGE_TITLE LIKE '%SDD_366558%'
);


-- Find unpatrolled pages to set them patrolled
SELECT *
FROM obs_assist.obs_recentchanges
where rc_patrolled = 0;


[[Category:Technical Guides]][[Category:Assist Guides]][[
UPDATE obs_assist.obs_recentchanges
SET rc_patrolled = 1
where rc_user_text = 'StylesC'
and rc_patrolled = 0;
 
-- Check the logs for details of PDF production
SELECT * FROM mts_assist.oh_logging
where log_action ='PdfBook'
order by log_id desc;
 
-- For v1.34 and later, comments have changed:
SELECT log.*, CONVERT(comment.comment_text USING utf8) comment
FROM epod_assist.epodlogging log
left join epod_assist.epodcomment comment
on comment.comment_id = log.log_comment_id
where log_action ='PdfBook'
ORDER BY log_id DESC
LIMIT 20;
 
</pre></code>
 
 
[[Category:Technical Guides]][[Category:Assist Guides]]

Revision as of 10:53, 5 August 2024

Requirements

MySQL WorkBench


Updating Data En Mass

By default, MySQL will not allow updating of data without explicit WHERE or LIMIT clauses. To enable this:

  • Go to "Edit/Preferences"
  • Choose "SQL Editor" Under "Query Results"
  • Check "Safe Updates"
  • Restart MySQL WorkBench.

Warning Warning: You will then be able to (for example) delete all data inadvertently, so enable this option with care.


Viewing BLOB fields

By default, MySQL WorkBench displays all text fields as "BLOB", which you must then right-click and choose "Open Value in Editor". To enable viewing the text directly in the results, do the following:

  • Go to "Edit/Preferences"
  • Choose "SQL Editor" Under "Query Results"
  • Check "Treat BINARY/VARBINARY as nonbinary character string"
  • Restart MySQL WorkBench.

Note Note: Enabling this option comes with a performance hit - some text fields contain the entire page data, so enable this with care.


Common Queries

-- Assist SQL

-- Find the page ID
SELECT * FROM obs_assist.obs_page
WHERE PAGE_TITLE LIKE '%SDD_366558%';


-- Find all revisions (to change comments)
SELECT * FROM obs_assist.obs_revision
where rev_page IN 
(SELECT page_id FROM obs_assist.obs_page
WHERE PAGE_TITLE LIKE '%SDD_366558%'
);

-- Find unpatrolled pages to set them patrolled
SELECT * 
FROM obs_assist.obs_recentchanges
where rc_patrolled = 0;

UPDATE obs_assist.obs_recentchanges
SET rc_patrolled = 1
where rc_user_text = 'StylesC'
and rc_patrolled = 0;

-- Check the logs for details of PDF production
SELECT * FROM mts_assist.oh_logging
where log_action ='PdfBook'
order by log_id desc;

-- For v1.34 and later, comments have changed:
SELECT log.*, CONVERT(comment.comment_text USING utf8) comment
FROM epod_assist.epodlogging log 
left join epod_assist.epodcomment comment
on comment.comment_id = log.log_comment_id
where log_action ='PdfBook'
ORDER BY log_id DESC
LIMIT 20;