|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
mysql error #1064
When I try to backup my database using Direct Admin's database backup option offered by my host I get 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 'DEFAULT CHARSET=latin1' at line 10 I changed host and now tried to back up the database to my message board. Info MySQL version 4.0.23 standard PHP version 4.3.11 (apache) |
|
#2
|
|||
|
|||
|
I don't think versions older than 4.1 like the CHARSET syntax. If your backup is an .sql file, you should be able to just open it and remove that part.
__________________
"A pawn is the most important piece on the chessboard -- to a pawn" |
|
#3
|
|||
|
|||
|
In case I get my host to upgrade to 4.1 or above will it solve the problem without having to remove CHARSET syntax ?
|
|
#4
|
|||
|
|||
|
It ought to. And you'd get subqueries.
![]() |
|
#5
|
|||
|
|||
|
Quote:
Sorry for sounding too ignorant but what do you mean by that ? Is it a negative or postitve thing ? |
|
#6
|
|||
|
|||
|
It's very positive. Subqueries were introduced into MySQL with 4.1, and they rock. They can do things that before could only be done with complicated joins or multiple queries.
|
|
#7
|
|||
|
|||
|
Quote:
Thanks a ton for all your help. :-) |
|
#8
|
||||
|
||||
|
Just to give you an example of subqueries.
Locally, I could work with version 4.1 and so the SQL-query in my java class was like this : Code:
zoekString.append("select * from film ");
zoekString.append(" where filmnummer in ");
zoekString.append("(select filmnummer from filmrol, persoon ");
zoekString.append("where filmrol.persoonsnummer = persoon.persoonsnummer ");
zoekString.append("and (persoon.naam like '%" + _naam + "%' ");
zoekString.append("or persoon.voornaam like '%" + _naam + "%' ) )");
Mind the fact that my select statement only contains the table film, since I only want to have the information inside this table. With a subquery Code:
where filmnummer in (select filmnummer from filmrol, persoon ...) I take care of the fact that I only want to see films where a certain person has participated. Unforntunately, on the server the version of MySQL was 4.0. Und the decision of the upgrade was not mine to take. So, I had to change the SQL query into this : Code:
zoekString.append("select * from film, filmrol, persoon ");
zoekString.append(" where film.filmnummer = filmrol.filmnummer and ");
zoekString.append(" filmrol.persoonsnummer = persoon.persoonsnummer and ");
(...)
if (_selectie[3] == true && _naam != null)
{
zoekString.append(" (naam like '%" + _naam + "%' or ");
zoekString.append(" voornaam like '%" + _naam + "%' ) ");
} /* selectie op naam */
This works also, but it is less performant. Now I get the information of 3 tables (film, filmrol, persoon) in my resultset (a java class made to catch information of a database) where I only need the information of only one table. So, this is overhead due to the fact I could not work with subqueries. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > mysql error #1064 |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|