Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > General > Member Archives
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
INSERTing a thread ? Details »»
INSERTing a thread ?
Version: , by galt galt is offline
Developer Last Online: May 2009 Show Printable Version Email this Page

Version: Unknown Rating:
Released: 04-15-2002 Last Update: Never Installs: 0
 
No support by the author.

As I proceed along with my work-along CMS, I now need to create new threads from outside of VB. So far I have learned that when I insert a thread row:

I need to set up an invisible forum to attach the threads to (threadid <> 0)

I must set open = 1 (talk about a lousy variable name !!)
I must set visible = 1

That gives me a postable thread.

By accident during testing, I discovered that this was not enough. When I tried to Administratively change the topic name of the thread, I got a fatal error with the VB programs:
*****
Database error in vBulletin 2.2.4:

Invalid SQL: DELETE FROM searchindex WHERE wordid IN (0) AND postid=
mysql error: You have an error in your SQL syntax near '' at line 1

mysql error number: 1064

Date: Sunday 14th of April 2002 08:48:49 PM
Script: http://www.bobcosta.com/bcportal/vbb...b/postings.php
Referer: http://www.bobcosta.com/bcportal/vbb...ad&threadid=16

I am guessing that this is some sort of database inconsistency that was not expected by the VB program. Can someone verify this, or is it some other problem?

If I am correct, IMHO it is a lousy design that causes fatal crashes when the progarm encounters non-fatal dtabase inconsistencies. So I guess I have three questions:

1. What are my chances of getting this fixed by jelSoft in a reasonable time frame?

2. What do I have to do to my thread insert routine to populate the searchindex? I am not sure that I want these "add-on" threads searchable. Then again, maybe I do. I sure would like the option.

3. Are there any other "gotchas" I am headed for that anyone can warn me about?

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 04-16-2002, 10:01 AM
Admin's Avatar
Admin Admin is offline
Coder
 
Join Date: Oct 2023
Location: Server
Posts: 1
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

This is not a "lousy design", since your hacking caused this error. Blaming this on Jelsoft is the last thing you can do about it.

The program expects the thread to be populated with posts, like all threads are (when you first create a thread, you will see in newthread.php that a post is created as well). When you have a post-less thread vBulletin can't get the postid of the first post, which causes that error.

And I also don't understand how 'open' is a "lousy variable name", the name suggests this field means "Is this thread open for new posts?", where 1 means "Yes, it is open" while 0 means "No, it is closed". I think it's a perfect name, don't you?
Reply With Quote
  #3  
Old 04-16-2002, 11:36 AM
galt galt is offline
 
Join Date: Mar 2002
Location: USA
Posts: 48
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Ah, the rigors of design debates...

First off, your requirement to have a post for a thread seems fine, and I can certainly do that, I just need to figure out the timing within the system I am developing.

As far as designs being lousy, in the "delete" issue I am referring to code design, not system design. A program should NEVER crash IMHO when it gets unexpected data or encounters database inconsistencies. Parent-child relationships can get messed up for a variety of reasons in any database that does not enforce referential integrity. There is nearly always a better response than crashing, usually to ignore it and move on. But I will be happy to revisit this debate-issue when I have fixed MY hack-bug. Some inconsistencies SHOULD be fatal, I just do not think (based on my current understanding) that this should be one of them.

I support this conclusion by the fact that I was able to post replies to this thread, and it only crashed when I tried to change the thread title. Apparently, lack of any posts was not so disturbing to the system, just this particular piece of code. I might be wrong, some of my testing was pretty late at night.

As far as "open" being a bad variable name, open is a keyword in quite a few of the languages I have worked in. It could reasonably be co-opted as a keyword in PHP version 9. There may also come a day when someone rewrites vB (or just writes some extensions or objects for it) in a new (not PHP) language where open IS a keyword. Since it is buried in the database, this will require an unnecessary variance between the PHP database and the (new language) database. You can see where this might lead. if jelsoft is the one to do it, they could make the databases consistent but would have to do some (significant?) code changes to the existing system. And this database change cascades into hacks and extensions written by other people.

Thanks firefly for the quick and clear response. Please don't take my comments as criticism, but more in the nature of good-hearted debate. As Jelsoft opens its system and more people incorporate it into other systems, you will no doubt encounter other opinions wiser than my own.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 11:01 PM.


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.04201 seconds
  • Memory Usage 2,210KB
  • Queries Executed 16 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (3)post_thanks_box
  • (3)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (3)post_thanks_postbit_info
  • (2)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete