Wednesday, December 31, 2008

Calling a (empty!) model-method causes SQL Error: 1064

Hi,

when I call a method of a model out of a controller, I get the
following sql-exception:

EXCEPTION ------------------------------------->

Warning (512): SQL Error: 1064: You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the
right syntax to use near 'doTest' at line 1 [CORE/cake/libs/model/
datasources/dbo_source.php, line 514]

Code | Context

$sql = "doTest"
$error = "1064: You have an error in your SQL syntax; check the manual
that corresponds to your MySQL server version for the right syntax to
use near 'doTest' at line 1"
$out = null

$out = null;
if ($error) {
trigger_error("<span style = \"color:Red;text-
align:left\"><b>SQL Error:</b> {$this->error}</span>",
E_USER_WARNING);

DboSource::showQuery() - CORE/cake/libs/model/datasources/
dbo_source.php, line 514
DboSource::execute() - CORE/cake/libs/model/datasources/
dbo_source.php, line 201
DboSource::fetchAll() - CORE/cake/libs/model/datasources/
dbo_source.php, line 337
DboSource::query() - CORE/cake/libs/model/datasources/dbo_source.php,
line 298
Model::call__() - CORE/cake/libs/model/model.php, line 436
Overloadable::__call() - CORE/cake/libs/overloadable_php5.php, line 52
AppModel::doTest() - [internal], line ??
StartController::index() - APP/controllers/start_controller.php, line
8
Object::dispatchMethod() - CORE/cake/libs/object.php, line 115
Dispatcher::_invoke() - CORE/cake/dispatcher.php, line 245
Dispatcher::dispatch() - CORE/cake/dispatcher.php, line 211
[main] - APP/webroot/index.php, line 88

Query: doTest

<------------------------------------- EXCEPTION

CODE -------------------------------->

class StartController extends AppController {
var $name = 'Start';
var $uses = array('Abc');

function index() {
// call that causes the exception
$this->Abc->doTest();
}
}

class Abc extends AppModel {
// ** ORM **
var $name = 'Abc';
var $table = 'abc';
var $displayField = 'titel';

// ** Methods **
function doTest() {
return null;
}
}

<-------------------------------- CODE

I am using the latest version (1.2 / nightlybuild 31.12.2008).


Any ideas?

Thanks.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: