On Thu, Mar 4, 2010 at 1:25 PM, Mads Hartmann <[email protected]> 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/b0509263e18c9a66/f36535bbe15273d6?lnk=gst&q=image+upload#f36535bbe15273d6
>
> 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 MySql
http://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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en.

Reply via email to