[SQLObject] gettin column type information
Hi, need help we a maybe newbie question. i'm using cherrypy and sqlobject to write a litte program. actually i'm implementing the search pages and i would like to use automatically the startswith option every time the column type is "String". i will pass 1...n parameters and the i evaluate and split them into column-name and search value. i have the column-name and need to know the filed type of this column here my "working" example where i'm actually checking the name instead of the column type. thx mike [...] class Webuser(SQLObject): _connection = myconn username = StringCol(length = 15) group = IntCol() [] def mysearchresult(self, **kwargs): if len(kwargs) > 0: evalList = [] for kw in kwargs.items(): #assemble all criteria into a bigstring #to be evaluated key, val = kw if key == "username": evalList.append('Webuser.q.%s.startswith("%s")' % (key, val)) else: evalList.append('Webuser.q.%s=="%s"' % (key, val)) if len(kwargs) == 1: critString = ''.join(evalList) evalString = 'Webuser.select(%s)' % (critString) mywebusers = eval(evalString) else: critString = ' , '.join(evalList) evalString = 'Webuser.select(AND(%s))' % (critString) mywebusers = eval(evalString) else: mywebusers = Webuser.select() template = Template(''' [..] - This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse012070mrt/direct/01/ ___ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
[SQLObject] own sql and procedures
Hi, i have 2 questions. 1) is there a possibiliti' to start my own (complex) sql update script. example insert into webstats (uname,tipoctr) (Select cbl.codice, 1+IFNULL((select 1 from collab2 where cbl.codice = collab2.codice),0) from collab cbl); 2) How can i start procedures from sqlobject. thanks mike - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
Re: [SQLObject] own sql and procedures
Am Mon, 5 Nov 2007 18:08:06 +0100 schrieb "Diez B. Roggisch" <[EMAIL PROTECTED]>: > On Monday 05 November 2007 15:25:13 [EMAIL PROTECTED] wrote: > > Hi, > > i have 2 questions. > > > > 1) is there a possibiliti' to start my own (complex) sql update > > script. example > > > > insert into webstats (uname,tipoctr) > > (Select > > cbl.codice, > > 1+IFNULL((select 1 from collab2 where cbl.codice = > > collab2.codice),0) > > from collab cbl); > > > > > > 2) How can i start procedures from sqlobject. > > Obtain a connection to your DB, which you should be able to using > > MySQLObjectClass._connection > > and then just proceed as if you were using the DB API itself. > > There is no support for more in SO because calling procedures & > running hand-tailored SQL somewhat defeats the purpose of introducing > an ORM layer in the first place. > > Be also aware of synchronisation-caveats when your procedures update > the DB but the SO-cache doesn't reflect the changes. > > Diez i know it is not the best to use hand-tailored SQL but in some "complicated" cases it's the only solution, i need this to create a statistic table. thx Mike - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
Re: [SQLObject] own sql and procedures
Am Mon, 5 Nov 2007 19:46:38 +0300 schrieb Oleg Broytmann <[EMAIL PROTECTED]>: > On Mon, Nov 05, 2007 at 03:25:13PM +0100, [EMAIL PROTECTED] wrote: > > 1) is there a possibiliti' to start my own (complex) sql update > > script. > [skip] > > 2) How can i start procedures from sqlobject. > >connection.query("INSERT...") > >result = connection.queryAll("SELECT...") >for row in result: > print row > > Oleg. Thx you this will help ! mike - This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ ___ sqlobject-discuss mailing list sqlobject-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss