Topic
  • 3 replies
  • Latest Post - ‏2011-12-16T14:18:55Z by SystemAdmin
SystemAdmin
SystemAdmin
9224 Posts

Pinned topic error font when use MySQL databse

‏2011-12-12T16:53:02Z |
In my resource handler
//
def onList()
{
def mgr = zero.data.Manager.create('currency')
def result = mgr.queryList('SELECT * FROM article')
logger.INFO{"Query Links Results size: " + result.size() }
request.headers.out."Content-Type" = "application/json-comment-filtered"
request.view="JSON"
request.json.output = result
render()
}

def onCreate() {
def art = zero.json.Json.decode(request.input[])
def updated = new java.sql.Timestamp(System.currentTimeMillis())
def data = zero.data.groovy.Manager.create('currency')

data.update("""
INSERT INTO smcurrency.article (title,content,updated) VALUES ($art.title, $art.content,$updated)
""")
request.headers.out."Content-Type" = "text/html; charset=utf8"
request.status = HttpURLConnection.HTTP_CREATED;
request.view = 'JSON'
request.json.output = art
render()
}
//
I post a JSON object as : {"title":"một","content":"nguyễn anh bằng xin chào các bạn"}
When I do a GET, the result is :
Anyone can show me the way fix this error ? Thank you.
Updated on 2011-12-16T14:18:55Z at 2011-12-16T14:18:55Z by SystemAdmin
  • SystemAdmin
    SystemAdmin
    9224 Posts

    Re: error font when use MySQL databse

    ‏2011-12-12T16:54:42Z  
    Sorry, the result of GET method is : " "
  • SystemAdmin
    SystemAdmin
    9224 Posts

    Re: error font when use MySQL databse

    ‏2011-12-14T19:37:47Z  
    Sorry, the result of GET method is : " "
    Can you use mysql directly to verify that your post is correctly inserting into the database?
  • SystemAdmin
    SystemAdmin
    9224 Posts

    Re: error font when use MySQL databse

    ‏2011-12-16T14:18:55Z  
    Can you use mysql directly to verify that your post is correctly inserting into the database?
    Also, can you manually insert those values into your mysql db with the mysql command line, and retrieve them with the onList handler?