# wBB 4 DB anpassen?



## Shorty1968 (31. Januar 2015)

Hallo ich möchte Folgenden Datenbank eintrag von einem wBB 3.1 Plugin,an das wBB 4 anpassen.

```
CREATE TABLE `wcf1_paste` (
`pasteID` INT( 20 ) NOT NULL AUTO_INCREMENT ,
`source` LONGTEXT NOT NULL ,
`language` VARCHAR( 255 ) NOT NULL ,
`userID` INT( 20 ) NOT NULL ,
`timestamp` INT( 20 ) NOT NULL ,
PRIMARY KEY ( `pasteID` )
) ENGINE = MYISAM ;

CREATE TABLE `wcf1_paste_languages` (
`pasteLanguageID` INT( 20 ) NOT NULL AUTO_INCREMENT ,
`pasteLanguage` VARCHAR( 255 ) NOT NULL ,
PRIMARY KEY ( `pasteLanguageID` )
) ENGINE = MYISAM ;

INSERT INTO `wcf1_paste_languages` (`pasteLanguageID`, `pasteLanguage`) VALUES (NULL, "autoit"), (NULL, "c"), (NULL, "csharp"), (NULL, "css"), (NULL, "delphi"), (NULL, "diff"), (NULL, "html4strict"), (NULL, "java5"), (NULL, "javascript"), (NULL, "sql"), (NULL, "php"), (NULL, "vbnet"), (NULL, "xml"), (NULL, "cpp"), (NULL, "smarty");
```
Ich habe es schon erfolglos mit Folgendem Versucht.

```
DROP TABLE IF EXISTS wcf1_paste;
CREATE TABLE wcf1_paste (
pasteID INT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
source LONGTEXT NOT NULL,
language VARCHAR(255) NOT NULL,
userID INT(20) NOT NULL,
timestamp INT(20) NOT NULL
);

DROP TABLE IF EXISTS wcf1_paste_languages;
CREATE TABLE wcf1_paste_languages (
pasteLanguageID INT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,
pasteLanguage VARCHAR(255) NOT NULL,
autoit NULL,
c NULL,
csharp NULL,
css NULL,
delphi NULL,
diff NULL,
html4strict NULL,
java5 NULL,
javascript NULL,
sql NULL,
php NULL,
vbnet NULL,
xml NULL,
cpp NULL,
smarty NULL
);
```
Ich bekomme dann Folgenden Fehler.

