error when activating the module

toma - December 27, 2006 - 19:27
Project:URL profile
Version:4.7.x-1.1
Component:url_profile
Category:bug report
Priority:normal
Assigned:Aron Novak
Status:needs review
Description

Hi

I activate the module and receive this errors

user warning: 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 'CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT query: CREATE TABLE url_profile_url ( `upid` int(10) NOT NULL default '0', `url` TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '', `checked` int(11) NOT NULL default '0', `valid` int(1) NOT NULL default '0', `created` int(11) NOT NULL default '0', `custom` int(1) NOT NULL default '0', `criteria` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '', `title` varchar(255) character set utf8 NOT NULL default '', `child_nodes` int(11) NOT NULL default '0', PRIMARY KEY (`upid`), U in /home/web/annoncemaroc/includes/database.mysql.inc on line 121.

Thanks

#1

miurahr - January 5, 2007 - 07:21

I use with mysql 4.0.x and face same error. If you use mysql 4.0.x, it may help you.

CREATE TABLE url_profile_url (
`upid` int(10) NOT NULL default '0',
`url` TEXT NOT NULL DEFAULT '',
`checked` int(11) NOT NULL default '0',
`valid` int(1) NOT NULL default '0',
`created` int(11) NOT NULL default '0',
`custom` int(1) NOT NULL default '0',
`criteria` varchar(255) character set utf8 NOT NULL DEFAULT '',
`title` varchar(255) character set utf8 NOT NULL default '',
`child_nodes` int(11) NOT NULL default '0',
PRIMARY KEY (`upid`),
UNIQUE KEY `url` (`url`(245), `criteria`),
INDEX `created` ( `created` ),
INDEX `valid` ( `valid` ),
INDEX `child_nodes` ( `child_nodes` )
) ENGINE=MyISAM;

You can modify url_profile.install script or make database table directly using 'mysql -u -p '
command.
As i saw, we need to add some code to
1. determine mysql version and change SQL code.
2. add PostgreSQL staff

It has also not-good staffs.
1. 'character set latin-1' may cause problem with other language such as Japanese.
2. 'TEXT' could not have 'character set' attribute in MySQL 4.0.
3. 'DEFAULT CHARACTER SET' can use after MySQL 4.1.

It should be good to support modules by drupal core using db_type global
by adding keyword mysql40 to $db_url in settings.php.

With this module can determine DB version like as follows:

