vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   mysql "view" for editing thread.title & post.pagetext (https://vborg.vbsupport.ru/showthread.php?t=203683)

Rik Brown 01-31-2009 04:49 AM

mysql "view" for editing thread.title & post.pagetext
 
I've been trying to create my first mysql "view" in order to edit thread titles while viewing the corresponding pagetext to the first post in the thread. I'm using a mysql frontend, Navicat, to display the view but the underlying "view" syntax appears to be the problem.

Here's the basic syntax for the view:

select `thread`.`title` AS `title`,
`post`.`pagetext` AS `post_pagetext`,
`post`.`username` AS `post_username`,
`post`.`postid` AS `post_postid`,
`post`.`threadid` AS `post_threadid`,
`thread`.`forumid` AS `thread_forumid`,
`thread`.`dateline` AS `thread_dateline`
from (`post` join `thread`)
where (`post`.`threadid` = `thread`.`threadid`)
group by `thread`.`threadid`
having ((`thread`.`forumid` = _utf8'505')
and (`thread`.`dateline` < _utf8'1228090965'))
order by `thread`.`title`

I do get the correct view that I'm trying to get. However, I cannot edit the thread titles as I always get an error message advising that the "target table ..... of the update is not updateable."

Does anyone know how to change the view code above to make the target table "updateable" or perhaps has working code they can cut and paste here?

Thanks. -- Rik

Marco van Herwaarden 01-31-2009 10:13 AM

Why are you creating a view?

Rik Brown 02-01-2009 08:44 PM

Quote:

Originally Posted by Marco van Herwaarden (Post 1729818)
Why are you creating a view?

Because a view will allow me to "view" the database in ways not available through vb.

For example, I can load 1,000 (or more) rows of information into what looks almost like an Excel spreadsheet and pagedown or pageup through that data quickly to exaimine data that matches criteria that I cannot define within vb.

The view gives me much more control and speed than one can have going through vb as the frontend to the database. Plus, its simply time I expand my knowledge of mysql and learn more above constructing views. :)

Regards. -- Rik

Marco van Herwaarden 02-02-2009 10:42 AM

There is nothing that that you can do with a view, that you can't do on a regular table(s). But depending on the exact format, a view can not always be used to update data. vBulletin itself does not use any views.


All times are GMT. The time now is 12:10 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00991 seconds
  • Memory Usage 1,719KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete