[Lift] Re: SQL error
Ah! That fixed it, thanks a lot Jeppe ;) I'm not sure what to say in the ticket though, the column-name blob was a bad choise made by me. On Mar 4, 1:32 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote: On Thu, Mar 4, 2010 at 1:25 PM, Mads Hartmann mads...@gmail.com wrote: Hello everyone, I'm not sure if this is a lift problem or it's me. I'm trying to add the ability to upload images to a project - I'm using the code explained here: http://groups.google.com/group/liftweb/browse_thread/thread/b0509263e... I added two mapper classes: --- class ImageInfo extends LongKeyedMapper[ImageInfo] with IdPK { def getSingleton = ImageInfo object date extends MappedLong(this) { override def defaultValue = Helpers.millis } object mimeType extends MappedPoliteString(this, 64) object name extends MappedPoliteString(this, 256) { override def dbIndexed_? = true override def defaultValue = private def noSlashes(s: String) : List[FieldError] = if (s.contains(/)) List(FieldError(this, Text(Image name \ + s + \ may not contain \/\))) else Nil override def validations = valMinLen(1, Image name must not be empty) _ :: valUnique(Image name must be unique) _ :: noSlashes _ :: super.validations } object blob extends MappedLongForeignKey(this, ImageBlob) def deleteWithBlob { this.blob.obj match { case Full(x) = x.delete_! case _ = } this.delete_! } } - and -- class ImageBlob extends LongKeyedMapper[ImageBlob] with IdPK { def getSingleton = ImageBlob object image extends MappedBinary(this) } - The schemifier couldn't create the tables it gave to following 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 'blob BIGINT UNSIGNED) ENGINE = InnoDB' at line 1 this is the sql statement it tried to execute CREATE TABLE imageinfo (name VARCHAR(256) , id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE KEY , date_c BIGINT , mimetype VARCHAR(64) , blob BIGINT UNSIGNED) ENGINE = InnoDB I looks like it tries to create a column named blob, afaiks blob is a reserved word in MySqlhttp://dev.mysql.com/doc/refman/5.0/en/reserved-words.html You could try renaming the field. If this solves the problem, please file a ticket /Jeppe -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] Re: SQL error
On Thu, Mar 4, 2010 at 1:49 PM, Mads Hartmann mads...@gmail.com wrote: Ah! That fixed it, thanks a lot Jeppe ;) I'm not sure what to say in the ticket though, the column-name blob was a bad choise made by me. Yes, but lift tries to be clever and changes the column name if it matches a reserved word (look at your date column, it got the _c appended). We should just add the name blob to the list of reserved words. Hey you're a comimtter, you can add it (after creating the ticket :-) /Jeppe -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
[Lift] Re: SQL error
Will do ;) Thanks again On Mar 4, 1:54 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote: On Thu, Mar 4, 2010 at 1:49 PM, Mads Hartmann mads...@gmail.com wrote: Ah! That fixed it, thanks a lot Jeppe ;) I'm not sure what to say in the ticket though, the column-name blob was a bad choise made by me. Yes, but lift tries to be clever and changes the column name if it matches a reserved word (look at your date column, it got the _c appended). We should just add the name blob to the list of reserved words. Hey you're a comimtter, you can add it (after creating the ticket :-) /Jeppe -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] Re: SQL error
Is blob a standard reserved word or only on MySQL? If the latter this is a potential breaking change. - Mads Hartmannmads...@gmail.com wrote: Ah! That fixed it, thanks a lot Jeppe ;) I'm not sure what to say in the ticket though, the column-name blob was a bad choise made by me. On Mar 4, 1:32 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote: On Thu, Mar 4, 2010 at 1:25 PM, Mads Hartmann mads...@gmail.com wrote: Hello everyone, I'm not sure if this is a lift problem or it's me. I'm trying to add the ability to upload images to a project - I'm using the code explained here: http://groups.google.com/group/liftweb/browse_thread/thread/b0509263e... I added two mapper classes: --- class ImageInfo extends LongKeyedMapper[ImageInfo] with IdPK { def getSingleton = ImageInfo object date extends MappedLong(this) { override def defaultValue = Helpers.millis } object mimeType extends MappedPoliteString(this, 64) object name extends MappedPoliteString(this, 256) { override def dbIndexed_? = true override def defaultValue = private def noSlashes(s: String) : List[FieldError] = if (s.contains(/)) List(FieldError(this, Text(Image name \ + s + \ may not contain \/\))) else Nil override def validations = valMinLen(1, Image name must not be empty) _ :: valUnique(Image name must be unique) _ :: noSlashes _ :: super.validations } object blob extends MappedLongForeignKey(this, ImageBlob) def deleteWithBlob { this.blob.obj match { case Full(x) = x.delete_! case _ = } this.delete_! } } - and -- class ImageBlob extends LongKeyedMapper[ImageBlob] with IdPK { def getSingleton = ImageBlob object image extends MappedBinary(this) } - The schemifier couldn't create the tables it gave to following 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 'blob BIGINT UNSIGNED) ENGINE = InnoDB' at line 1 this is the sql statement it tried to execute CREATE TABLE imageinfo (name VARCHAR(256) , id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE KEY , date_c BIGINT , mimetype VARCHAR(64) , blob BIGINT UNSIGNED) ENGINE = InnoDB I looks like it tries to create a column named blob, afaiks blob is a reserved word in MySqlhttp://dev.mysql.com/doc/refman/5.0/en/reserved-words.html You could try renaming the field. If this solves the problem, please file a ticket /Jeppe -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] Re: SQL error
On Thu, Mar 4, 2010 at 1:47 PM, Naftoli Gugenheim naftoli...@gmail.comwrote: Is blob a standard reserved word or only on MySQL? If the latter this is a potential breaking change. Blob is not apparently part of the ANSI standard reserved word for SQL. I would have sworn it was. However, it is common in Oracle, MS SQL server and others. Might as well be standard. - Mads Hartmannmads...@gmail.com wrote: Ah! That fixed it, thanks a lot Jeppe ;) I'm not sure what to say in the ticket though, the column-name blob was a bad choise made by me. On Mar 4, 1:32 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote: On Thu, Mar 4, 2010 at 1:25 PM, Mads Hartmann mads...@gmail.com wrote: Hello everyone, I'm not sure if this is a lift problem or it's me. I'm trying to add the ability to upload images to a project - I'm using the code explained here: http://groups.google.com/group/liftweb/browse_thread/thread/b0509263e. .. I added two mapper classes: --- class ImageInfo extends LongKeyedMapper[ImageInfo] with IdPK { def getSingleton = ImageInfo object date extends MappedLong(this) { override def defaultValue = Helpers.millis } object mimeType extends MappedPoliteString(this, 64) object name extends MappedPoliteString(this, 256) { override def dbIndexed_? = true override def defaultValue = private def noSlashes(s: String) : List[FieldError] = if (s.contains(/)) List(FieldError(this, Text(Image name \ + s + \ may not contain \/\))) else Nil override def validations = valMinLen(1, Image name must not be empty) _ :: valUnique(Image name must be unique) _ :: noSlashes _ :: super.validations } object blob extends MappedLongForeignKey(this, ImageBlob) def deleteWithBlob { this.blob.obj match { case Full(x) = x.delete_! case _ = } this.delete_! } } - and -- class ImageBlob extends LongKeyedMapper[ImageBlob] with IdPK { def getSingleton = ImageBlob object image extends MappedBinary(this) } - The schemifier couldn't create the tables it gave to following 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 'blob BIGINT UNSIGNED) ENGINE = InnoDB' at line 1 this is the sql statement it tried to execute CREATE TABLE imageinfo (name VARCHAR(256) , id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE KEY , date_c BIGINT , mimetype VARCHAR(64) , blob BIGINT UNSIGNED) ENGINE = InnoDB I looks like it tries to create a column named blob, afaiks blob is a reserved word in MySqlhttp:// dev.mysql.com/doc/refman/5.0/en/reserved-words.html You could try renaming the field. If this solves the problem, please file a ticket /Jeppe -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- James A Barrows -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] Re: SQL error
This has already been on reviewboard and comitted to master - should i send out a breaking change note? I'm not sure i get why this is a breaking change though? On 04/03/2010, at 22.07, Jim Barrows wrote: On Thu, Mar 4, 2010 at 1:47 PM, Naftoli Gugenheim naftoli...@gmail.com wrote: Is blob a standard reserved word or only on MySQL? If the latter this is a potential breaking change. Blob is not apparently part of the ANSI standard reserved word for SQL. I would have sworn it was. However, it is common in Oracle, MS SQL server and others. Might as well be standard. - Mads Hartmannmads...@gmail.com wrote: Ah! That fixed it, thanks a lot Jeppe ;) I'm not sure what to say in the ticket though, the column-name blob was a bad choise made by me. On Mar 4, 1:32 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote: On Thu, Mar 4, 2010 at 1:25 PM, Mads Hartmann mads...@gmail.com wrote: Hello everyone, I'm not sure if this is a lift problem or it's me. I'm trying to add the ability to upload images to a project - I'm using the code explained here: http://groups.google.com/group/liftweb/browse_thread/thread/b0509263e... I added two mapper classes: --- class ImageInfo extends LongKeyedMapper[ImageInfo] with IdPK { def getSingleton = ImageInfo object date extends MappedLong(this) { override def defaultValue = Helpers.millis } object mimeType extends MappedPoliteString(this, 64) object name extends MappedPoliteString(this, 256) { override def dbIndexed_? = true override def defaultValue = private def noSlashes(s: String) : List[FieldError] = if (s.contains(/)) List(FieldError(this, Text(Image name \ + s + \ may not contain \/\))) else Nil override def validations = valMinLen(1, Image name must not be empty) _ :: valUnique(Image name must be unique) _ :: noSlashes _ :: super.validations } object blob extends MappedLongForeignKey(this, ImageBlob) def deleteWithBlob { this.blob.obj match { case Full(x) = x.delete_! case _ = } this.delete_! } } - and -- class ImageBlob extends LongKeyedMapper[ImageBlob] with IdPK { def getSingleton = ImageBlob object image extends MappedBinary(this) } - The schemifier couldn't create the tables it gave to following 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 'blob BIGINT UNSIGNED) ENGINE = InnoDB' at line 1 this is the sql statement it tried to execute CREATE TABLE imageinfo (name VARCHAR(256) , id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE KEY , date_c BIGINT , mimetype VARCHAR(64) , blob BIGINT UNSIGNED) ENGINE = InnoDB I looks like it tries to create a column named blob, afaiks blob is a reserved word in MySqlhttp://dev.mysql.com/doc/refman/5.0/en/reserved-words.html You could try renaming the field. If this solves the problem, please file a ticket /Jeppe -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- James A Barrows -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
Re: [Lift] Re: SQL error
On Thu, Mar 4, 2010 at 2:10 PM, Mads Hartmann Jensen mads...@gmail.comwrote: This has already been on reviewboard and comitted to master - should i send out a breaking change note? I'm not sure i get why this is a breaking change though? Not sure if it is. However it's certainly something folks will want to upgrade to asap. Naming columns keywords in SQL is bad. On 04/03/2010, at 22.07, Jim Barrows wrote: On Thu, Mar 4, 2010 at 1:47 PM, Naftoli Gugenheim naftoli...@gmail.comwrote: Is blob a standard reserved word or only on MySQL? If the latter this is a potential breaking change. Blob is not apparently part of the ANSI standard reserved word for SQL. I would have sworn it was. However, it is common in Oracle, MS SQL server and others. Might as well be standard. - Mads Hartmannmads...@gmail.com wrote: Ah! That fixed it, thanks a lot Jeppe ;) I'm not sure what to say in the ticket though, the column-name blob was a bad choise made by me. On Mar 4, 1:32 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote: On Thu, Mar 4, 2010 at 1:25 PM, Mads Hartmann mads...@gmail.com wrote: Hello everyone, I'm not sure if this is a lift problem or it's me. I'm trying to add the ability to upload images to a project - I'm using the code explained here: http://groups.google.com/group/liftweb/browse_thread/thread/b0509263e. .. I added two mapper classes: --- class ImageInfo extends LongKeyedMapper[ImageInfo] with IdPK { def getSingleton = ImageInfo object date extends MappedLong(this) { override def defaultValue = Helpers.millis } object mimeType extends MappedPoliteString(this, 64) object name extends MappedPoliteString(this, 256) { override def dbIndexed_? = true override def defaultValue = private def noSlashes(s: String) : List[FieldError] = if (s.contains(/)) List(FieldError(this, Text(Image name \ + s + \ may not contain \/\))) else Nil override def validations = valMinLen(1, Image name must not be empty) _ :: valUnique(Image name must be unique) _ :: noSlashes _ :: super.validations } object blob extends MappedLongForeignKey(this, ImageBlob) def deleteWithBlob { this.blob.obj match { case Full(x) = x.delete_! case _ = } this.delete_! } } - and -- class ImageBlob extends LongKeyedMapper[ImageBlob] with IdPK { def getSingleton = ImageBlob object image extends MappedBinary(this) } - The schemifier couldn't create the tables it gave to following 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 'blob BIGINT UNSIGNED) ENGINE = InnoDB' at line 1 this is the sql statement it tried to execute CREATE TABLE imageinfo (name VARCHAR(256) , id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE KEY , date_c BIGINT , mimetype VARCHAR(64) , blob BIGINT UNSIGNED) ENGINE = InnoDB I looks like it tries to create a column named blob, afaiks blob is a reserved word in MySqlhttp:// dev.mysql.com/doc/refman/5.0/en/reserved-words.html You could try renaming the field. If this solves the problem, please file a ticket /Jeppe -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- James A Barrows -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- James A Barrows -- You received this message because
Re: [Lift] Re: SQL error
It would be breaking only if somebody were using a database backend where it's NOT a keyword and also had a mapper field called blob, right? Seems pretty unlikely, but that's just my opinion. -Ross On Mar 4, 2010, at 4:13 PM, Jim Barrows wrote: On Thu, Mar 4, 2010 at 2:10 PM, Mads Hartmann Jensen mads...@gmail.com wrote: This has already been on reviewboard and comitted to master - should i send out a breaking change note? I'm not sure i get why this is a breaking change though? Not sure if it is. However it's certainly something folks will want to upgrade to asap. Naming columns keywords in SQL is bad. On 04/03/2010, at 22.07, Jim Barrows wrote: On Thu, Mar 4, 2010 at 1:47 PM, Naftoli Gugenheim naftoli...@gmail.com wrote: Is blob a standard reserved word or only on MySQL? If the latter this is a potential breaking change. Blob is not apparently part of the ANSI standard reserved word for SQL. I would have sworn it was. However, it is common in Oracle, MS SQL server and others. Might as well be standard. - Mads Hartmannmads...@gmail.com wrote: Ah! That fixed it, thanks a lot Jeppe ;) I'm not sure what to say in the ticket though, the column-name blob was a bad choise made by me. On Mar 4, 1:32 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote: On Thu, Mar 4, 2010 at 1:25 PM, Mads Hartmann mads...@gmail.com wrote: Hello everyone, I'm not sure if this is a lift problem or it's me. I'm trying to add the ability to upload images to a project - I'm using the code explained here: http://groups.google.com/group/liftweb/browse_thread/thread/b0509263e... I added two mapper classes: --- class ImageInfo extends LongKeyedMapper[ImageInfo] with IdPK { def getSingleton = ImageInfo object date extends MappedLong(this) { override def defaultValue = Helpers.millis } object mimeType extends MappedPoliteString(this, 64) object name extends MappedPoliteString(this, 256) { override def dbIndexed_? = true override def defaultValue = private def noSlashes(s: String) : List[FieldError] = if (s.contains(/)) List(FieldError(this, Text(Image name \ + s + \ may not contain \/\))) else Nil override def validations = valMinLen(1, Image name must not be empty) _ :: valUnique(Image name must be unique) _ :: noSlashes _ :: super.validations } object blob extends MappedLongForeignKey(this, ImageBlob) def deleteWithBlob { this.blob.obj match { case Full(x) = x.delete_! case _ = } this.delete_! } } - and -- class ImageBlob extends LongKeyedMapper[ImageBlob] with IdPK { def getSingleton = ImageBlob object image extends MappedBinary(this) } - The schemifier couldn't create the tables it gave to following 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 'blob BIGINT UNSIGNED) ENGINE = InnoDB' at line 1 this is the sql statement it tried to execute CREATE TABLE imageinfo (name VARCHAR(256) , id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE KEY , date_c BIGINT , mimetype VARCHAR(64) , blob BIGINT UNSIGNED) ENGINE = InnoDB I looks like it tries to create a column named blob, afaiks blob is a reserved word in MySqlhttp://dev.mysql.com/doc/refman/5.0/en/reserved-words.html You could try renaming the field. If this solves the problem, please file a ticket /Jeppe -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- James A Barrows -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to
Re: [Lift] Re: SQL error
Ah yeah I see, it would be looking for a column named blob_c then, right? So what do you say - I send out a **Potential breaking change** message that states that if 'blob' is not a keyword in your DB and you're currently using blob as a column name you should change it to blob_c? On 04/03/2010, at 22.16, Ross Mellgren wrote: It would be breaking only if somebody were using a database backend where it's NOT a keyword and also had a mapper field called blob, right? Seems pretty unlikely, but that's just my opinion. -Ross On Mar 4, 2010, at 4:13 PM, Jim Barrows wrote: On Thu, Mar 4, 2010 at 2:10 PM, Mads Hartmann Jensen mads...@gmail.com wrote: This has already been on reviewboard and comitted to master - should i send out a breaking change note? I'm not sure i get why this is a breaking change though? Not sure if it is. However it's certainly something folks will want to upgrade to asap. Naming columns keywords in SQL is bad. On 04/03/2010, at 22.07, Jim Barrows wrote: On Thu, Mar 4, 2010 at 1:47 PM, Naftoli Gugenheim naftoli...@gmail.com wrote: Is blob a standard reserved word or only on MySQL? If the latter this is a potential breaking change. Blob is not apparently part of the ANSI standard reserved word for SQL. I would have sworn it was. However, it is common in Oracle, MS SQL server and others. Might as well be standard. - Mads Hartmannmads...@gmail.com wrote: Ah! That fixed it, thanks a lot Jeppe ;) I'm not sure what to say in the ticket though, the column-name blob was a bad choise made by me. On Mar 4, 1:32 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote: On Thu, Mar 4, 2010 at 1:25 PM, Mads Hartmann mads...@gmail.com wrote: Hello everyone, I'm not sure if this is a lift problem or it's me. I'm trying to add the ability to upload images to a project - I'm using the code explained here: http://groups.google.com/group/liftweb/browse_thread/thread/b0509263e... I added two mapper classes: --- class ImageInfo extends LongKeyedMapper[ImageInfo] with IdPK { def getSingleton = ImageInfo object date extends MappedLong(this) { override def defaultValue = Helpers.millis } object mimeType extends MappedPoliteString(this, 64) object name extends MappedPoliteString(this, 256) { override def dbIndexed_? = true override def defaultValue = private def noSlashes(s: String) : List[FieldError] = if (s.contains(/)) List(FieldError(this, Text(Image name \ + s + \ may not contain \/\))) else Nil override def validations = valMinLen(1, Image name must not be empty) _ :: valUnique(Image name must be unique) _ :: noSlashes _ :: super.validations } object blob extends MappedLongForeignKey(this, ImageBlob) def deleteWithBlob { this.blob.obj match { case Full(x) = x.delete_! case _ = } this.delete_! } } - and -- class ImageBlob extends LongKeyedMapper[ImageBlob] with IdPK { def getSingleton = ImageBlob object image extends MappedBinary(this) } - The schemifier couldn't create the tables it gave to following 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 'blob BIGINT UNSIGNED) ENGINE = InnoDB' at line 1 this is the sql statement it tried to execute CREATE TABLE imageinfo (name VARCHAR(256) , id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE KEY , date_c BIGINT , mimetype VARCHAR(64) , blob BIGINT UNSIGNED) ENGINE = InnoDB I looks like it tries to create a column named blob, afaiks blob is a reserved word in MySqlhttp://dev.mysql.com/doc/refman/5.0/en/reserved-words.html You could try renaming the field. If this solves the problem, please file a ticket /Jeppe -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- James A Barrows -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to
Re: [Lift] Re: SQL error
Sounds proper to me. -Ross On Mar 4, 2010, at 4:22 PM, Mads Hartmann Jensen wrote: Ah yeah I see, it would be looking for a column named blob_c then, right? So what do you say - I send out a **Potential breaking change** message that states that if 'blob' is not a keyword in your DB and you're currently using blob as a column name you should change it to blob_c? On 04/03/2010, at 22.16, Ross Mellgren wrote: It would be breaking only if somebody were using a database backend where it's NOT a keyword and also had a mapper field called blob, right? Seems pretty unlikely, but that's just my opinion. -Ross On Mar 4, 2010, at 4:13 PM, Jim Barrows wrote: On Thu, Mar 4, 2010 at 2:10 PM, Mads Hartmann Jensen mads...@gmail.com wrote: This has already been on reviewboard and comitted to master - should i send out a breaking change note? I'm not sure i get why this is a breaking change though? Not sure if it is. However it's certainly something folks will want to upgrade to asap. Naming columns keywords in SQL is bad. On 04/03/2010, at 22.07, Jim Barrows wrote: On Thu, Mar 4, 2010 at 1:47 PM, Naftoli Gugenheim naftoli...@gmail.com wrote: Is blob a standard reserved word or only on MySQL? If the latter this is a potential breaking change. Blob is not apparently part of the ANSI standard reserved word for SQL. I would have sworn it was. However, it is common in Oracle, MS SQL server and others. Might as well be standard. - Mads Hartmannmads...@gmail.com wrote: Ah! That fixed it, thanks a lot Jeppe ;) I'm not sure what to say in the ticket though, the column-name blob was a bad choise made by me. On Mar 4, 1:32 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote: On Thu, Mar 4, 2010 at 1:25 PM, Mads Hartmann mads...@gmail.com wrote: Hello everyone, I'm not sure if this is a lift problem or it's me. I'm trying to add the ability to upload images to a project - I'm using the code explained here: http://groups.google.com/group/liftweb/browse_thread/thread/b0509263e... I added two mapper classes: --- class ImageInfo extends LongKeyedMapper[ImageInfo] with IdPK { def getSingleton = ImageInfo object date extends MappedLong(this) { override def defaultValue = Helpers.millis } object mimeType extends MappedPoliteString(this, 64) object name extends MappedPoliteString(this, 256) { override def dbIndexed_? = true override def defaultValue = private def noSlashes(s: String) : List[FieldError] = if (s.contains(/)) List(FieldError(this, Text(Image name \ + s + \ may not contain \/\))) else Nil override def validations = valMinLen(1, Image name must not be empty) _ :: valUnique(Image name must be unique) _ :: noSlashes _ :: super.validations } object blob extends MappedLongForeignKey(this, ImageBlob) def deleteWithBlob { this.blob.obj match { case Full(x) = x.delete_! case _ = } this.delete_! } } - and -- class ImageBlob extends LongKeyedMapper[ImageBlob] with IdPK { def getSingleton = ImageBlob object image extends MappedBinary(this) } - The schemifier couldn't create the tables it gave to following 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 'blob BIGINT UNSIGNED) ENGINE = InnoDB' at line 1 this is the sql statement it tried to execute CREATE TABLE imageinfo (name VARCHAR(256) , id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE KEY , date_c BIGINT , mimetype VARCHAR(64) , blob BIGINT UNSIGNED) ENGINE = InnoDB I looks like it tries to create a column named blob, afaiks blob is a reserved word in MySqlhttp://dev.mysql.com/doc/refman/5.0/en/reserved-words.html You could try renaming the field. If this solves the problem, please file a ticket /Jeppe -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- James A Barrows -- You received this message because you are subscribed to the Google Groups Lift group. To post to this
Re: [Lift] Re: SQL error
On Thu, Mar 4, 2010 at 1:10 PM, Mads Hartmann Jensen mads...@gmail.comwrote: This has already been on reviewboard and comitted to master - should i send out a breaking change note? Yeah. Send out a breaking change note. The likelihood of breakage is low, but possible. I'm not sure i get why this is a breaking change though? On 04/03/2010, at 22.07, Jim Barrows wrote: On Thu, Mar 4, 2010 at 1:47 PM, Naftoli Gugenheim naftoli...@gmail.comwrote: Is blob a standard reserved word or only on MySQL? If the latter this is a potential breaking change. Blob is not apparently part of the ANSI standard reserved word for SQL. I would have sworn it was. However, it is common in Oracle, MS SQL server and others. Might as well be standard. - Mads Hartmannmads...@gmail.com wrote: Ah! That fixed it, thanks a lot Jeppe ;) I'm not sure what to say in the ticket though, the column-name blob was a bad choise made by me. On Mar 4, 1:32 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote: On Thu, Mar 4, 2010 at 1:25 PM, Mads Hartmann mads...@gmail.com wrote: Hello everyone, I'm not sure if this is a lift problem or it's me. I'm trying to add the ability to upload images to a project - I'm using the code explained here: http://groups.google.com/group/liftweb/browse_thread/thread/b0509263e. .. I added two mapper classes: --- class ImageInfo extends LongKeyedMapper[ImageInfo] with IdPK { def getSingleton = ImageInfo object date extends MappedLong(this) { override def defaultValue = Helpers.millis } object mimeType extends MappedPoliteString(this, 64) object name extends MappedPoliteString(this, 256) { override def dbIndexed_? = true override def defaultValue = private def noSlashes(s: String) : List[FieldError] = if (s.contains(/)) List(FieldError(this, Text(Image name \ + s + \ may not contain \/\))) else Nil override def validations = valMinLen(1, Image name must not be empty) _ :: valUnique(Image name must be unique) _ :: noSlashes _ :: super.validations } object blob extends MappedLongForeignKey(this, ImageBlob) def deleteWithBlob { this.blob.obj match { case Full(x) = x.delete_! case _ = } this.delete_! } } - and -- class ImageBlob extends LongKeyedMapper[ImageBlob] with IdPK { def getSingleton = ImageBlob object image extends MappedBinary(this) } - The schemifier couldn't create the tables it gave to following 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 'blob BIGINT UNSIGNED) ENGINE = InnoDB' at line 1 this is the sql statement it tried to execute CREATE TABLE imageinfo (name VARCHAR(256) , id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE KEY , date_c BIGINT , mimetype VARCHAR(64) , blob BIGINT UNSIGNED) ENGINE = InnoDB I looks like it tries to create a column named blob, afaiks blob is a reserved word in MySqlhttp:// dev.mysql.com/doc/refman/5.0/en/reserved-words.html You could try renaming the field. If this solves the problem, please file a ticket /Jeppe -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- James A Barrows -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.comliftweb%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- Lift, the simply functional web framework http://liftweb.net Beginning Scala
Re: [Lift] Re: SQL error
Done :) On 04/03/2010, at 22.38, David Pollak wrote: On Thu, Mar 4, 2010 at 1:10 PM, Mads Hartmann Jensen mads...@gmail.com wrote: This has already been on reviewboard and comitted to master - should i send out a breaking change note? Yeah. Send out a breaking change note. The likelihood of breakage is low, but possible. I'm not sure i get why this is a breaking change though? On 04/03/2010, at 22.07, Jim Barrows wrote: On Thu, Mar 4, 2010 at 1:47 PM, Naftoli Gugenheim naftoli...@gmail.com wrote: Is blob a standard reserved word or only on MySQL? If the latter this is a potential breaking change. Blob is not apparently part of the ANSI standard reserved word for SQL. I would have sworn it was. However, it is common in Oracle, MS SQL server and others. Might as well be standard. - Mads Hartmannmads...@gmail.com wrote: Ah! That fixed it, thanks a lot Jeppe ;) I'm not sure what to say in the ticket though, the column-name blob was a bad choise made by me. On Mar 4, 1:32 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote: On Thu, Mar 4, 2010 at 1:25 PM, Mads Hartmann mads...@gmail.com wrote: Hello everyone, I'm not sure if this is a lift problem or it's me. I'm trying to add the ability to upload images to a project - I'm using the code explained here: http://groups.google.com/group/liftweb/browse_thread/thread/b0509263e... I added two mapper classes: --- class ImageInfo extends LongKeyedMapper[ImageInfo] with IdPK { def getSingleton = ImageInfo object date extends MappedLong(this) { override def defaultValue = Helpers.millis } object mimeType extends MappedPoliteString(this, 64) object name extends MappedPoliteString(this, 256) { override def dbIndexed_? = true override def defaultValue = private def noSlashes(s: String) : List[FieldError] = if (s.contains(/)) List(FieldError(this, Text(Image name \ + s + \ may not contain \/\))) else Nil override def validations = valMinLen(1, Image name must not be empty) _ :: valUnique(Image name must be unique) _ :: noSlashes _ :: super.validations } object blob extends MappedLongForeignKey(this, ImageBlob) def deleteWithBlob { this.blob.obj match { case Full(x) = x.delete_! case _ = } this.delete_! } } - and -- class ImageBlob extends LongKeyedMapper[ImageBlob] with IdPK { def getSingleton = ImageBlob object image extends MappedBinary(this) } - The schemifier couldn't create the tables it gave to following 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 'blob BIGINT UNSIGNED) ENGINE = InnoDB' at line 1 this is the sql statement it tried to execute CREATE TABLE imageinfo (name VARCHAR(256) , id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE KEY , date_c BIGINT , mimetype VARCHAR(64) , blob BIGINT UNSIGNED) ENGINE = InnoDB I looks like it tries to create a column named blob, afaiks blob is a reserved word in MySqlhttp://dev.mysql.com/doc/refman/5.0/en/reserved-words.html You could try renaming the field. If this solves the problem, please file a ticket /Jeppe -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- James A Barrows -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- Lift, the simply functional web framework http://liftweb.net Beginning Scala
Re: [Lift] Re: SQL error
If you didn't yet send it also to lift-announce. - Mads Hartmann Jensenmads...@gmail.com wrote: Ah yeah I see, it would be looking for a column named blob_c then, right? So what do you say - I send out a **Potential breaking change** message that states that if 'blob' is not a keyword in your DB and you're currently using blob as a column name you should change it to blob_c? On 04/03/2010, at 22.16, Ross Mellgren wrote: It would be breaking only if somebody were using a database backend where it's NOT a keyword and also had a mapper field called blob, right? Seems pretty unlikely, but that's just my opinion. -Ross On Mar 4, 2010, at 4:13 PM, Jim Barrows wrote: On Thu, Mar 4, 2010 at 2:10 PM, Mads Hartmann Jensen mads...@gmail.com wrote: This has already been on reviewboard and comitted to master - should i send out a breaking change note? I'm not sure i get why this is a breaking change though? Not sure if it is. However it's certainly something folks will want to upgrade to asap. Naming columns keywords in SQL is bad. On 04/03/2010, at 22.07, Jim Barrows wrote: On Thu, Mar 4, 2010 at 1:47 PM, Naftoli Gugenheim naftoli...@gmail.com wrote: Is blob a standard reserved word or only on MySQL? If the latter this is a potential breaking change. Blob is not apparently part of the ANSI standard reserved word for SQL. I would have sworn it was. However, it is common in Oracle, MS SQL server and others. Might as well be standard. - Mads Hartmannmads...@gmail.com wrote: Ah! That fixed it, thanks a lot Jeppe ;) I'm not sure what to say in the ticket though, the column-name blob was a bad choise made by me. On Mar 4, 1:32 pm, Jeppe Nejsum Madsen je...@ingolfs.dk wrote: On Thu, Mar 4, 2010 at 1:25 PM, Mads Hartmann mads...@gmail.com wrote: Hello everyone, I'm not sure if this is a lift problem or it's me. I'm trying to add the ability to upload images to a project - I'm using the code explained here: http://groups.google.com/group/liftweb/browse_thread/thread/b0509263e... I added two mapper classes: --- class ImageInfo extends LongKeyedMapper[ImageInfo] with IdPK { def getSingleton = ImageInfo object date extends MappedLong(this) { override def defaultValue = Helpers.millis } object mimeType extends MappedPoliteString(this, 64) object name extends MappedPoliteString(this, 256) { override def dbIndexed_? = true override def defaultValue = private def noSlashes(s: String) : List[FieldError] = if (s.contains(/)) List(FieldError(this, Text(Image name \ + s + \ may not contain \/\))) else Nil override def validations = valMinLen(1, Image name must not be empty) _ :: valUnique(Image name must be unique) _ :: noSlashes _ :: super.validations } object blob extends MappedLongForeignKey(this, ImageBlob) def deleteWithBlob { this.blob.obj match { case Full(x) = x.delete_! case _ = } this.delete_! } } - and -- class ImageBlob extends LongKeyedMapper[ImageBlob] with IdPK { def getSingleton = ImageBlob object image extends MappedBinary(this) } - The schemifier couldn't create the tables it gave to following 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 'blob BIGINT UNSIGNED) ENGINE = InnoDB' at line 1 this is the sql statement it tried to execute CREATE TABLE imageinfo (name VARCHAR(256) , id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT UNIQUE KEY , date_c BIGINT , mimetype VARCHAR(64) , blob BIGINT UNSIGNED) ENGINE = InnoDB I looks like it tries to create a column named blob, afaiks blob is a reserved word in MySqlhttp://dev.mysql.com/doc/refman/5.0/en/reserved-words.html You could try renaming the field. If this solves the problem, please file a ticket /Jeppe -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- James A Barrows -- You received this message because you are subscribed to the Google
Re: [Lift] Re: SQL error
I know I'm new here but I'm curious as to why names conflicting with reserved words are changed rather than escaped ? JDBC drivers provide the escape syntax and a list of reserved words for the database through DatabaseMetaData. Regards, Sean. On 4 Mar 2010, at 12:54, Jeppe Nejsum Madsen wrote: On Thu, Mar 4, 2010 at 1:49 PM, Mads Hartmann mads...@gmail.com wrote: Ah! That fixed it, thanks a lot Jeppe ;) I'm not sure what to say in the ticket though, the column-name blob was a bad choise made by me. Yes, but lift tries to be clever and changes the column name if it matches a reserved word (look at your date column, it got the _c appended). We should just add the name blob to the list of reserved words. Hey you're a comimtter, you can add it (after creating the ticket :-) /Jeppe -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en. -- You received this message because you are subscribed to the Google Groups Lift group. To post to this group, send email to lift...@googlegroups.com. To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.