Selecting a database in NotORM

94 views
Skip to first unread message

Sebastian Hodapp

unread,
May 17, 2013, 7:40:21 AM5/17/13
to not...@googlegroups.com
Hi,
 
I'm trying to use NotORM together with ODBC. Unfortuntaly I'm not able to provide the database-name within the ODBC-driver in Windows when creating a data source.
 
Thus doing it the "classic" way, my database connection and query looks like:
 
$conn = odbc_connect("MY_DATASOURCE_NAME","root","root_psw", SQL_CUR_USE_ODBC);
$sql = "SELECT * FROM MY_DATABASE.SYSTEM_USERS WHERE ACTIVE = 1";
 
To achieve the same, I was looking like something similiar in NotORM. I'm able to get the connection:
 
 $pdo = new PDO('odbc:MY_DATASOURCE_NAME, 'root', 'root_psw');
 $db = new NotORM($pdo);
 
But how to proceed to give the information on the database to do the select?
 
$db->MY_DATABASE()->SYSTEM_USERS() is not working.
 
What's the right function to provide the database?
 
Thanks a lot!
Sebastian

Jakub Vrana

unread,
Jun 26, 2013, 1:05:08 PM6/26/13
to not...@googlegroups.com
ODBC isn't officially supported by NotORM. Anyway, you could try
something like this:

$system_users = "MY_DATABASE.SYSTEM_USERS";
$notorm->$system_users("active", 1);

Or:

$notorm->{"MY_DATABASE.SYSTEM_USERS"}("active", 1);

Perhaps the best solution would be to use $prefix = "MY_DATABASE." in
NotORM_Structure_Convention constructor.

Jakub
> --
> You received this message because you are subscribed to the Google
> Groups "NotORM" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to notorm+un...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
Reply all
Reply to author
Forward
0 new messages