Seite 1 von 2

SQL-Befehle in die Datenbank?.....

Verfasst: 29.12.2003 06:28
von Tobias Claren
Hallo

Ich habe mit Easymod den Categories-Hierarchy-Mod installiert.

Nun wollte ich die SQL-Befehle in phpMyAdmin eintragen will, gibt es Probleme.

Dies sind die Anweisungen :
#-----[ SQL ]-------------------------------------------------
#
ALTER TABLE phpbb_categories ADD cat_main_type CHAR(1);
ALTER TABLE phpbb_categories ADD cat_main MEDIUMINT(8) UNSIGNED DEFAULT '0' NOT NULL;
ALTER TABLE phpbb_categories ADD cat_desc TEXT NOT NULL;
ALTER TABLE phpbb_categories ADD icon VARCHAR(255);
ALTER TABLE phpbb_forums ADD forum_link VARCHAR(255);
ALTER TABLE phpbb_forums ADD forum_link_internal TINYINT(1) NOT NULL;
ALTER TABLE phpbb_forums ADD forum_link_hit_count TINYINT(1) NOT NULL;
ALTER TABLE phpbb_forums ADD forum_link_hit BIGINT(20) UNSIGNED NOT NULL;
ALTER TABLE phpbb_forums ADD icon VARCHAR(255);
#
#-----[ SQL ]-------------------------------------------------
#
# the next request is optional. Run it only if you plan to use the real sub-forums feature
#
ALTER TABLE phpbb_forums ADD main_type CHAR(1);
#
#-----[ SQL ]-------------------------------------------------
#
# This part is optional : do it only if you want your users to be able to choose their setup
# if you want so, you'll have to install the MOD-mods_settings mod included in the pack
#
ALTER TABLE phpbb_users ADD user_sub_forum TINYINT(1) DEFAULT '1' NOT NULL;
ALTER TABLE phpbb_users ADD user_split_cat TINYINT(1) DEFAULT '1' NOT NULL;
ALTER TABLE phpbb_users ADD user_last_topic_title TINYINT(1) DEFAULT '1' NOT NULL;
ALTER TABLE phpbb_users ADD user_sub_level_links TINYINT(1) DEFAULT '2' NOT NULL;
ALTER TABLE phpbb_users ADD user_display_viewonline TINYINT(1) DEFAULT '2' NOT NULL;
#

Der erste Befehl wird ausgeführt, der zweite funktioniert aber schon nicht.
Zum Test habe ich den ersten noch mal ausgeführt, was wie vorher funtioniert.

Was ich nicht tat, war worher diesen "Cache-Mod" (bnötigt die 2.0.5 jetzt anscheinend) der jetzt dazu gehört zu installieren.
Ich galube das stand was davon, das der vorher rein muss.
Aber das sollte doch keinen Einfluss auf die Ausführung der Befehle oben haben (?).
Zur Not installiere ich den hinterher noch, aber so komme ich gar nicht mehr in das Forum.


Auch verstehe ich nicht ganz was die zwei optionalen Teile (s.o.) für eine Funktion haben.
Sollte ich die auch ausführen?
Den zweiten Teil (Mod für sich) des Mods an sich sollte ich anscheinend installieren, da er das ACP verbessert.


Grüße,
Tobias Claren

Verfasst: 29.12.2003 07:22
von itst
Du versuchst also, den ersten Block einzupflegen? Welchen Meldung gibt phpMyAdmin von sich?

Verfasst: 29.12.2003 08:02
von Tobias Claren
Nachdem eine Fehlermeldung kam, versuchte ich es einzeln.
Die erste ging, die zweite meldete dies:

Fehler

SQL-Befehl :

ALTER TABLE phpbb_categories ADD cat_main MEDIUMINT(8) UNSIGNED

MySQL meldet:


Duplicate column name 'cat_main'

Verfasst: 29.12.2003 08:19
von itst
Das bedeutet, das die Spalte 'cat_main' bereits angelegt wurde.

Versuch bitte, die Anweisungen des ersten Block einzeln auszuführen und achte dabei auch Fehlermeldungen.

usw......

Verfasst: 29.12.2003 09:32
von Tobias Claren
2.)

Code: Alles auswählen

ALTER TABLE phpbb_forums ADD forum_link_internal TINYINT(1) NOT NULL;
SQL-Befehl :
ALTER TABLE phpbb_forums ADD forum_link_internal TINYINT(1) NOT
MySQL meldet:
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 '' at line 1
3.)

Code: Alles auswählen

ALTER TABLE phpbb_forums ADD forum_link_hit_count TINYINT(1) NOT NULL;
Fehler
SQL-Befehl :
ALTER TABLE phpbb_forums ADD forum_link_hit_count TINYINT(1) NOT
MySQL meldet:
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 '' at line 1
4.)

Code: Alles auswählen

ALTER TABLE phpbb_forums ADD forum_link_hit BIGINT(20) UNSIGNED NOT NULL;
Fehler
SQL-Befehl :
ALTER TABLE phpbb_forums ADD forum_link_hit BIGINT(20) UNSIGNED
MySQL meldet:
Duplicate column name 'forum_link_hit'
5.)

Code: Alles auswählen

ALTER TABLE phpbb_forums ADD icon VARCHAR(255);
Fehler
SQL-Befehl :
ALTER TABLE phpbb_forums ADD icon
MySQL meldet:
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 '' at line 1
Alle diese Fehler treten bei den entsprechenden Befehlen auf.

