» »

MySQL sql mode in dodaten auto increment pri izvozu (obrazložitev)?

MySQL sql mode in dodaten auto increment pri izvozu (obrazložitev)?

Housy ::

Pozdravljeni,

bi mi lahko nekdo prosim obrazložil, kaj pomeni spodnji sql mode pri izvozu tabel:
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";


zanima me tudi, čemu služi dodaten auto increment na koncu strukture tabel?
CREATE TABLE IF NOT EXISTS `uporabniki` (
`id` smallint(3) NOT NULL auto_increment,
`uporabnik` varchar(15) collate utf8_slovenian_ci NOT NULL,
`geslo` varchar(32) collate utf8_slovenian_ci NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_slovenian_ci AUTO_INCREMENT=2 ;


Lp in hvala,
Housy

overlord_tm ::

NO_AUTO_VALUE_ON_ZERO affects handling of AUTO_INCREMENT columns. Normally, you generate the next sequence number for the column by inserting either NULL or 0 into it. NO_AUTO_VALUE_ON_ZERO suppresses this behavior for 0 so that only NULL generates the next sequence number.

This mode can be useful if 0 has been stored in a table's AUTO_INCREMENT column. (Storing 0 is not a recommended practice, by the way.) For example, if you dump the table with mysqldump and then reload it, MySQL normally generates new sequence numbers when it encounters the 0 values, resulting in a table with contents different from the one that was dumped. Enabling NO_AUTO_VALUE_ON_ZERO before reloading the dump file solves this problem. mysqldump now automatically includes in its output a statement that enables NO_AUTO_VALUE_ON_ZERO, to avoid this problem.


Torej, to naredis zato, da lahko normalno uvozis obstojece podatke v tabele. Pri CREATE TABLE ti tist AUTO_INCREMENT nastavi naslednjo AI vrednost, da ne bo zopet zacelo od 1 ostevilcevati.

Housy ::

Hvala overlord :)

Lp, Housy


Vredno ogleda ...

TemaSporočilaOglediZadnje sporočilo
TemaSporočilaOglediZadnje sporočilo
»

MySql Vprasanje - problem dupliciranih kljucev

Oddelek: Izdelava spletišč
131354 (1176) KernelPanic
»

FULLTEXT indeksi - problemi pri osnovnem primeru

Oddelek: Programiranje
6879 (800) barelyLegal
»

mysql vnos

Oddelek: Izdelava spletišč
51492 (1457) asgard2.0
»

portal ostal, baza sla

Oddelek: Izdelava spletišč
61765 (1650) bombacina
»

SQL problem

Oddelek: Programiranje
91470 (1307) Bossek

Več podobnih tem