Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    [MySql] Errore query creazione di una tabella, qualche info su come risolvere?

    Allora,
    ho uno script prefatto che prima di essere "installato" costruisce delle tabelle in MySql

    Ora...una delle tabelle viene costruita così:

    codice:
    DROP TABLE IF EXISTS `#__phocagallery`;
    CREATE TABLE `jos_phocagallery` (
      `id` int(11) unsigned NOT NULL auto_increment,
      `catid` int(11) NOT NULL default '0',
      `sid` int(11) NOT NULL default '0',
      `title` varchar(250) NOT NULL default '',
      `alias` varchar(255) NOT NULL default '',
      `filename` varchar(250) NOT NULL default '',
      `description` text,
      `date` datetime NOT NULL default '0000-00-00 00:00:00',
      `hits` int(11) NOT NULL default '0',
      `latitude` varchar(20) NOT NULL default '',
      `longitude` varchar(20) NOT NULL default '',
      `zoom` int(3) NOT NULL default '0',
      `geotitle` varchar(255) NOT NULL default '',
      `videocode` text,
      `vmproductid` int(11) NOT NULL default '0',
      `imgorigsize` int(11) NOT NULL default '0',
      `published` tinyint(1) NOT NULL default '0',
      `approved` tinyint(1) NOT NULL default '0',
      `checked_out` int(11) NOT NULL default '0',
      `checked_out_time` datetime NOT NULL default '0000-00-00 00:00:00',
      `ordering` int(11) NOT NULL default '0',
      `params` text,
      `extlink1` text,
      `extlink2` text,
      `extid` varchar(255) NOT NULL default '',
      `extl` varchar(255) NOT NULL default '',
      `extm` varchar(255) NOT NULL default '',
      `exts` varchar(255) NOT NULL default '',
      `exto` varchar(255) NOT NULL default '',
      `extw` varchar(255) NOT NULL default '',
      `exth` varchar(255) NOT NULL default '',
      PRIMARY KEY  (`id`),
      KEY `catid` (`catid`,`published`)
    ) TYPE=MyISAM CHARACTER SET `utf8`;
    e ciò non crea problemi.

    Altre tabelle invece vengono costruite così:

    codice:
    DROP TABLE IF EXISTS `jos_phocagallery_votes`;
    CREATE TABLE `jos_phocagallery_votes` (
      `id` int(11) NOT NULL auto_increment,
      `catid` int(11) NOT NULL default 0,
      `userid` int(11) NOT NULL default 0,
      `date` datetime NOT NULL default '0000-00-00 00:00:00',
      `rating` tinyint(1) NOT NULL default '0',
      `published` tinyint(1) NOT NULL default '0',
      `checked_out` int(11) unsigned NOT NULL default '0',
      `checked_out_time` datetime NOT NULL default '0000-00-00 00:00:00',
      `ordering` int(11) NOT NULL default '0',
      `params` text,
      PRIMARY KEY  (`id`)
    ) TYPE=MyISAM DEFAULT CHARSET=utf8;
    e ciò crea problemi, esattamente l'errore che mi viene dato è il seguente #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 'DEFAULT CHARSET=utf8' at line 13

    Differiscono nella parte finale...cioè:
    la prima tabella termina con: TYPE=MyISAM CHARACTER SET `utf8`; che non crea problemi alla creazione della tabella sul mio database
    mentre la seconda termina con la forma: TYPE=MyISAM DEFAULT CHARSET=utf8; che invece causa quell'errore...

    Ora vorrei sapere....come posso risolvere quell'errore?
    Se nella seconda tabella sostituisco la parte finale con TYPE=MyISAM CHARACTER SET `utf8`; va bene? O devo fare qualche altra cosa?

    In pratica vorrei sapere se le due forme sono logicamente conclusive...

    Poi...altra cosa: TYPE=MyISAM sò cosa vuol dire...uso MyISAM come table engine...ma cosa è il character set?

    Grazie mille
    Andrea

  2. #2
    Ho eseguito la query che ti da problemi, ma a me non ne ha dati, comunque, sostituendo nel modo che hai detto non dovrebbe causarti problemi. Il character set è l'insieme dei caratteri che puoi inserire nel database, in questo caso il database riconoscerà utf8, come charset di default. Utf8 è il charset universale, cioè, in qualunque lingua scriverai, anche ideografica, la parte testuale resterà sempre identica.
    Spero di essere stato chiaro.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.