Re: [web2py] Unsigned int in DAL

2012-11-21 Thread Joseph Piron
Finally I will go with something hand made but would be great to think on this 
:)
Just a thing, in mysql unsigned exists, that's one of the column properties.

On 17 Nov 2012, at 15:57, Niphlod wrote:

 ps: checked a little and probably found out because web2py doesn't have a 
 default type for unsigned ints.
 
 SQLite -- unsigned integer doesn't exist. Only integer
 Postgresql -- same as above
 MSSQL -- same as above
 Oracle -- can be used in t-sql only, so, for table columns no support
 Mysql -- supported
 Firebird -- supported
 
 
 
 -- 
  
  
  

-- 





Re: [web2py] Unsigned int in DAL

2012-11-21 Thread Niphlod


 Finally I will go with something hand made but would be great to think on 
 this :) 
 Just a thing, in mysql unsigned exists, that's one of the column 
 properties. 

 
who said the opposite ? the thing is, it's just mysql and firebird that the 
support can be added, it's a small list compared to all engines dal 
supports.
 

 On 17 Nov 2012, at 15:57, Niphlod wrote: 

  ps: checked a little and probably found out because web2py doesn't have 
 a default type for unsigned ints. 
  
  SQLite -- unsigned integer doesn't exist. Only integer 
  Postgresql -- same as above 
  MSSQL -- same as above 
  Oracle -- can be used in t-sql only, so, for table columns no support 
 * Mysql -- supported *
  Firebird -- supported 



-- 





Re: [web2py] Unsigned int in DAL

2012-11-17 Thread Joseph Piron
BigInt - twice the same space required, I'am not sure that's why they exists..
sql.log - indeed, could do it this way, but, why is everything else possible 
with the DAL (up to now)?


On 17 Nov 2012, at 14:09, Niphlod wrote:

 
 I know 2**31, I meant the value: 2147483648  :)
 And while the IS_INT_IN_RANGE is fine for negative value (I am already using 
 it) that does not change the fact that is the column is not set as unsigned, 
 2147483648 can't be saved.
  
 that's why there's bigint. 
 
 For the deployment, no that's not a solution. We require à fully scripted 
 solution that may be deployed by maintenance guys without knowledge of what 
 they do at anytime.
 And the models evolve between updates.
 
 That was what I was talking about. taking sql.log and script the database 
 creation/migrations will save you a lot of troubles if you're going to deploy 
 several db in multiple instances
  
 Just out of curiosity, why unsigned it not a default and simple parameter ? 
 (handled only if the backend handles)
  
 Because noone until now needed it.
 
 
 -- 
  
  
  

-- 





Re: [web2py] Unsigned int in DAL

2012-11-17 Thread Niphlod


 BigInt - twice the same space required, I'am not sure that's why they 
 exists..

they exist to support signed integer larger than int. That's what you can 
do now to continue developing your app with web2py.  

 sql.log - indeed, could do it this way, but, why is everything else 
 possible with the DAL (up to now)? 

 
because if you're really going to I develop, change my models, release the 
app to 30 servers you'll shortly find out that you have to resort to 
something scripted for migrations (let's say for the simpler case, adding a 
column with a default filled value of 0). 
DAL will be glad to add the column, but not set the default value on all 
your existing rows. 

PS: I'm not against an unsigned integer support on web2py, but if you need 
it you can definitely use it now without hassle instead of waiting for a 
new web2py release.

-- 





Re: [web2py] Unsigned int in DAL

2012-11-17 Thread Niphlod
ps: checked a little and probably found out because web2py doesn't have a 
default type for unsigned ints.

SQLite -- unsigned integer doesn't exist. Only integer
Postgresql -- same as above
MSSQL -- same as above
Oracle -- can be used in t-sql only, so, for table columns no support
Mysql -- supported
Firebird -- supported


-- 





Re: [web2py] Unsigned int in DAL

2012-11-16 Thread Richard Vézina
Which backend do you use? I think that this feature is database specific...

Richard

On Fri, Nov 16, 2012 at 11:12 AM, Joseph.Piron joseph.pi...@gmail.comwrote:

 Hi all!

 I have quite a problematic issue, I would like to know how to define a
 Field as unsigned in the DAL ?
 I tested:
 Field('triggerValue', 'unsigned integer', requires=IS_NOT_EMPTY(),notnull
 =True),
 and
 Field('triggerValue', 'integer', unsigned=True, requires=IS_NOT_EMPTY
 (), notnull=True),

 But it does not work.
 Could someone please enlighten me ? :D

 Thanks in advance !!!

  --





-- 





Re: [web2py] Unsigned int in DAL

2012-11-16 Thread Marin Pranjić
You can use integer for development. In production, you can alter the
database with raw sql to change the field.
DAL will still think it's an integer. If needed, you can add validators to
make sure you're not working with negative numbers.


On Fri, Nov 16, 2012 at 5:15 PM, Richard Vézina ml.richard.vez...@gmail.com
 wrote:

 Which backend do you use? I think that this feature is database specific...

 Richard


 On Fri, Nov 16, 2012 at 11:12 AM, Joseph.Piron joseph.pi...@gmail.comwrote:

 Hi all!

 I have quite a problematic issue, I would like to know how to define a
 Field as unsigned in the DAL ?
 I tested:
 Field('triggerValue', 'unsigned integer', requires=IS_NOT_EMPTY(),notnull
 =True),
 and
 Field('triggerValue', 'integer', unsigned=True, requires=IS_NOT_EMPTY
 (), notnull=True),

 But it does not work.
 Could someone please enlighten me ? :D

 Thanks in advance !!!

  --





  --





-- 





Re: [web2py] Unsigned int in DAL

2012-11-16 Thread Joseph Piron
I am working with mysql, there's no way to do this without an alter table ?
(Which would be executed at each request moreover)
On Nov 16, 2012 5:25 PM, Marin Pranjić marin.pran...@gmail.com wrote:

 You can use integer for development. In production, you can alter the
 database with raw sql to change the field.
 DAL will still think it's an integer. If needed, you can add validators to
 make sure you're not working with negative numbers.


 On Fri, Nov 16, 2012 at 5:15 PM, Richard Vézina 
 ml.richard.vez...@gmail.com wrote:

 Which backend do you use? I think that this feature is database
 specific...

 Richard


 On Fri, Nov 16, 2012 at 11:12 AM, Joseph.Piron joseph.pi...@gmail.comwrote:

 Hi all!

 I have quite a problematic issue, I would like to know how to define a
 Field as unsigned in the DAL ?
 I tested:
 Field('triggerValue', 'unsigned integer', 
 requires=IS_NOT_EMPTY(),notnull
 =True),
 and
 Field('triggerValue', 'integer', unsigned=True, requires=
 IS_NOT_EMPTY(), notnull=True),

 But it does not work.
 Could someone please enlighten me ? :D

 Thanks in advance !!!

  --





  --





  --





-- 





Re: [web2py] Unsigned int in DAL

2012-11-16 Thread Niphlod


On Friday, November 16, 2012 5:56:18 PM UTC+1, Joseph.Piron wrote:

 I am working with mysql, there's no way to do this without an alter table 
 ? (Which would be executed at each request moreover)

PS: once the table is altered externally there's no need to perform 
anything on web2py. it's just for form validation (i.e. some of your users 
insist on filling that field with, e.g. -10 that you should enforce a 
IS_INT_IN_RANGE(minimum=0) to show the error to the user.)

--