FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Bug Reports » FUDforum2go - sql errors when reloading from backup
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
FUDforum2go - sql errors when reloading from backup [message #165810] Sat, 13 August 2011 15:20
TonyMarston is currently offline  TonyMarston   United Kingdom
Messages: 32
Registered: April 2006
Location: Surrey, UK
Karma: 0
Member
I have installed FUDforum2go v3.0.2 on my PC and am trying to import the backup from the forum on my hosted server (also v3.0.2) but it keeps failing with various sql errors:

1) Fatal error: Uncaught exception 'Exception' with message '(F:\Apache2\HTDOCS\FUDforum2go_win_v3.0.2\htdocs\include\theme\default\db. inc:101 <br />
F:\Apache2\HTDOCS\FUDforum2go_win_v3.0.2\htdocs\include\theme\default\db.in c:108 <br />
F:\Apache2\HTDOCS\FUDforum2go_win_v3.0.2\htdocs\adm\admimport.php:192<br />
) 23000: fud30_mime.fl_ext may not be NULL<br />
Query: INSERT INTO fud30_mime VALUES ('40',NULL,'application/octet-stream','Unknown','unknown.gif')<br />
_POST: array ( 'S' =&gt; '8f58283dfb463fdbbc0dd30241609d3a', 'SQ' =&gt; 'ae15510923b424dec09841846314ad82', 'path' =&gt; 'F:/Apache2/HTDOCS/FUDforum2go_win_v3.0.2/htdocs/tmp/FUDforum_11_08_2011_06 _16.fud', 'skipsearch' =&gt; 'y', 'btn_submit' =&gt; 'Import Data', )<br />
Database version: 3.3.7undefined<br />
[Referring Page] http://127.0.0.1:4001/adm/admimport.php<br />
' in F:\Apache2\HTDOCS\FUDforum2go_win_v3.0.2\htdocs\include\core.inc:215 Stack trace: #0 F:\Apache2\HTDOCS\FUDforum2go_win_v3.0.2\htdocs\include\theme\default\db.in c(101): fud_sql_error_handler('INSERT INTO fud...', 'fud30_mime.fl_e...', '23000', '3.3.7undefined') #1 F:\Apache2\HTDOCS\FUDforum2go_win_v3.0.2\htdocs\include\theme\default\db.in c(108): uq('INSERT INTO fud...', 1) #2 F:\Apache2\HTDOCS\FUDforum2go_win_v3.0.2\htdocs\adm\admimport.php(192): q('INSERT INTO fud...') #3 {main} thrown in F:\Apache2\HTDOCS\FUDforum2go_win_v3.0.2\htdocs\include\core.inc on line 215

The result was the same even after changing NULL to '' (empty string).

It was eventually fixed by changing NULL to '-'.

2) Fatal error: Uncaught exception 'Exception' with message '(F:\Apache2\HTDOCS\FUDforum2go_win_v3.0.2\htdocs\include\theme\default\db. inc:101 <br />
F:\Apache2\HTDOCS\FUDforum2go_win_v3.0.2\htdocs\include\theme\default\db.in c:108 <br />
F:\Apache2\HTDOCS\FUDforum2go_win_v3.0.2\htdocs\adm\admimport.php:192<br />
) HY000: unrecognized token: "',NULL,NULL)"<br />
Query: INSERT INTO fud30_msg VALUES ('412','128','64','0','192.8.222.166',NULL,'1163782368','0','0',NULL,'Faile d opening required NULLclasses/php_session.class.inc\NULL,'0','0','77824','551','30000','0','0 ','0',NULL,NULL,NULL,'1','1',NULL,NULL) <br />
_POST: array ( 'S' =&gt; '7924ee7f474f92480a0187fcad6b1640', 'SQ' =&gt; '3e1305208e57b7db209a646264debe20', 'path' =&gt; 'F:/Apache2/HTDOCS/FUDforum2go_win_v3.0.2/htdocs/tmp/FUDforum_11_08_2011_06 _16.fud', 'skipsearch' =&gt; 'y', 'btn_submit' =&gt; 'Import Data', )<br />
Database version: 3.3.7undefined<br />
[Referring Page] http://127.0.0.1:4001/adm/admimport.php?S=7924ee7f474f92480a0187fcad6b1640& amp;amp;SQ=3e1305208e57b7db209a646264debe20<br />
' in F:\Apache2\HTDOCS\FUDforum2go_win_v3.0.2\htdocs\include\core.inc:215 Stack trace: #0 F:\Apache2\HTDOCS\FUDforum2go_win_v3.0.2\htdocs\include\theme\default\db.in c(101): fud_sql_error_handler('INSERT INTO fud...', 'unrecognized to...', 'HY000', '3.3.7undefined') #1 F:\Apache2\HTDOCS\FUDforum2go_win_v3.0.2\htdocs\include\theme\default\db.in c(108): uq('INSERT INTO fud...', 1) #2 F:\Apache2\HTDOCS\FUDforum2go_win_v3.0.2\htdocs\adm\admimport.php(192): q('INSERT INTO fud...') #3 {main} thrown in F:\Apache2\HTDOCS\FUDforum2go_win_v3.0.2\htdocs\include\core.inc on line 215

Changed this line:
('412','128','64','0','192.8.222.166',NULL,'1163782368','0','0',NULL,'Faile d opening required \'classes/php_session.class.inc\\','0','0','77824','551','30000','0','0','0 ',NULL,NULL,NULL,'1','1',NULL,NULL)

into this:
('412','128','64','0','192.8.222.166',NULL,'1163782368','0','0',NULL,'Faile d opening required \'classes/php_session.class.inc\'','0','0','77824','551','30000','0','0','0 ',NULL,NULL,NULL,'1','1',NULL,NULL)

3) Fatal error: Uncaught exception 'Exception' with message '(F:\Apache2\HTDOCS\FUDforum2go_win_v3.0.2\htdocs\include\theme\default\db. inc:101 <br />
F:\Apache2\HTDOCS\FUDforum2go_win_v3.0.2\htdocs\include\theme\default\db.in c:108 <br />
F:\Apache2\HTDOCS\FUDforum2go_win_v3.0.2\htdocs\adm\admimport.php:192<br />
) HY000: near "'Build DirectoryNULL is not working!'": syntax error<br />
Query: INSERT INTO fud30_msg VALUES ('1066','268','121','0','70.188.190.207',NULL,'1188421599','0','0',NULL,NUL L'Build DirectoryNULL is not working!','0','0','167538','924','30000','0','0','0',NULL,NULL,NULL,'1','1' ,NULL,NULL) <br />
_POST: array ( 'S' =&gt; '1c1fcf315fe3f81b9e5c269df17ed904', 'SQ' =&gt; '7129dbcbec3d79c0dcfbc1efc83dd4d7', 'path' =&gt; 'F:/Apache2/HTDOCS/FUDforum2go_win_v3.0.2/htdocs/tmp/FUDforum_11_08_2011_06 _16.fud', 'skipsearch' =&gt; 'y', 'btn_submit' =&gt; 'Import Data', )<br />
Database version: 3.3.7undefined<br />
[Referring Page] http://127.0.0.1:4001/adm/admimport.php?S=1c1fcf315fe3f81b9e5c269df17ed904& amp;amp;SQ=7129dbcbec3d79c0dcfbc1efc83dd4d7<br />
' in F:\Apache2\HTDOCS\FUDforum2go_win_v3.0.2\htdocs\include\core.inc:215 Stack trace: #0 F:\Apache2\HTDOCS\FUDforum2go_win_v3.0.2\htdocs\include\theme\default\db.in c(101): fud_sql_error_handler('INSERT INTO fud...', 'near "'Build Di...', 'HY000', '3.3.7undefined') #1 F:\Apache2\HTDOCS\FUDforum2go_win_v3.0.2\htdocs\include\theme\default\db.in c(108): uq('INSERT INTO fud...', 1) #2 F:\Apache2\HTDOCS\FUDforum2go_win_v3.0.2\htdocs\adm\admimport.php(192): q('INSERT INTO fud...') #3 {main} thrown in F:\Apache2\HTDOCS\FUDforum2go_win_v3.0.2\htdocs\include\core.inc on line 215

Changed this line:
('1066','268','121','0','70.188.190.207',NULL,'1188421599','0','0',NULL,'\' Build Directory\' is not working!','0','0','167538','924','30000','0','0','0',NULL,NULL,NULL,'1','1' ,NULL,NULL)

into this:
('1066','268','121','0','70.188.190.207',NULL,'1188421599','0','0',NULL,'"Build Directory" is not working!','0','0','167538','924','30000','0','0','0',NULL,NULL,NULL,'1','1' ,NULL,NULL)

4) Fatal error: Uncaught exception 'Exception' with message '(F:\Apache2\HTDOCS\FUDforum2go_win_v3.0.2\htdocs\include\theme\default\db. inc:101 <br />
F:\Apache2\HTDOCS\FUDforum2go_win_v3.0.2\htdocs\include\theme\default\db.in c:108 <br />
F:\Apache2\HTDOCS\FUDforum2go_win_v3.0.2\htdocs\adm\admimport.php:192<br />
) 23000: fud30_users.time_zone may not be NULL<br />
Query: INSERT INTO fud30_users VALUES ('231','xiaoling','xiaoling','05becfd18da8b788d294edd3c68e684d03d68407','f3 a55917f','xiaoling','lingling84(at)yahoo(dot)cn' ,NULL,NULL,NULL,'0',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'0',N ULL,NULL,'1305617900','0',NULL,'1','0','1305682484','0','1305617900',NULL,N ULL,'3','0','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'4422134','e5abdaf3299a2 349a9c3fdd785136773','1850745139','1850745139','0','40','1306747511',NULL,N ULL,NULL) <br />
_POST: array ( 'S' =&gt; 'ba2865d570ec8f442dad7eadfa770e35', 'SQ' =&gt; '06366d72e61270ea7ca9709a4aeea975', 'path' =&gt; 'F:/Apache2/HTDOCS/FUDforum2go_win_v3.0.2/htdocs/tmp/FUDforum_11_08_2011_06 _16.fud', 'skipsearch' =&gt; 'y', 'btn_submit' =&gt; 'Import Data', )<br />
Database version: 3.3.7undefined<br />
[Referring Page] http://127.0.0.1:4001/adm/admimport.php?S=ba2865d570ec8f442dad7eadfa770e35& amp;amp;SQ=06366d72e61270ea7ca9709a4aeea975<br />
' in F:\Apache2\HTDOCS\FUDforum2go_win_v3.0.2\htdocs\include\core.inc:215 Stack trace: #0 F:\Apache2\HTDOCS\FUDforum2go_win_v3.0.2\htdocs\include\theme\default\db.in c(101): fud_sql_error_handler('INSERT INTO fud...', 'fud30_users.tim...', '23000', '3.3.7undefined') #1 F:\Apache2\HTDOCS\FUDforum2go_win_v3.0.2\htdocs\include\theme\default\db.in c(108): uq('INSERT INTO fud...', 1) #2 F:\Apache2\HTDOCS\FUDforum2go_win_v3.0.2\htdocs\adm\admimport.php(192): q('INSERT INTO fud...') #3 {main} thrown in F:\Apache2\HTDOCS\FUDforum2go_win_v3.0.2\htdocs\include\core.inc on line 215

Changed this line:
('231','xiaoling','xiaoling','05becfd18da8b788d294edd3c68e684d03d68407','f3 a55917f','xiaoling','lingling84(at)yahoo(dot)cn' ,NULL,NULL,NULL,'0',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'0',N ULL,NULL,'1305617900','0',NULL,'1','0','1305682484','0','1305617900',NULL,N ULL,'3','0','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'4422134','e5abdaf3299a2 349a9c3fdd785136773','1850745139','1850745139','0','40','1306747511',NULL,N ULL,NULL)

into this:
('231','xiaoling','xiaoling','05becfd18da8b788d294edd3c68e684d03d68407','f3 a55917f','xiaoling','lingling84(at)yahoo(dot)cn' ,NULL,NULL,NULL,'0',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'0',' UTC',NULL,'1305617900','0',NULL,'1','0','1305682484','0','1305617900',NULL, NULL,'3','0','0',NULL,NULL,NULL,NULL,NULL,NULL,NULL,'4422134','e5abdaf3299a 2349a9c3fdd785136773','1850745139','1850745139','0','40','1306747511',NULL, NULL,NULL)

I get the impression that your code is building the sql INSERT strings without escaping the embedded quotes, and then trying to insert the backslashes afterwards. If so this is totally the wrong approach - you should always use addslashes() on each value as it is being written to the output stream. It may be slower, but at least it does not generate invalid sql.


Tony Marston
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: 3.0.3 RC1: Issues with pie chart for disk usage in ACP
Next Topic: FUDforum2go - There is already an active transaction
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Thu Sep 19 01:41:52 GMT 2024

Total time taken to generate the page: 0.02205 seconds