Yes, you can put this code in the controller. It depends on how/when
you determine the dbname

On Jun 24, 8:11 pm, Phyo Arkar <[email protected]> wrote:
> So what i am doing is DB manager which support creating of DBs and
> also want to Define predefined set of Tables  inside DB.
>
> But , as its going to be dynamic , it have to load DBs on the fly ,
> inside controllers..
>
> Lile this:
>
> In Controller:
>
> def __createCase(dbName):
>     import MySQLdb
>     newdb=MySQLdb.connect(user='root')
>     cur =newdb.cursor()
>     r=cur.execute('CREATE DATABASE '+dbName)
>     if r>0:
>         return dbName
>     else:
>         return "Fail"
>
> def __loadDB(dbName):
>
>    loadedDB = DAL("mysql:/r...@localhost/" + dbName)
>
> anyways to do it in the modesl?

Reply via email to