#1592: Oracle DataDict NUMBER and VARCHAR2 issues
-----------------------------------+----------------------------------------
Reporter: adrive | Owner: jwage
Type: defect | Status: new
Priority: major | Milestone: 1.0.4
Component: Schema Files | Version: 1.0.3
Keywords: | Has_test: 0
Mystatus: Pending Core Response | Has_patch: 0
-----------------------------------+----------------------------------------
Hello. I decide to create this ticket, because I am not sure, if the way I
decide to solve some issues is right and I would like to discuss about it.
'''VARCHAR2 issues:'''
Oracle supports VARCHAR2 columns to be 4000 bytes long. So we can store
4000 CHARS in VARCHAR2 columns, but not unicode. So I decide to make a
patch to allow store max. 2000 CHARS in VARCHAR2 columns to be able to
store also unicode chars without getting an 4000 bytes exceed error.
Maybe the other solution woul be to specify unit parameter of column with
two possible values: chars, bytes. And the user should make decission
which one will be used. I can create a patch also for this possibility.
But now, VARCHAR2 length is unlimited, which trigger errors when creating
tables in database.
'''NUMBER issues:'''
Now when descibing number columns in MySQL or Posgresql should be
specified:
{{{
bigint:
type: integer(8)
integer:
type: integer(4)
mediumint:
type: integer(3)
smallint:
type: integer(2)
tinyint:
type: integer(1)
...
}}}
In MySQL or Pgsql this will generate
integer(4) => INTEGER, integer(3) => MEDIUMINT, integer(2) => SMALLINT,
integer(1) => TINYINT. As lenght means number of bytes the number will be
stored in. Oracle doesn't support any of the *INT, even there are some
synonyms for NUMBER (INTEGER, SMALLINT).
In oracle NUMBER datatype should have two params precisions and scale.
In Oracle integer(4) will be NUMBER(4) which means, that the biggest
possible value for this column is 9999. As there are alredy some plugins
(sfDoctrineGuard) that uses for id definition the lenght for integer(4) it
means, that in Oracle you cannot have more then 9999 sfGuardUsers in your
database.
Therefor I am suggesting to translating the size attribute of number
columns to equivalents of BIGINT, MEDIUMINT...
For example:
{{{
integer(1) to NUMBER(3) // max value 255 in unisgned TINYINT in MySQL
integer(2) to NUMBER(5) // max value 65535 in unsigned SMALLINT
integer(3) to NUMBER(8) // MEDIUMINT 16777215
integer(4) to NUMBER(10) // INT 2147483647
integer(8) to NUMBER(20) // BIGINT 18446744073709551615
}}}
Any size of integer definition larger than 8 and smaller than 38 will be
translated tu NUMBER(n)
Of course, in datadict should be new type - number, and anyone who will
use only Oracle should be able to define NUMBER(precision, scale) as he
wants.
I will provide Oracle for Doctrine developers in a few days. But you will
need Oracle client and compiled oci8 drivers.
--
Ticket URL: <http://trac.doctrine-project.org/ticket/1592>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"doctrine-svn" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---