Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Schema in SQLSRV not working
#1

(This post was last modified: 02-07-2021, 02:57 PM by Hrodriguez18.)

I have the following configuration using SQLSRV in database

PHP Code:
'DBPrefix' => '',
'schema' => 'adm',
'pConnect' => false

I necessarily have to use adm schema instead of dbo, however I see that the selection statement is not taking the schema that I am assigning to it in the configuration file.

PHP Code:
class UserController extends BaseController
{
    public function 
index()
    {
        
$userModel = new UserModel();
        
$entity $userModel->find(2);
        
dd($userModel->db->getLastQuery());

    }


result :




PHP Code:
SELECT *
FROM "users"
WHERE "users"."id" 


PHP Code:
SELECT *
FROM "users"
WHERE "users"."id" = :users.id


   

   

PHP Code:
class UserModel extends Model
{
    protected 
$DBGroup              'default';
    protected 
$table                'users';
    protected 
$primaryKey           'id';
    protected 
$useAutoIncrement     true;
    protected 
$insertID             0




On the other hand, if I rename the table to "adm.user" the selection is done correctly, but the insert or update statement then if I use the getFullName it returns DB.schema.tableName => "DB". "Schema" . "schema.tablename".







   
Hernan Rodríguez
[email protected]
Reply


Messages In This Thread
[SOLVED] Schema in SQLSRV not working - by Hrodriguez18 - 02-02-2021, 11:55 PM
RE: Schema in SQLSRV not working - by nfaiz - 02-03-2021, 05:58 AM
RE: Schema in SQLSRV not working - by nfaiz - 02-07-2021, 12:45 AM



Theme © iAndrew 2016 - Forum software by © MyBB