I'm back again....

anyone use TG2??

when I use the statement above.it can works well in background.

but it doesn't work at controller..

any suggestion is welcome~

2010/4/20 Cancer <[email protected]>

> o yeah!
>
> I solved the question~
>
> these are codes.hope it's useful to someone who have the same question~
>
> crew = query.from_statement(text("SELECT * from crew_member where "  +
>
>  "rtrim(crew_member.lastname) || rtrim(crew_member.firstname) " +
>                                                 " like '%" + crew_name +
> "%'", typemap = {'birthday' : NormalDate})).first()
>
> by the way...I want to know ..why it be like this?
>
> what is difference between from_statement query and filter query?
>
> 2010/4/20 Cancer <[email protected]>
>
>> by the way....
>>
>> I read some document about how to use text()
>>
>> but it seems when I use text().I got records from database,not instances
>> of class object.
>>
>> I want to get instance ....
>>
>> anyone can help me ?
>>
>> 2010/4/20 Cancer <[email protected]>
>>
>> Hi Michael~
>>>
>>> thank you very much for your answer~
>>>
>>> can you give me an example?
>>>
>>> I really don't know..how to use it...
>>>
>>> thanks a lot~
>>>
>>> 2010/4/20 Michael Bayer <[email protected]>
>>>
>>> use a text() construct as the argument to your from_statement() call, and
>>>> specify a "typemap" of {'birthday':NormalDate} along with it.
>>>>
>>>>
>>>> http://www.sqlalchemy.org/docs/reference/sqlalchemy/expressions.html?highlight=text#sqlalchemy.sql.expression.text
>>>>
>>>>
>>>>
>>>> On Apr 19, 2010, at 5:38 AM, Rita Liang wrote:
>>>>
>>>> > I have a custom type NormalDate which uses to convert Integer Date
>>>> > type to String Date type.
>>>> >
>>>> >  but when I use form_statement to query the date.it did't work!
>>>> >
>>>> >  however,it will work, if I use a query method...
>>>> >
>>>> >  for example.
>>>> >
>>>> > crew = query.from_statement("SELECT * from crew_member where "  +
>>>> >
>>>> > "rtrim(crew_member.lastname) || rtrim(crew_member.firstname) " +
>>>> >                                                " like '%" + crew_name
>>>> > + "%'").first()
>>>> >
>>>> > this will not work. crew.birthday shows "41274135"
>>>> >
>>>> >
>>>> > but " user = query.filter(CrewMember.last_name.like(u'%j
>>>> > %'.encode('gbk'))).first()" works well.
>>>> >
>>>> > and the crew.birthday shows "1969/06/23" this is want I want....
>>>> >
>>>> > anybody any suggestion?
>>>> >
>>>> > --
>>>> > You received this message because you are subscribed to the Google
>>>> Groups "sqlalchemy" group.
>>>> > To post to this group, send email to [email protected].
>>>> > To unsubscribe from this group, send email to
>>>> [email protected]<sqlalchemy%[email protected]>
>>>> .
>>>> > For more options, visit this group at
>>>> http://groups.google.com/group/sqlalchemy?hl=en.
>>>> >
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "sqlalchemy" group.
>>>> To post to this group, send email to [email protected].
>>>> To unsubscribe from this group, send email to
>>>> [email protected]<sqlalchemy%[email protected]>
>>>> .
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/sqlalchemy?hl=en.
>>>>
>>>>
>>>
>>>
>>> --
>>> Rita Liang
>>>
>>
>>
>>
>> --
>> Rita Liang
>>
>
>
>
> --
> Rita Liang
>



-- 
Rita Liang

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" 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/sqlalchemy?hl=en.

Reply via email to