```
Fatal error: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'null,c null,csharp null,css null,delphi null,diff null,html4strict null,java5 nu' at line 2
Information:
id: 2159989f60c2dafa906aca6c3d139aff83d9bdf2
error message: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'null,c null,csharp null,css null,delphi null,diff null,html4strict null,java5 nu' at line 2
error code: 42000
sql type: wcf\system\database\MySQLDatabase
sql error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'null,c null,csharp null,css null,delphi null,diff null,html4strict null,java5 nu' at line 2
sql error number: 42000
sql version: 5.5.40-0+wheezy1
sql query: CREATE TABLE wcf1_paste_languages ( pasteLanguageID int(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,pasteLanguage varchar(255) NOT NULL,autoit null,c null,csharp null,css null,delphi null,diff null,html4strict null,java5 null,javascript null,sql null,php null,vbnet null,xml null,cpp null,smarty null ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
file: /var/www/vhosts/wbb-area.eu/httpdocs/wcf/lib/system/database/Database.class.php (231)
php version: 5.4.35-0+deb7u2
wcf version: 2.1.0 Beta 3 (Typhoon)
date: Sat, 31 Jan 2015 21:43:46 +0000
request: /acp/?InstallPackage/&t=051fcf57663947f8850278f5a679034f89f7f5b1&s=ad2a5be70ec15a77dbdbe2a1e3aae4bf259736d4
referer: http://wbb-area.eu/acp/?packageinstallationconfirm/&queueID=479&s=ad2a5be70ec15a77dbdbe2a1e3aae4bf259736d4

Stacktrace:
#0 /var/www/vhosts/wbb-area.eu/httpdocs/wcf/lib/system/database/editor/MySQLDatabaseEditor.class.php(98): wcf\system\database\Database->prepareStatement('CREATE TABLE wc...')
#1 /var/www/vhosts/wbb-area.eu/httpdocs/wcf/lib/system/database/util/SQLParser.class.php(223): wcf\system\database\editor\MySQLDatabaseEditor->createTable('wcf1_paste_lang...', Array, Array)
#2 /var/www/vhosts/wbb-area.eu/httpdocs/wcf/lib/system/package/PackageInstallationSQLParser.class.php(275): wcf\system\database\util\SQLParser->executeCreateTableStatement('wcf1_paste_lang...', Array, Array)
#3 /var/www/vhosts/wbb-area.eu/httpdocs/wcf/lib/system/database/util/SQLParser.class.php(113): wcf\system\package\PackageInstallationSQLParser->executeCreateTableStatement('wcf1_paste_lang...', Array, Array)
#4 /var/www/vhosts/wbb-area.eu/httpdocs/wcf/lib/system/database/util/SQLParser.class.php(49): wcf\system\database\util\SQLParser->executeStatement('CREATE TABLE', 'CREATE TABLE wc...')
#5 /var/www/vhosts/wbb-area.eu/httpdocs/wcf/lib/system/package/plugin/SQLPackageInstallationPlugin.class.php(78): wcf\system\database\util\SQLParser->execute()
#6 /var/www/vhosts/wbb-area.eu/httpdocs/wcf/lib/system/package/PackageInstallationDispatcher.class.php(571): wcf\system\package\plugin\SQLPackageInstallationPlugin->install()
#7 /var/www/vhosts/wbb-area.eu/httpdocs/wcf/lib/system/package/PackageInstallationDispatcher.class.php(139): wcf\system\package\PackageInstallationDispatcher->executePIP(Array)
#8 /var/www/vhosts/wbb-area.eu/httpdocs/wcf/lib/acp/action/InstallPackageAction.class.php(73): wcf\system\package\PackageInstallationDispatcher->install('b1114a7b')
#9 /var/www/vhosts/wbb-area.eu/httpdocs/wcf/lib/action/AbstractDialogAction.class.php(70): wcf\acp\action\InstallPackageAction->stepInstall()
#10 /var/www/vhosts/wbb-area.eu/httpdocs/wcf/lib/action/AbstractAction.class.php(49): wcf\action\AbstractDialogAction->execute()
#11 /var/www/vhosts/wbb-area.eu/httpdocs/wcf/lib/system/request/Request.class.php(58): wcf\action\AbstractAction->__run()
#12 /var/www/vhosts/wbb-area.eu/httpdocs/wcf/lib/system/request/RequestHandler.class.php(125): wcf\system\request\Request->execute()
#13 /var/www/vhosts/wbb-area.eu/httpdocs/acp/index.php(10): wcf\system\request\RequestHandler->handle('wbb', true)
#14 {main}
```


----------



## sheel (31. Januar 2015)

```
...
autoit NULL,
c NULL,
csharp NULL,
css NULL,
delphi NULL,
diff NULL,
html4strict NULL,
java5 NULL,
javascript NULL,
sql NULL,
php NULL,
vbnet NULL,
xml NULL,
cpp NULL,
smarty NULL
...
```

Das gehört dringend in mehrere Tabellen aufgespalten.
Sehe den Fehler grad auch nicht, aber bei einer anderen Anweisung hat man ihn auch nicht mehr...

PS: Danke Syntaxhighlighting, ein Fehler ist sicher einmal die Verwendung von "SQL" als Spaltenname.
http://dev.mysql.com/doc/refman/5.6/en/reserved-words.html


----------



## Shorty1968 (31. Januar 2015)

Ich kenne mich mit SQL noch weniger aus wie mit PHP,ich habe leider keine ahnung wie das aussehen müsste.


----------

