Author Topic: Error in SQL Syntax  (Read 6756 times)

omnihum

  • Newbie
  • *
  • Posts: 3
    • View Profile
Error in SQL Syntax
« on: January 13, 2009, 12:37:28 pm »
I installed the v1.1.
I used Tieny(1) instead of Boolean.
I have to use mysql 4.0.27-standard
cause we use a 1&1 managed server and they still
dont provide mysql 5.0.
Now I have the following message after loging in.

Query failed with message '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 `object_id` FROM `opengoo_workspace_objects` WHERE `obje'


Code: [Select]
File:  opengoo/environment/library/database/adapters/AbstractDBAdapter.class.php
Line: 378
Sql: SELECT * FROM `opengoo_application_logs` WHERE `is_private` <= '1' AND `is_silent` <= '1' AND `id` IN (SELECT `object_id` FROM `opengoo_workspace_objects` WHERE `object_manager` = 'ApplicationLogs' AND `workspace_id` IN ('1')) ORDER BY `created_on` DESC LIMIT 0, 15

Can you help?

ty Jan

Karl

  • Sr. Member
  • ****
  • Posts: 339
    • ICQ Messenger - 464979879
    • View Profile
Re: Error in SQL Syntax
« Reply #1 on: January 13, 2009, 04:15:26 pm »
Don't use 1&1 because it's the worst hoster I know. I'm from Germany and 1&1 too so I know what I'm talking about..

 ;)  ;)  ;)

BTW: I don't really understand this: "I used Tieny(1) instead of Boolean". What does it mean?

omnihum

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Error in SQL Syntax
« Reply #2 on: January 14, 2009, 11:02:26 am »
Mysql 4.0.27 is not supporting the fieldtype "BOOLEAN"
so i changed public/install/installation/templates/sql/mysql_schema.php
I replaced BOOLEAN with TINYINT(1) like described here:
http://forums.opengoo.org/index.php?topic=526.0

BOOLEAN is an alias to TINYINT(1), so it couldn't be the problem.
But Mysql 4.0.27 seems to have a problem in the SQL-Query.
I found out. SQL except this query:

Quote
SELECT *
FROM `opengoo_application_logs`
WHERE `is_private` <= '1'
AND `is_silent` <= '1'
AND `id`
IN (
    NULL
)
ORDER BY `created_on`
DESC LIMIT 0, 15

>> Result is: empty Result

And SQL has no error on:


Quote
    SELECT `object_id`
    FROM `opengoo_workspace_objects`
    WHERE `object_manager` = 'ApplicationLogs'
    AND `workspace_id`
    IN ('1')

>> Result is: empty Result

But it gives me an error on:


Quote
SELECT *
FROM `opengoo_application_logs`
WHERE `is_private` <= '1'
AND `is_silent` <= '1'
AND `id`
IN (
    SELECT `object_id`
    FROM `opengoo_workspace_objects`
    WHERE `object_manager` = 'ApplicationLogs'
    AND `workspace_id`
    IN ('1')
)
ORDER BY `created_on`
DESC LIMIT 0, 15


I would like to correct the sql query but i couldn't find out what the problem on the last query is.
I am not sure about  "empty Result". Maybe it has to have a result. Maybe NULL is not the same
like "empty Result".
Cause if i test this query, I get an error:
Quote
SELECT *
FROM `opengoo_application_logs`
WHERE `is_private` <= '1'
AND `is_silent` <= '1'
AND `id`
IN (
   
)
ORDER BY `created_on`
DESC LIMIT 0, 15

The table opengoo_workspace_objects is empty. So it can not
return any results.

Thank you

Jan

PS: I was on hoster strato before. Believe me it was horror too.
But at the moment i have 1&1 on my toplist. I have allot of domains there.
To switch is too much work. Never change a running system.
Since a year he promise to change to mysql 5.0 in the next month.

« Last Edit: January 14, 2009, 11:23:15 am by omnihum »

Karl

  • Sr. Member
  • ****
  • Posts: 339
    • ICQ Messenger - 464979879
    • View Profile
Re: Error in SQL Syntax
« Reply #3 on: January 14, 2009, 11:26:46 am »
Hallo Jan,

now I understand but unfortunately can't help with this issue.

Regarding hoster: I'm using 3 dedicated servers at Strato since 3 years without any problems. But of course they are not managed so I have to manage all by myself.

Since some bad experience in the past I NEVER register and host my domains with the same company where I host my sites. So I can switch site hoster without problems.

Gruß
Karl

omnihum

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Error in SQL Syntax
« Reply #4 on: January 19, 2009, 11:48:30 am »
maybe someone else?

ignacio

  • Hero Member
  • *****
  • Posts: 1703
    • View Profile
Re: Error in SQL Syntax
« Reply #5 on: January 20, 2009, 09:32:41 am »
I thought I had already answered this post. Where did my post go? ???

According to the MySQL 4.0 manual there should be no problem in executing a select query as an argument for the IN operator: http://dev.mysql.com/doc/refman/4.1/en/comparison-operators.html#function_in

So basically, I don't know what is going wrong there. Maybe you can ask on some MySQL forum?

Sorry I couldn't be of much help.