spadefoot / kohana-orm-leap

An ORM module for the Kohana PHP framework that is designed to work with all major databases.
http://spadefoot.github.io/kohana-orm-leap/
100 stars 25 forks source link

Not connected to SQL Server 2008 (sqlsrv driver) #91

Closed fourteenmeister closed 11 years ago

fourteenmeister commented 11 years ago

I am using SQL Server 2008 (sqlsrv driver). System (apache 2.4.4 + php 5.4.13 + kohana 3.3(develop)). Leap module 3.3 (develop).

Bootstrap:

Kohana::modules(array( // 'auth' => MODPATH.'auth', // Basic authentication // 'cache' => MODPATH.'cache', // Caching with multiple backends // 'codebench' => MODPATH.'codebench', // Benchmarking tool 'database' => MODPATH.'database', // Database access // 'image' => MODPATH.'image', // Image manipulation 'leap' => MODPATH . 'leap', // 'minion' => MODPATH.'minion', // CLI Tasks // 'orm' => MODPATH.'orm', // Object Relationship Mapping // 'unittest' => MODPATH.'unittest', // Unit testing // 'userguide' => MODPATH.'userguide', // User guide and API documentation )); Route::set('default', '((/(/)))') ->defaults(array( 'controller' => 'welcome', 'action' => 'index', ));

My database config:

<?php defined('SYSPATH') OR die('No direct script access.'); $config = array(); $config['default'] = array( 'type' => 'SQL', // string (e.g. SQL, NoSQL, or LDAP) 'dialect' => 'SQL', // string (e.g. DB2, Drizzle, Firebird, MariaDB, MsSQL, MySQL, Oracle, PostgreSQL, or SQLite) 'driver' => 'Standard', // string (e.g. Standard, Improved, or PDO) 'connection' => array( 'persistent' => FALSE, // boolean 'hostname' => 'domen.ru\SQLSERVER', // string 'port' => '', // string 'database' => 'PortalTest', // string 'username' => 'user', // string 'password' => 'password', // string 'role' => '', // string ), 'caching' => FALSE, // boolean 'charset' => 'utf8', // string ); return $config; ?>

class Welcome.php

<?php defined('SYSPATH') or die('No direct script access.'); class Controller_Welcome extends Controller { public function action_index() { $this->response->body('hello, world!'); $connection = DB_Connection_Driver::factory('default'); $connection->open(); $results = $connection->query('SELECT * FROM table_users;'); $connection->close();
print_r($results); } } // End Welcome

Fatal error: Cannot instantiate abstract class DB_SQL_Connection_Standard in C:\WebServer\www\kohana\modules\leap\classes\Base\DB\Connection\Driver.php on line 333

if i'm using mySQL - work fine. But i'm need using SQL driver (sqlsrv). Who i made it? (sorry from my bad English).

fourteenmeister commented 11 years ago

Hmmm, i know dialect must be set to MsSQL and driver - Improved, but this not work too!!!!

Result: Fatal error: Class 'DB_SQL_Connection_Improved' not found in C:\WebServer\www\kohana\modules\leap\classes\Base\DB\MsSQL\Connection\Improved.php on line 33

I was created Improved.php in a directory (DB/SQL/Connection) <?php defined('SYSPATH') OR die('No direct script access.'); abstract class DB_SQL_Connection_Improved extends Base_DB_SQL_Connection_Standard {}

and got the following error: Parse error: syntax error, unexpected 'return' (T_RETURN) in C:\WebServer\www\kohana\modules\leap\classes\Base\DB\MsSQL\DataReader\Improved.php on line 87

bug

correct and get another mistake

Fatal error: Class 'DB_SQL_DataReader_Improved' not found in C:\WebServer\www\kohana\modules\leap\classes\Base\DB\MsSQL\DataReader\Improved.php on line 32

pfffff, Again create a file Improved.php in a directory (DB/SQL/Datareader) <?php defined('SYSPATH') OR die('No direct script access.'); abstract class DB_SQL_DataReader_Improved extends Base_DB_SQL_DataReader_Standard {}

and Finally, working.

Please fix this problem. Thanks in advance.