Gebrauch von BBcodes ist übersichtlicher
Acid

Verfasst: 29.12.2003 11:26
von itst
4) hat sich erledigt, diese Spalte gibt es schon.

Was mich bei 2) bis 5) wundert, ist das phpMyAdmin bei der Wiedergabe des Befehls jeweils in paar Zeichen hinten abschneidet. Bei 2) wird aus "NOT NULL;" am Ende "NULL"...

Bist Du sicher, jeweils den kompletten Befehl in phpMyAdmin einzugeben? Lass mal versuchsweise das Semikolon weg.

2 geht ohne ;

Verfasst: 29.12.2003 14:08
von Tobias Claren
So nun funktioniert die zweite, aber die anderen nicht :( .

3.)

Code: Alles auswählen

ALTER TABLE phpbb_forums ADD forum_link_hit_count TINYINT(1) NOT NULL
Fehler

SQL-Befehl :

ALTER TABLE phpbb_forums ADD forum_link_hit_count TINYINT(1) NOT

MySQL meldet:


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 '' at line 1

5.)

Code: Alles auswählen

ALTER TABLE phpbb_forums ADD icon VARCHAR(255)
Fehler

SQL-Befehl :

ALTER TABLE phpbb_forums ADD icon

MySQL meldet:


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 '' at line 1

Verfasst: 29.12.2003 14:39
von itst
Habe beide Queries mal gegen meine Test-DB ausgeführt und sie haben beide - wie erwartet - einwandfrei funktioniert.

Die Fehlermeldung ist allerdings komisch, weil keine korrekte Position angegeben wird.

Versuch mal, die beiden Queries mit dem MySql-Client direkt auszuführen und schau mal, was der dann sagt.

?

Verfasst: 29.12.2003 23:21
von Tobias Claren
Ich kenne nur die phpMyAdmin-Oberfläche oberflächlich.
Was ist der MySQL-Klient?

Verfasst: 30.12.2003 09:29
von Flachzange
Versuch Dich mal damit, wenn Du den phpMyAdmin nicht so gut kennst. der rot markierte Teil sind Deine Änderungen:
<?php
define('IN_PHPBB', 1);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'config.'.$phpEx);
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/constants.'.$phpEx);
include($phpbb_root_path . 'includes/db.'.$phpEx);


// Start session management
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
// End session management


// Start User is Admin ?
if ( $userdata['user_level'] == ADMIN )
{
}
else
{
message_die(GENERAL_MESSAGE, $lang['Not_Authorised'], $lang['Not_Authorised']);
exit;
}
// End User is Admin ?


echo '<html>
<head>
<title>SQL-DB-Installer</title>
</head>
<body>
<h1>SQL-DB-Installer</h1>
<hr />';
if (!isset($HTTP_GET_VARS['install'])) {
echo '<a href="?install=1">Please click here | Bitte hier klicken</a>';
}
else {
$queries = array(

"ALTER TABLE " . $table_prefix . "categories ADD cat_main_type CHAR(1);",
"ALTER TABLE " . $table_prefix . "categories ADD cat_main MEDIUMINT(8) UNSIGNED DEFAULT '0' NOT NULL;",
"ALTER TABLE " . $table_prefix . "categories ADD cat_desc TEXT NOT NULL;",
"ALTER TABLE " . $table_prefix . "categories ADD icon VARCHAR(255);",
"ALTER TABLE " . $table_prefix . "forums ADD forum_link VARCHAR(255);",
"ALTER TABLE " . $table_prefix . "forums ADD forum_link_internal TINYINT(1) NOT NULL;",
"ALTER TABLE " . $table_prefix . "forums ADD forum_link_hit_count TINYINT(1) NOT NULL;",
"ALTER TABLE " . $table_prefix . "forums ADD forum_link_hit BIGINT(20) UNSIGNED NOT NULL;",
"ALTER TABLE " . $table_prefix . "forums ADD icon VARCHAR(255);",
"ALTER TABLE " . $table_prefix . "forums ADD main_type CHAR(1);",
"ALTER TABLE " . $table_prefix . "users ADD user_sub_forum TINYINT(1) DEFAULT '1' NOT NULL;",
"ALTER TABLE " . $table_prefix . "users ADD user_split_cat TINYINT(1) DEFAULT '1' NOT NULL;",
"ALTER TABLE " . $table_prefix . "users ADD user_last_topic_title TINYINT(1) DEFAULT '1' NOT NULL;",
"ALTER TABLE " . $table_prefix . "users ADD user_sub_level_links TINYINT(1) DEFAULT '2' NOT NULL;",
"ALTER TABLE " . $table_prefix . "users ADD user_display_viewonline TINYINT(1) DEFAULT '2' NOT NULL;"


);

$success = true;
foreach($queries as $query) {
if (!$db->sql_query($query)) {
echo '<font color="red">An error occurred ! Changes have not been entered successfully !<br /><br />Es Fehler ist aufgetreten ! Änderung nicht erfolgreich eingetragen !</font><br /><br />';
echo mysql_error();
$success = false;
break;
}
}
if ($success) {
echo '<font color="green">DB-Changes have been entered successfully. You should delete this SQL-DB-Installer as soon as possible !<br /><br />DB-Änderung wurde erfolgreich ausgeführt. Du solltest diesen SQL-DB-Installer sobald wie möglich löschen !';
}
}
?>