switch ($GLOBALS['db_type']) {
    case 'mysqli':
    case 'mysql':  //after mysql 4.1
          foo;
     case 'mysql40': // prior to mysql 4.0
          boo;

#2

toma - January 5, 2007 - 11:24

hey thanks for your reply its seems to work when i add the mysql queries, but it still have some errros, i am not a mysql guru so i can't get to work with mysql version

    * user warning: Table 'blogelle.url_profile_technorati' doesn't exist query: SELECT * FROM url_profile_technorati WHERE upid = 3 ORDER BY checked DESC LIMIT 0, 1 in /home/web/annoncemaroc/includes/database.mysql.inc on line 121.
    * user warning: Table 'blogelle.url_profile_alexa' doesn't exist query: SELECT * FROM url_profile_alexa WHERE upid = 3 ORDER BY checked DESC LIMIT 0, 1 in /home/web/annoncemaroc/includes/database.mysql.inc on line 121.
    * user warning: Table 'blogelle.url_profile_node' doesn't exist query: SELECT COUNT(*) FROM node n JOIN url_profile_node p ON p.nid = n.nid JOIN url_profile_url u ON u.upid = p.upid WHERE u.upid = 3 in /home/web/annoncemaroc/includes/database.mysql.inc on line 121.
    * user warning: Table 'blogelle.url_profile_node' doesn't exist query: SELECT n.nid FROM node n JOIN url_profile_node p ON p.nid = n.nid JOIN url_profile_url u ON u.upid = p.upid WHERE u.upid = 3 ORDER BY n.sticky DESC, n.created DESC LIMIT 0, 10 in /home/web/annoncemaroc/includes/database.mysql.inc on line 121.

#3

toma - January 5, 2007 - 13:00

I get it to work now thanks

CREATE TABLE url_profile_alexa (
        `upid` int(10) NOT NULL default 0,
        `checked` int(11) NOT NULL default 0,
        `rank` int(8) NOT NULL default 0,
        `title` varchar(255) NOT NULL default '',
        `desc` TEXT,
        `createtime` int(11) NOT NULL default 0,
        KEY `checked` (`checked`),
        KEY `upid` (`upid`)
      )";

CREATE TABLE `url_profile_technorati` (
        `upid` int(10) NOT NULL default '0',
        `checked` int(11) NOT NULL default '0',
        `blog_title` varchar(255) NOT NULL default '',
        `blog_rank` int(10) NOT NULL default '0',
        `inboundlinks` int(10) NOT NULL default '0',
        `inboundblogs` int(10) NOT NULL default '0',
        `latest_inbound` text NOT NULL default '',
        `tags` text NOT NULL default '',
        KEY `checked` (`checked`),
        KEY `upid` (`upid`),
        KEY `blog_rank` (`blog_rank`)
      );

#4

toma - January 5, 2007 - 13:04

CREATE TABLE url_profile_node (
        `upid` int(10) NOT NULL default 0,
        `nid` int(10) NOT NULL default 0,
        PRIMARY KEY (`nid`, `upid`)
      );

#5

toma - January 5, 2007 - 13:08

When refresh the url

user warning: 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 'SELECT COUNT(*) query: UPDATE url_profile_url uu SET uu.child_nodes = (SELECT COUNT(*) FROM url_profile_node un WHERE un.upid = 4 ) WHERE uu.upid = 4 in /home/web/annoncemaroc/includes/database.mysql.inc on line 121.

http://www.blogelle.com/url_profile/3
Failed to retrieve Alexa data for http://www.drupal.org

thanks

#6

patchak - January 10, 2007 - 23:39

I installed url profile with the install queries that I found here, because the module does not seem to install tables correctly with the latest drupal and the code inthe official release.

When I refresh a feed to get the cool stuff to happen, I get this 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 'SELECT COUNT(*) query: UPDATE url_profile_url uu SET uu.child_nodes = (SELECT COUNT(*) FROM url_profile_node un WHERE un.upid = 10 ) WHERE uu.upid = 10 in /homepages/7/d191928455/htdocs/www/geek3/includes/database.mysql.inc on line 121.

don't know where the bug is, hope this helps a bit.

patchak

#7

toma - January 11, 2007 - 22:41

Same here, i can't get module to work correctly, in the author demo site, work perfect, waiting for an answer

Thanks

#8

patchak - January 14, 2007 - 19:06

Well I installed again on a test site and it really does not work.

And there is no other release to try...

here's the error message I got.

user warning: 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 'CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT query: CREATE TABLE url_profile_url ( `upid` int(10) NOT NULL default '0', `url` TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '', `checked` int(11) NOT NULL default '0', `valid` int(1) NOT NULL default '0', `created` int(11) NOT NULL default '0', `custom` int(1) NOT NULL default '0', `criteria` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '', `title` varchar(255) character set utf8 NOT NULL default '', `child_nodes` int(11) NOT NULL default '0', PRIMARY KEY (`upid`), U in /homepages/7/d191928455/htdocs/www/geek/includes/database.mysql.inc on line 121.

Thanks for any instructions on how to install?

Patchak

#9

Aron Novak - January 30, 2007 - 10:32
Assigned to:toma» Aron Novak
Status:active» needs review

I'm not sure, but this may helps you:

CREATE TABLE url_profile_url (
                  `upid` int(10) NOT NULL default 0,
                  `url` TEXT CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '',
                  `checked` int(11) NOT NULL default 0,
                  `valid` int(1) NOT NULL default 0,
                  `created` int(11) NOT NULL default 0,
                  `custom` int(1) NOT NULL default 0,
                  `criteria` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '',
                  `title` varchar(255) character set utf8 NOT NULL default '',
                  `child_nodes` int(11) NOT NULL default 0,
                  PRIMARY KEY  (`upid`),
                  UNIQUE KEY `url` (`url`(255), `criteria`),
                  INDEX `created` ( `created` ),
                  INDEX `valid` ( `valid` ),
                  INDEX `child_nodes` ( `child_nodes` )
                );

Can you tell me wether these lines pass through your mysql command line or not?
Thanks for reporting this!

#10

patchak - January 30, 2007 - 14:30

Hi Aron,

You want me to add these tables after I install the module, or on a fresh install??

Thanks

#11

Aron Novak - January 30, 2007 - 18:29

Not necessarily a fresh install. At mysql console (or phpmyadmin), do the following:
DROP TABLE url_profile_url; // With prefix, if any
and then command the statement in the previous post.
One thing is important: Do you get a mysql error to the second statement?

#12

patchak - January 30, 2007 - 21:28

Hi,

I got this error:

#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 'CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT

I use locale module with french translation if this as anything to do with it...

thanks for the help
Patchak

#13

Aron Novak - February 1, 2007 - 09:13

In the thread miurahr mentioned (and explained, thanks!) that mysql 4.0 don't support lots of things in this query. So what's the version number of your mysql? (I tried to get 4.0 mysql binary, but I cannot find it... so it's hard to try out the query )
Try to follow the instructions of this comment: #1 submitted by miurahr on January 5, 2007 - 09:21
If it not solves your problem, please let me know!

#14

marafa - February 23, 2007 - 21:23

CREATE TABLE url_profile_url (
`upid` int(10) NOT NULL default '0',
`url` TEXT NOT NULL DEFAULT '',
`checked` int(11) NOT NULL default '0',
`valid` int(1) NOT NULL default '0',
`created` int(11) NOT NULL default '0',
`custom` int(1) NOT NULL default '0',
`criteria` varchar(255) character set utf8 NOT NULL DEFAULT '',
`title` varchar(255) character set utf8 NOT NULL default '',
`child_nodes` int(11) NOT NULL default '0',
PRIMARY KEY (`upid`),
UNIQUE KEY `url` (`url`(245), `criteria`),
INDEX `created` ( `created` ),
INDEX `valid` ( `valid` ),
INDEX `child_nodes` ( `child_nodes` )
) ENGINE=MyISAM;

worked for me but not the one with the swedish character set

thanks

 
 

Drupal is a registered trademark of Dries Buytaert.