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

Reply
 
Thread Tools
SQL Query question - errors with ; Details »»
SQL Query question - errors with ;
Version: , by TeddyBare69 TeddyBare69 is offline
Developer Last Online: Apr 2005 Show Printable Version Email this Page

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

I have created the hack viPortfolio currently in Beta testing. I have gotten most of the errors taken care of but there is one that keeps coming back. I still have yet to be able to recreate it.

On some mysql databases, they get an error if there is a ; in the sql string during a doqueries call. Does anybody know why that is? My test/development server handles it just fine but most other servers including my production server does not. My system versions are below, I am not sure what versions other people are on exactly but it seems to be a wide variaty.

Anybody else had this problem?

mysql-max-4.0.1
php version 4.1.2
vBulletin 2.2.6

Thanks for your help!

Show Your Support

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

Comments
  #2  
Old 08-16-2002, 01:16 PM
Dark_Wizard Dark_Wizard is offline
 
Join Date: Nov 2001
Location: North Carolina
Posts: 1,251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Can you paste the code for us to review?
Reply With Quote
  #3  
Old 08-16-2002, 01:31 PM
TeddyBare69 TeddyBare69 is offline
 
Join Date: Jun 2002
Location: CA, US
Posts: 93
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You actually already have the code. It is doquery(). Here is the section of code that the error occured:

$loc = strpos( $val, ';' );
if ( $loc > 0 && strlen(trim($val)) > 1 )
{
$val[strlen($val) - 1] = ' ';
str_replace( ';', ' ', $val );
$DB_site->query($val);
if ($onvservers==1 and substr($val, 0, 5)=="ALTER")
{
$DB_site->link_id=0;
@mysql_close();

sleep(1);
$DB_site->connect();
}
}
I get the error on the $DB_site->query($val); line.

I have a function that takes a file name and reads the contents of the file. The contents of the file is an SQL statement which can be on either one line or multiple lines but has to end with a ; . The last time I got the error it was executing the following SQL

CREATE TABLE IF NOT EXISTS `viPortfolio` (
`viPortfolioid` smallint(6) unsigned NOT NULL auto_increment,
`userid` int(10) unsigned NOT NULL default '0',
`mimeid` mediumint unsigned NOT NULL default '1',
`filename` VARCHAR(250) NOT NULL,
`file` BLOB NOT NULL,
`thumb` BLOB NOT NULL,
`width` int(10) unsigned NOT NULL default '0',
`height` int(10) unsigned NOT NULL default '0',
`text` mediumtext NOT NULL,
`startdate` date NOT NULL,
`enddate` date,
`updateid` MEDIUMINT,
`viewcount` MEDIUMINT default '0',
PRIMARY KEY `userid` (`viPortfolioid`, `userid`, `mimeid`)
) TYPE=MyISAM;

Iinitialy I had place this line before the query statement:
$val[strlen($val) - 1] = ' ';

I must have had a space at the end of the line or something because the ; got past it. Then I replaced that line with the line below.
str_replace( ';', ' ', $val );

Yes, this does fix the problem. It takes the ; out of the statement so that MySql doesn't have to deal with it. I still would like to know why it cares. A ; has always been a statement ender in any DB system I have used before?
Reply With Quote
  #4  
Old 08-17-2002, 02:23 AM
TeddyBare69 TeddyBare69 is offline
 
Join Date: Jun 2002
Location: CA, US
Posts: 93
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Dark_Wizard,
Did you post a question then delete it? I got an email but I can't find the post here?
Reply With Quote
  #5  
Old 08-17-2002, 11:53 AM
Dark_Wizard Dark_Wizard is offline
 
Join Date: Nov 2001
Location: North Carolina
Posts: 1,251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I did...and now I'm puzzled...wtf? I didn't delete it....
Reply With Quote
  #6  
Old 08-17-2002, 12:49 PM
TeddyBare69 TeddyBare69 is offline
 
Join Date: Jun 2002
Location: CA, US
Posts: 93
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I deleted the email but I think your question was:

what are these ` doing in the sql file?

My highly educated, extremely knowledgable answer to that question is "because"? I seen it done before and it looked more organized than not doing it so I started to use.

Now that I think about it, it would make sense that could cause errors, it doesn't make sense that it causes errors on other servers but not mine? Unless there was some feature was added to handle those apostrophies?
Reply With Quote
  #7  
Old 08-17-2002, 12:52 PM
Dark_Wizard Dark_Wizard is offline
 
Join Date: Nov 2001
Location: North Carolina
Posts: 1,251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Try removing them as I did and the install worked fine for me...I use PHP 4.2.2 on my server...
Reply With Quote
  #8  
Old 08-17-2002, 02:27 PM
TeddyBare69 TeddyBare69 is offline
 
Join Date: Jun 2002
Location: CA, US
Posts: 93
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I just did that and I am going to send the update sql files to Apok2002 and see if it fixes his problem also. I have Mysql 4.1.2 and I dont' have a problem with them.

You have 4.2.2 and you did have a problem with the sql files. Now that you removed the ' and ` it fixes the problem. I sure hope so. I will walk away with a lesson well learned.
Reply With Quote
  #9  
Old 08-17-2002, 03:27 PM
Dark_Wizard Dark_Wizard is offline
 
Join Date: Nov 2001
Location: North Carolina
Posts: 1,251
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I have PHP 4.2.2 not MySQL 4.2.2. My MySQL is version 3.23.39
Reply With Quote
  #10  
Old 08-17-2002, 03:38 PM
TeddyBare69 TeddyBare69 is offline
 
Join Date: Jun 2002
Location: CA, US
Posts: 93
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

yeah, my mistake. This was the very first bug reported and looks like it might be the very last one to be fixed. A little flustered is all. I have php 4.1.2 and mysql 4.0.1-alpha

I can defanately see this as a minor code improvement that probably didn't even get notied in the change log or final release. Thanks agian for your help. What kind of virtual brew you drink? Have one on me
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:13 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.04351 seconds
  • Memory Usage 2,284KB
  • Queries Executed 23 (?)
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
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)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
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete