Wrong querys

Discussion on a SQL Parser for EasyMOD
Locked
User avatar
Paul Online
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 364
Joined: Thu Sep 16, 2004 9:02 am
Contact:

Wrong querys

Post by Paul » Sun Dec 04, 2005 1:32 pm

If I run the next querys into the online tool:

Code: Select all

ALTER TABLE 'phpbb_banlist' ADD 'reason' TEXT;
ALTER TABLE 'phpbb_banlist' ADD 'by_id' INT(10) default '-1';
ALTER TABLE 'phpbb_banlist' ADD 'time' INT(10);
ALTER TABLE 'phpbb_banlist' ADD 'ban_cookie' INT(10);
ALTER TABLE 'phpbb_banlist' ADD 'cookie_id' VARCHAR(64);
ALTER TABLE 'phpbb_banlist' ADD 'reason_private' TEXT ;
UPDATE phpbb_banlist SET by_id = '-1' WHERE by_id <= 1;
I got this in a db update file:

Code: Select all

$sql = array();
$sql[] = 'ALTER TABLE ___0___ ADD ___1___ TEXT';
$sql[] = 'ALTER TABLE ___2___ ADD ___3___ INTEGER(10) DEFAULT -1';
$sql[] = 'ALTER TABLE ___5___ ADD ___6___ INTEGER(10)';
$sql[] = 'ALTER TABLE ___7___ ADD ___8___ INTEGER(10)';
$sql[] = 'ALTER TABLE ___9___ ADD ___10___ VARCHAR(64)';
$sql[] = 'ALTER TABLE ___11___ ADD ___12___ TEXT';
$sql[] = 'UPDATE ' . $table_prefix . 'banlist SET by_id = \'-1\' WHERE by_id <= 1';
$sql_count = count($sql);
I don't think, this is good :?


EDIT: The mod has finished, and has tested with easymod 0.3.0, and got the next error:

Code: Select all

Step 2 of 3
SQL Processing Results

The following is the result for each line of SQL executed. - ERRORS DETECTED
SQL ERROR
 
SQL PROCESSING HALTED

An error was encountered while processing the SQL commands. Further SQL processing has been halted. You may choose to complete the MOD installation anyway and perform the SQL commands manually yourself. However, at this point EM cannot guarantee the MOD will work correctly so you are best off seeking support from the Author before continuing further.

The failed line was&#58

ALTER TABLE ___0___ ADD ___1___ TEXT;;


SQL ERROR&#58 1146
Table 'ban_man.___0___' doesn't exist
 

  	The following SQL was attempted&#58 	Allow
   	

ALTER TABLE ___0___ ADD ___1___ TEXT;;

	FAILED
   	

ALTER TABLE ___2___ ADD ___3___ INTEGER(10) DEFAULT -1;;

	Not Attempted
   	

ALTER TABLE ___5___ ADD ___6___ INTEGER(10);;

	Not Attempted
   	

ALTER TABLE ___7___ ADD ___8___ INTEGER(10);;

	Not Attempted
   	

ALTER TABLE ___9___ ADD ___10___ VARCHAR(64);;

	Not Attempted
   	

ALTER TABLE ___11___ ADD ___12___ TEXT;;

	Not Attempted
   	

UPDATE phpbb_banlist SET by_id = '-1' WHERE by_id <= 1;;

	Not Attempted

EDIT2: Stupid, i have found what I do wrong :oops:

User avatar
markus_petrux
Registered User
Posts: 376
Joined: Fri Jun 18, 2004 10:58 pm
Location: Girona, Catalunya (Spain)
Contact:

Re: Wrong querys

Post by markus_petrux » Sun Dec 04, 2005 8:08 pm

Oh, it seems the parser gets fooled when using single quotes for the identifiers.

User avatar
Paul Online
Infrastructure Team Leader
Infrastructure Team Leader
Posts: 364
Joined: Thu Sep 16, 2004 9:02 am
Contact:

Re: Wrong querys

Post by Paul » Tue Dec 06, 2005 4:16 pm

markus_petrux wrote: Oh, it seems the parser gets fooled when using single quotes for the identifiers.
Yes, that was the problem :)

Locked