Google Groups Home
Help | Sign in
Uppercase table and columns name
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Styx  
View profile
 More options 15 May, 14:42
From: Styx <pawel.chuchm...@gmail.com>
Date: Thu, 15 May 2008 06:42:05 -0700 (PDT)
Local: Thurs 15 May 2008 14:42
Subject: Uppercase table and columns name
Hi.

I have a table:

abstract class BaseUsers extends Doctrine_Record
{

  public function setTableDefinition()
  {
    $this->setTableName('USERS');
    $this->hasColumn('USER_ID', 'integer', 4, array('unsigned' =>
false, 'notnull' => true, 'primary' => true, 'sequence' =>
'"ShareTheMusic"."USERS_USER_ID_seq"'));
    $this->hasColumn('LOGIN', 'string', 20, array('fixed' => false,
'notnull' => true, 'primary' => false));
    $this->hasColumn('PASSWORD', 'string', 200, array('fixed' =>
false, 'notnull' => true, 'primary' => false));
    $this->hasColumn('ADD_DATE', 'timestamp', null, array('notnull' =>
false, 'primary' => false));
  }

  public function setUp()
  {
    parent::setUp();
  }

}

I want to use:

                $userTable =
Doctrine::getTable("USERS");
                $user = $userTable->findOneByLogin($_POST['login']);

findOneByLogin dosen't work:

2008-05-15T15:31:12+02:00 ERR (3): Unknown aggregate alias: login
2008-05-15T15:31:12+02:00 DEBUG (7): #0 D:\www\lib\Doctrine-0.11.0\lib
\Doctrine\Query.php(838): Doctrine_Query-

>getSqlAggregateAlias('login')

#1 D:\www\lib\Doctrine-0.11.0\lib\Doctrine\Query\Where.php(79):
Doctrine_Query->parseClause('login')
#2 D:\www\lib\Doctrine-0.11.0\lib\Doctrine\Query\Condition.php(74):
Doctrine_Query_Where->load('login = ?')
#3 D:\www\lib\Doctrine-0.11.0\lib\Doctrine\Query\Abstract.php(1788):
Doctrine_Query_Condition->parse('login = ?')
#4 D:\www\lib\Doctrine-0.11.0\lib\Doctrine\Query.php(1143):
Doctrine_Query_Abstract->_processDqlQueryPart('where', Array)
#5 D:\www\lib\Doctrine-0.11.0\lib\Doctrine\Query\Abstract.php(932):
Doctrine_Query->getSqlQuery(Array)
#6 D:\www\lib\Doctrine-0.11.0\lib\Doctrine\Query\Abstract.php(993):
Doctrine_Query_Abstract->_execute(Array)
#7 D:\www\lib\Doctrine-0.11.0\lib\Doctrine\Table.php(2094):
Doctrine_Query_Abstract->execute(Array, NULL)
#8 D:\www\lib\Doctrine-0.11.0\lib\Doctrine\Table.php(2133):
Doctrine_Table->findOneBy('login', 'asasasasa', NULL)
#9 [internal function]: Doctrine_Table->__call('findOneByLogin',
Array)

I try findOneByLOGIN, and I get:

2008-05-15T15:33:43+02:00 ERR (3): Cannot find by: LOGIN. Invalid
column or relationship alias.
2008-05-15T15:33:43+02:00 DEBUG (7): #0 [internal function]:
Doctrine_Table->__call('findOneByLOGIN', Array)
#1 D:\www\stm\application\controllers\UserController.php(35):
Doctrine_Table->findOneByLOGIN('asasasasa')

'LOGIN' becomes 'L_O_G_I_N' after Doctrine:tableize, so I omit this,
and I have got that select:

"SELECT u.user_id AS u__user_id, u.login AS u__login, u.password AS
u__password, u.add_date AS u__add_date FROM USERS u WHERE u.login = ?
LIMIT 1"

with this:

2008-05-15T15:37:47+02:00 ERR (3): SQLSTATE[42P01]: Undefined table: 7
BŁĄD: relacja "users" nie istnieje
2008-05-15T15:37:47+02:00 DEBUG (7): #0 D:\www\lib\Doctrine-0.11.0\lib
\Doctrine\Connection\Statement.php(244): Doctrine_Connection-

>rethrowException(Object(PDOException),

Object(Doctrine_Connection_Statement))
#1 D:\www\lib\Doctrine-0.11.0\lib\Doctrine\Connection.php(979):
Doctrine_Connection_Statement->execute(Array)
#2 D:\www\lib\Doctrine-0.11.0\lib\Doctrine\Query\Abstract.php(948):
Doctrine_Connection->execute('SELECT u.user_i...', Array)
#3 D:\www\lib\Doctrine-0.11.0\lib\Doctrine\Query\Abstract.php(993):
Doctrine_Query_Abstract->_execute(Array)
#4 D:\www\lib\Doctrine-0.11.0\lib\Doctrine\Table.php(2094):
Doctrine_Query_Abstract->execute(Array, NULL)
#5 D:\www\lib\Doctrine-0.11.0\lib\Doctrine\Table.php(2133):
Doctrine_Table->findOneBy('LOGIN', 'asasasasa', NULL)
#6 [internal function]: Doctrine_Table->__call('findOneByLOGIN',
Array)

first line means: 7 Error: relation "users" doesn't exist.

And... How I can use doctrine with UPPERCASED tables and columns?

Paweł Chuchmała


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jonathan Wage  
View profile
 More options 9 Jun, 01:36
From: "Jonathan Wage" <jonw...@gmail.com>
Date: Sun, 8 Jun 2008 19:36:56 -0500
Local: Mon 9 Jun 2008 01:36
Subject: Re: [doctrine-user] Uppercase table and columns name

I am pretty sure that you should define your models with lower case. The
dbms doesn't care, so Doctrine deals with table names and column names in
all lower case(i'm pretty sure about this). romanb might be able to tell me
different?

Try changing your models to lower case and use findOneByLogin() and it
should work.

- Jon

2008/5/15 Styx <pawel.chuchm...@gmail.com>:

--
Jonathan Wage
http://www.jwage.com
http://www.centresource.com

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google