RE: Boolean Datatype

2001-02-06 Thread Oson, Chris M.

Why not try using ENUM?

http://www.mysql.com/doc/E/N/ENUM.html

You could setup your table like this:

CREATE TABLE logInfo2
(
logID   INT NOT NULL UNIQUE,
ipAddress   VARCHAR(20) NOT NULL DEFAULT 'None',
boolVarsENUM ('T', 'F') DEFAULT 'F'
)

SELECT ipAddress FROM logInfo2 WHERE boolVars = 'F';

-Original Message-
From: russ [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 06, 2001 9:10 AM
To: [EMAIL PROTECTED]
Subject: Boolean Datatype


Im new to the list, apologies if this has been asked before.

Im developing a backend for a personal site (www.russd.com) using mySQL.
The site is hosted on NT4 and has myODBC installed, I have some database
access working, but I'm looking for a way to implement boolean types.

Using Access/SQL server I can simple do an insert using SQL like the
following (from within ASP):

INSERT INTO tblMyTable (booleanField) VALUES ("  myBooleanVariant  ");"

Unfortunately, mySQL doesn't appear to have a boolean datatype and myODBC
doesn't seem to convert True/False to 1/0.
The best solution I have so far is to use a TINYINT and change the
True/False values within my ASP code to 1/0. This isn't perfect howevere as
its more code, more work for the server and far less readable. I also have
to cast to boolean when I SELECT data from the mySQL database.

Could anyone suggest a better way of implementing this, or am I missing
something?
I have done a Google search and searched the mySQL manual, but got nothing.

Many thanks in advance of your efforts.
Russ Davies

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail
[EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Boolean Datatype

2001-02-06 Thread Russ Davies

Thanks for the suggestion, but this would still mean converting the data
type from within ASP (the 'True' type) down to a char ('T') would it not?

It is more sensical than using 1/0 but still involves the same number of
processes?

Russ Davies



- Original Message -
From: "Oson, Chris M." [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, February 06, 2001 6:36 PM
Subject: RE: Boolean Datatype


 Why not try using ENUM?

 http://www.mysql.com/doc/E/N/ENUM.html

 You could setup your table like this:

 CREATE TABLE logInfo2
 (
 logID   INT NOT NULL UNIQUE,
 ipAddress   VARCHAR(20) NOT NULL DEFAULT 'None',
 boolVarsENUM ('T', 'F') DEFAULT 'F'
 )

 SELECT ipAddress FROM logInfo2 WHERE boolVars = 'F';

 -Original Message-
 From: russ [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, February 06, 2001 9:10 AM
 To: [EMAIL PROTECTED]
 Subject: Boolean Datatype


 Im new to the list, apologies if this has been asked before.

 Im developing a backend for a personal site (www.russd.com) using mySQL.
 The site is hosted on NT4 and has myODBC installed, I have some database
 access working, but I'm looking for a way to implement boolean types.

 Using Access/SQL server I can simple do an insert using SQL like the
 following (from within ASP):

 INSERT INTO tblMyTable (booleanField) VALUES ("  myBooleanVariant  ");"

 Unfortunately, mySQL doesn't appear to have a boolean datatype and myODBC
 doesn't seem to convert True/False to 1/0.
 The best solution I have so far is to use a TINYINT and change the
 True/False values within my ASP code to 1/0. This isn't perfect howevere
as
 its more code, more work for the server and far less readable. I also have
 to cast to boolean when I SELECT data from the mySQL database.

 Could anyone suggest a better way of implementing this, or am I missing
 something?
 I have done a Google search and searched the mySQL manual, but got
nothing.

 Many thanks in advance of your efforts.
 Russ Davies

 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail
 [EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: Boolean Datatype

2001-02-06 Thread Oson, Chris M.

Maybe, but you could define a constant..

CONST TRUE  "T"
CONST FALSE "F"

INSERT INTO logInfo2 (logID, ipAddress, boolVars) VALUES (null,
'192.192.192.192', TRUE)

-Original Message-
From: Russ Davies [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 06, 2001 11:44 AM
To: Oson, Chris M.; [EMAIL PROTECTED]
Subject: Re: Boolean Datatype


Thanks for the suggestion, but this would still mean converting the data
type from within ASP (the 'True' type) down to a char ('T') would it not?

It is more sensical than using 1/0 but still involves the same number of
processes?

Russ Davies



- Original Message -
From: "Oson, Chris M." [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, February 06, 2001 6:36 PM
Subject: RE: Boolean Datatype


 Why not try using ENUM?

 http://www.mysql.com/doc/E/N/ENUM.html

 You could setup your table like this:

 CREATE TABLE logInfo2
 (
 logID   INT NOT NULL UNIQUE,
 ipAddress   VARCHAR(20) NOT NULL DEFAULT 'None',
 boolVarsENUM ('T', 'F') DEFAULT 'F'
 )

 SELECT ipAddress FROM logInfo2 WHERE boolVars = 'F';

 -Original Message-
 From: russ [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, February 06, 2001 9:10 AM
 To: [EMAIL PROTECTED]
 Subject: Boolean Datatype


 Im new to the list, apologies if this has been asked before.

 Im developing a backend for a personal site (www.russd.com) using mySQL.
 The site is hosted on NT4 and has myODBC installed, I have some database
 access working, but I'm looking for a way to implement boolean types.

 Using Access/SQL server I can simple do an insert using SQL like the
 following (from within ASP):

 INSERT INTO tblMyTable (booleanField) VALUES ("  myBooleanVariant  ");"

 Unfortunately, mySQL doesn't appear to have a boolean datatype and myODBC
 doesn't seem to convert True/False to 1/0.
 The best solution I have so far is to use a TINYINT and change the
 True/False values within my ASP code to 1/0. This isn't perfect howevere
as
 its more code, more work for the server and far less readable. I also have
 to cast to boolean when I SELECT data from the mySQL database.

 Could anyone suggest a better way of implementing this, or am I missing
 something?
 I have done a Google search and searched the mySQL manual, but got
nothing.

 Many thanks in advance of your efforts.
 Russ Davies

 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail
 [EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Boolean Datatype

2001-02-06 Thread Vivek Khera

 "RD" == Russ Davies [EMAIL PROTECTED] writes:

RD Thanks for the suggestion, but this would still mean converting the data
RD type from within ASP (the 'True' type) down to a char ('T') would it not?

then use

 ENUM('False','True')

instead.  Enum can have any string you want.  I personally prefer to
use the order False, True since then it also has the numeric values 0
and 1.

 CREATE TABLE logInfo2
 (
 logID   INT NOT NULL UNIQUE,
 ipAddress   VARCHAR(20) NOT NULL DEFAULT 'None',
 boolVarsENUM ('T', 'F') DEFAULT 'F'
 )


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Boolean Datatype

2001-02-06 Thread Russ Davies

Enum would allow me to have two values such as 'True' and 'False' ?
The problem is when I pass in this SQL statement to mySQL:

INSERT INTO tableName (fieldName) VALUES (True);

-mySQL does not recognise the word True - it would need to be in quotes,
which means changes in the code on the web server. It would mean passing in
a string instead of a boolean. This is what I'm trying to avoid.
True and False are not keywords in mySQL. Would there be any way I could
perhaps make them so (giving them values of 1 and 0 respectively would solve
my problem completely).
Thanks in advance for your efforts,
Russ Davies


- Original Message -
From: "Matt Friedman" [EMAIL PROTECTED]
To: "Russ Davies" [EMAIL PROTECTED]; "MySQL List" [EMAIL PROTECTED]
Sent: Tuesday, February 06, 2001 9:11 PM
Subject: Re: Boolean Datatype


 Try using enum in mysql. That might help you out a bit.

 Matt Friedman
 Spry New Media
 http://www.sprynewmedia.com
 Lead Programmer/Partner
 email: [EMAIL PROTECTED]
 phone: 250 744 3655
 fax: 250 370 0436


 - Original Message -
 From: "Russ Davies" [EMAIL PROTECTED]
 To: "Oson, Chris M." [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Tuesday, February 06, 2001 12:45 PM
 Subject: Re: Boolean Datatype


  I can't do that for 2 reasons :
  1] 'True' and 'False' are reserved words in ASP
  2] 'True' would then be a variant holding the value 'T' - which would
mean
 I
  could not carry out logical comparisons with the two variants,
evaluating
  things against True or False.
 
  I have to say after all the reccomendations I received for mySQL, I
really
  am shocked to find there are no BOOLEAN values/datatypes. Unless I'm
 missing
  something (and Im happy to admit I probably am) this seems like a very
  serious and time consuming omission from the mySQL spec.
  If anyone is aware of a solution to this, please email me, I quite like
  mySQL but I think I'd probably move to another DBMS rather than spend a
 long
  time and get messy coding around this problem.
 
  Russ Davies
 
 
  - Original Message -
  From: "Oson, Chris M." [EMAIL PROTECTED]
  To: "Russ Davies" [EMAIL PROTECTED]; [EMAIL PROTECTED]
  Sent: Tuesday, February 06, 2001 8:02 PM
  Subject: RE: Boolean Datatype
 
 
   Maybe, but you could define a constant..
  
   CONST TRUE  "T"
   CONST FALSE "F"
  
   INSERT INTO logInfo2 (logID, ipAddress, boolVars) VALUES (null,
   '192.192.192.192', TRUE)
  
   -Original Message-
   From: Russ Davies [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, February 06, 2001 11:44 AM
   To: Oson, Chris M.; [EMAIL PROTECTED]
   Subject: Re: Boolean Datatype
  
  
   Thanks for the suggestion, but this would still mean converting the
data
   type from within ASP (the 'True' type) down to a char ('T') would it
 not?
  
   It is more sensical than using 1/0 but still involves the same number
of
   processes?
  
   Russ Davies
  
  
  
   - Original Message -
   From: "Oson, Chris M." [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
   Sent: Tuesday, February 06, 2001 6:36 PM
   Subject: RE: Boolean Datatype
  
  
Why not try using ENUM?
   
http://www.mysql.com/doc/E/N/ENUM.html
   
You could setup your table like this:
   
CREATE TABLE logInfo2
(
logID   INT NOT NULL UNIQUE,
ipAddress   VARCHAR(20) NOT NULL DEFAULT 'None',
boolVarsENUM ('T', 'F') DEFAULT 'F'
)
   
SELECT ipAddress FROM logInfo2 WHERE boolVars = 'F';
   
-Original Message-
From: russ [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 06, 2001 9:10 AM
To: [EMAIL PROTECTED]
Subject: Boolean Datatype
   
   
Im new to the list, apologies if this has been asked before.
   
Im developing a backend for a personal site (www.russd.com) using
 mySQL.
The site is hosted on NT4 and has myODBC installed, I have some
 database
access working, but I'm looking for a way to implement boolean
types.
   
Using Access/SQL server I can simple do an insert using SQL like the
following (from within ASP):
   
INSERT INTO tblMyTable (booleanField) VALUES ("  myBooleanVariant 
  ");"
   
Unfortunately, mySQL doesn't appear to have a boolean datatype and
  myODBC
doesn't seem to convert True/False to 1/0.
The best solution I have so far is to use a TINYINT and change the
True/False values within my ASP code to 1/0. This isn't perfect
 howevere
   as
its more code, more work for the server and far less readable. I
also
  have
to cast to boolean when I SELECT data from the mySQL database.
   
Could anyone suggest a better way of implementing this, or am I
 missing
something?
I have done a Google search and searched the mySQL manual, but got
   nothing.
   
Many thanks in advance of your efforts.
Russ Davies
   
  
 ---

RE: Boolean Datatype

2001-02-06 Thread Roger Ramirez

Couldn't you just do:

boolVarsENUM ('True', 'False') DEFAULT 'False'

-or-

boolVarsENUM ('TRUE', 'FALSE') DEFAULT 'FALSE'


unless I'm misunderstanding what you are saying about ASP.


 -Original Message-
 From: Russ Davies [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, February 06, 2001 2:44 PM
 To: Oson, Chris M.; [EMAIL PROTECTED]
 Subject: Re: Boolean Datatype


 Thanks for the suggestion, but this would still mean converting the data
 type from within ASP (the 'True' type) down to a char ('T') would it not?

 It is more sensical than using 1/0 but still involves the same number of
 processes?

 Russ Davies



 - Original Message -
 From: "Oson, Chris M." [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Tuesday, February 06, 2001 6:36 PM
 Subject: RE: Boolean Datatype


  Why not try using ENUM?
 
  http://www.mysql.com/doc/E/N/ENUM.html
 
  You could setup your table like this:
 
  CREATE TABLE logInfo2
  (
  logID   INT NOT NULL UNIQUE,
  ipAddress   VARCHAR(20) NOT NULL DEFAULT 'None',
  boolVarsENUM ('T', 'F') DEFAULT 'F'
  )
 
  SELECT ipAddress FROM logInfo2 WHERE boolVars = 'F';
 
  -Original Message-
  From: russ [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, February 06, 2001 9:10 AM
  To: [EMAIL PROTECTED]
  Subject: Boolean Datatype
 
 
  Im new to the list, apologies if this has been asked before.
 
  Im developing a backend for a personal site (www.russd.com) using mySQL.
  The site is hosted on NT4 and has myODBC installed, I have some database
  access working, but I'm looking for a way to implement boolean types.
 
  Using Access/SQL server I can simple do an insert using SQL like the
  following (from within ASP):
 
  INSERT INTO tblMyTable (booleanField) VALUES (" 
 myBooleanVariant  ");"
 
  Unfortunately, mySQL doesn't appear to have a boolean datatype
 and myODBC
  doesn't seem to convert True/False to 1/0.
  The best solution I have so far is to use a TINYINT and change the
  True/False values within my ASP code to 1/0. This isn't perfect howevere
 as
  its more code, more work for the server and far less readable.
 I also have
  to cast to boolean when I SELECT data from the mySQL database.
 
  Could anyone suggest a better way of implementing this, or am I missing
  something?
  I have done a Google search and searched the mySQL manual, but got
 nothing.
 
  Many thanks in advance of your efforts.
  Russ Davies
 
  -
  Before posting, please check:
 http://www.mysql.com/manual.php   (the manual)
 http://lists.mysql.com/   (the list archive)
 
  To request this thread, e-mail [EMAIL PROTECTED]
  To unsubscribe, e-mail
  [EMAIL PROTECTED]
  Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
 


 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail
 [EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php





-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Boolean Datatype

2001-02-06 Thread Russ Davies

When a True data type is passed in from ASP, the resultant SQL command will
look like this :
INSERT INTO tableName (fieldName) VALUES (True);
Not this :
INSERT INTO tableName (fieldName) VALUES ('True');

So produces an error as the value is not enclosed in quotes, which it would
need to be for an ENUM data type?

Russ Davies

- Original Message -
From: "Vivek Khera" [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, February 06, 2001 9:09 PM
Subject: Re: Boolean Datatype


  "RD" == Russ Davies [EMAIL PROTECTED] writes:

 RD Thanks for the suggestion, but this would still mean converting the
data
 RD type from within ASP (the 'True' type) down to a char ('T') would it
not?

 then use

  ENUM('False','True')

 instead.  Enum can have any string you want.  I personally prefer to
 use the order False, True since then it also has the numeric values 0
 and 1.

  CREATE TABLE logInfo2
  (
  logID   INT NOT NULL UNIQUE,
  ipAddress   VARCHAR(20) NOT NULL DEFAULT 'None',
  boolVarsENUM ('T', 'F') DEFAULT 'F'
  )


 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

 To request this thread, e-mail [EMAIL PROTECTED]
 To unsubscribe, e-mail [EMAIL PROTECTED]
 Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Boolean Datatype

2001-02-06 Thread btjones


I use True/False fields all the time from MS Access through myODBC.  While
I've not used ASP, it would seem that the functionality would be the same.
If this is the case, then True is represented by -1 and False is
represented by 0.  Simply use the TINYINT that mySQL provides to store
these two values.



"Russ Davies" [EMAIL PROTECTED] wrote:

I can't do that for 2 reasons :
1] 'True' and 'False' are reserved words in ASP
2] 'True' would then be a variant holding the value 'T' - which would mean
I
could not carry out logical comparisons with the two variants, evaluating
things against True or False.

I have to say after all the reccomendations I received for mySQL, I really
am shocked to find there are no BOOLEAN values/datatypes. Unless I'm
missing
something (and Im happy to admit I probably am) this seems like a very
serious and time consuming omission from the mySQL spec.
If anyone is aware of a solution to this, please email me, I quite like
mySQL but I think I'd probably move to another DBMS rather than spend a
long
time and get messy coding around this problem.

Russ Davies


- Original Message -
From: "Oson, Chris M." [EMAIL PROTECTED]
To: "Russ Davies" [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Tuesday, February 06, 2001 8:02 PM
Subject: RE: Boolean Datatype


 Maybe, but you could define a constant..

 CONST TRUE  "T"
 CONST FALSE "F"

 INSERT INTO logInfo2 (logID, ipAddress, boolVars) VALUES (null,
 '192.192.192.192', TRUE)

 -Original Message-
 From: Russ Davies [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, February 06, 2001 11:44 AM
 To: Oson, Chris M.; [EMAIL PROTECTED]
 Subject: Re: Boolean Datatype


 Thanks for the suggestion, but this would still mean converting the data
 type from within ASP (the 'True' type) down to a char ('T') would it not?

 It is more sensical than using 1/0 but still involves the same number of
 processes?

 Russ Davies



 - Original Message -
 From: "Oson, Chris M." [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Tuesday, February 06, 2001 6:36 PM
 Subject: RE: Boolean Datatype


  Why not try using ENUM?
 
  http://www.mysql.com/doc/E/N/ENUM.html
 
  You could setup your table like this:
 
  CREATE TABLE logInfo2
  (
  logID   INT NOT NULL UNIQUE,
  ipAddress   VARCHAR(20) NOT NULL DEFAULT 'None',
  boolVarsENUM ('T', 'F') DEFAULT 'F'
  )
 
  SELECT ipAddress FROM logInfo2 WHERE boolVars = 'F';
 
  -Original Message-
  From: russ [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, February 06, 2001 9:10 AM
  To: [EMAIL PROTECTED]
  Subject: Boolean Datatype
 
 
  Im new to the list, apologies if this has been asked before.
 
  Im developing a backend for a personal site (www.russd.com) using
mySQL.
  The site is hosted on NT4 and has myODBC installed, I have some
database
  access working, but I'm looking for a way to implement boolean types.
 
  Using Access/SQL server I can simple do an insert using SQL like the
  following (from within ASP):
 
  INSERT INTO tblMyTable (booleanField) VALUES ("  myBooleanVariant 
");"
 
  Unfortunately, mySQL doesn't appear to have a boolean datatype and
myODBC
  doesn't seem to convert True/False to 1/0.
  The best solution I have so far is to use a TINYINT and change the
  True/False values within my ASP code to 1/0. This isn't perfect
howevere
 as
  its more code, more work for the server and far less readable. I also
have
  to cast to boolean when I SELECT data from the mySQL database.
 
  Could anyone suggest a better way of implementing this, or am I missing
  something?
  I have done a Google search and searched the mySQL manual, but got
 nothing.
 
  Many thanks in advance of your efforts.
  Russ Davies






-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: Boolean Datatype

2001-02-06 Thread Gregg Housh

http://www.mysql.com/doc/A/d/Adding_functions.html

Could this help him out? Creating a User Defined Function?

Gregg

- Original Message -
From: Russ Davies [EMAIL PROTECTED]
To: Matt Friedman [EMAIL PROTECTED]; MySQL List
[EMAIL PROTECTED]
Sent: Tuesday, February 06, 2001 3:42 PM
Subject: Re: Boolean Datatype


Enum would allow me to have two values such as 'True' and 'False' ?
The problem is when I pass in this SQL statement to mySQL:

INSERT INTO tableName (fieldName) VALUES (True);

-mySQL does not recognise the word True - it would need to be in quotes,
which means changes in the code on the web server. It would mean passing in
a string instead of a boolean. This is what I'm trying to avoid.
True and False are not keywords in mySQL. Would there be any way I could
perhaps make them so (giving them values of 1 and 0 respectively would solve
my problem completely).
Thanks in advance for your efforts,
Russ Davies


- Original Message -
From: "Matt Friedman" [EMAIL PROTECTED]
To: "Russ Davies" [EMAIL PROTECTED]; "MySQL List" [EMAIL PROTECTED]
Sent: Tuesday, February 06, 2001 9:11 PM
Subject: Re: Boolean Datatype


 Try using enum in mysql. That might help you out a bit.

 Matt Friedman
 Spry New Media
 http://www.sprynewmedia.com
 Lead Programmer/Partner
 email: [EMAIL PROTECTED]
 phone: 250 744 3655
 fax: 250 370 0436


 - Original Message -
 From: "Russ Davies" [EMAIL PROTECTED]
 To: "Oson, Chris M." [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Tuesday, February 06, 2001 12:45 PM
 Subject: Re: Boolean Datatype


  I can't do that for 2 reasons :
  1] 'True' and 'False' are reserved words in ASP
  2] 'True' would then be a variant holding the value 'T' - which would
mean
 I
  could not carry out logical comparisons with the two variants,
evaluating
  things against True or False.
 
  I have to say after all the reccomendations I received for mySQL, I
really
  am shocked to find there are no BOOLEAN values/datatypes. Unless I'm
 missing
  something (and Im happy to admit I probably am) this seems like a very
  serious and time consuming omission from the mySQL spec.
  If anyone is aware of a solution to this, please email me, I quite like
  mySQL but I think I'd probably move to another DBMS rather than spend a
 long
  time and get messy coding around this problem.
 
  Russ Davies
 
 
  - Original Message -
  From: "Oson, Chris M." [EMAIL PROTECTED]
  To: "Russ Davies" [EMAIL PROTECTED]; [EMAIL PROTECTED]
  Sent: Tuesday, February 06, 2001 8:02 PM
  Subject: RE: Boolean Datatype
 
 
   Maybe, but you could define a constant..
  
   CONST TRUE  "T"
   CONST FALSE "F"
  
   INSERT INTO logInfo2 (logID, ipAddress, boolVars) VALUES (null,
   '192.192.192.192', TRUE)
  
   -Original Message-
   From: Russ Davies [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, February 06, 2001 11:44 AM
   To: Oson, Chris M.; [EMAIL PROTECTED]
   Subject: Re: Boolean Datatype
  
  
   Thanks for the suggestion, but this would still mean converting the
data
   type from within ASP (the 'True' type) down to a char ('T') would it
 not?
  
   It is more sensical than using 1/0 but still involves the same number
of
   processes?
  
   Russ Davies
  
  
  
   - Original Message -
   From: "Oson, Chris M." [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
   Sent: Tuesday, February 06, 2001 6:36 PM
   Subject: RE: Boolean Datatype
  
  
Why not try using ENUM?
   
http://www.mysql.com/doc/E/N/ENUM.html
   
You could setup your table like this:
   
CREATE TABLE logInfo2
(
logID   INT NOT NULL UNIQUE,
ipAddress   VARCHAR(20) NOT NULL DEFAULT 'None',
boolVarsENUM ('T', 'F') DEFAULT 'F'
)
   
SELECT ipAddress FROM logInfo2 WHERE boolVars = 'F';
   
-Original Message-
From: russ [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 06, 2001 9:10 AM
To: [EMAIL PROTECTED]
Subject: Boolean Datatype
   
   
Im new to the list, apologies if this has been asked before.
   
Im developing a backend for a personal site (www.russd.com) using
 mySQL.
The site is hosted on NT4 and has myODBC installed, I have some
 database
access working, but I'm looking for a way to implement boolean
types.
   
Using Access/SQL server I can simple do an insert using SQL like the
following (from within ASP):
   
INSERT INTO tblMyTable (booleanField) VALUES ("  myBooleanVariant 
  ");"
   
Unfortunately, mySQL doesn't appear to have a boolean datatype and
  myODBC
doesn't seem to convert True/False to 1/0.
The best solution I have so far is to use a TINYINT and change the
True/False values within my ASP code to 1/0. This isn't perfect
 howevere
   as
its more code, more work for the server and far less readable. I
also
  have
to cast to boolean 

Re: Boolean Datatype

2001-02-06 Thread Gregg Housh

Let me add to this.  I meant to say: He could create a function that would
do it, and use it in his queries?

Gregg

- Original Message -
From: Gregg Housh [EMAIL PROTECTED]
To: Russ Davies [EMAIL PROTECTED]; Matt Friedman [EMAIL PROTECTED];
MySQL List [EMAIL PROTECTED]
Sent: Tuesday, February 06, 2001 3:56 PM
Subject: Re: Boolean Datatype


http://www.mysql.com/doc/A/d/Adding_functions.html

Could this help him out? Creating a User Defined Function?

Gregg

- Original Message -
From: Russ Davies [EMAIL PROTECTED]
To: Matt Friedman [EMAIL PROTECTED]; MySQL List
[EMAIL PROTECTED]
Sent: Tuesday, February 06, 2001 3:42 PM
Subject: Re: Boolean Datatype


Enum would allow me to have two values such as 'True' and 'False' ?
The problem is when I pass in this SQL statement to mySQL:

INSERT INTO tableName (fieldName) VALUES (True);

-mySQL does not recognise the word True - it would need to be in quotes,
which means changes in the code on the web server. It would mean passing in
a string instead of a boolean. This is what I'm trying to avoid.
True and False are not keywords in mySQL. Would there be any way I could
perhaps make them so (giving them values of 1 and 0 respectively would solve
my problem completely).
Thanks in advance for your efforts,
Russ Davies


- Original Message -
From: "Matt Friedman" [EMAIL PROTECTED]
To: "Russ Davies" [EMAIL PROTECTED]; "MySQL List" [EMAIL PROTECTED]
Sent: Tuesday, February 06, 2001 9:11 PM
Subject: Re: Boolean Datatype


 Try using enum in mysql. That might help you out a bit.

 Matt Friedman
 Spry New Media
 http://www.sprynewmedia.com
 Lead Programmer/Partner
 email: [EMAIL PROTECTED]
 phone: 250 744 3655
 fax: 250 370 0436


 - Original Message -
 From: "Russ Davies" [EMAIL PROTECTED]
 To: "Oson, Chris M." [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Tuesday, February 06, 2001 12:45 PM
 Subject: Re: Boolean Datatype


  I can't do that for 2 reasons :
  1] 'True' and 'False' are reserved words in ASP
  2] 'True' would then be a variant holding the value 'T' - which would
mean
 I
  could not carry out logical comparisons with the two variants,
evaluating
  things against True or False.
 
  I have to say after all the reccomendations I received for mySQL, I
really
  am shocked to find there are no BOOLEAN values/datatypes. Unless I'm
 missing
  something (and Im happy to admit I probably am) this seems like a very
  serious and time consuming omission from the mySQL spec.
  If anyone is aware of a solution to this, please email me, I quite like
  mySQL but I think I'd probably move to another DBMS rather than spend a
 long
  time and get messy coding around this problem.
 
  Russ Davies
 
 
  - Original Message -
  From: "Oson, Chris M." [EMAIL PROTECTED]
  To: "Russ Davies" [EMAIL PROTECTED]; [EMAIL PROTECTED]
  Sent: Tuesday, February 06, 2001 8:02 PM
  Subject: RE: Boolean Datatype
 
 
   Maybe, but you could define a constant..
  
   CONST TRUE  "T"
   CONST FALSE "F"
  
   INSERT INTO logInfo2 (logID, ipAddress, boolVars) VALUES (null,
   '192.192.192.192', TRUE)
  
   -Original Message-
   From: Russ Davies [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, February 06, 2001 11:44 AM
   To: Oson, Chris M.; [EMAIL PROTECTED]
   Subject: Re: Boolean Datatype
  
  
   Thanks for the suggestion, but this would still mean converting the
data
   type from within ASP (the 'True' type) down to a char ('T') would it
 not?
  
   It is more sensical than using 1/0 but still involves the same number
of
   processes?
  
   Russ Davies
  
  
  
   - Original Message -
   From: "Oson, Chris M." [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
   Sent: Tuesday, February 06, 2001 6:36 PM
   Subject: RE: Boolean Datatype
  
  
Why not try using ENUM?
   
http://www.mysql.com/doc/E/N/ENUM.html
   
You could setup your table like this:
   
CREATE TABLE logInfo2
(
logID   INT NOT NULL UNIQUE,
ipAddress   VARCHAR(20) NOT NULL DEFAULT 'None',
boolVarsENUM ('T', 'F') DEFAULT 'F'
)
   
SELECT ipAddress FROM logInfo2 WHERE boolVars = 'F';
   
-Original Message-
From: russ [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 06, 2001 9:10 AM
To: [EMAIL PROTECTED]
Subject: Boolean Datatype
   
   
Im new to the list, apologies if this has been asked before.
   
Im developing a backend for a personal site (www.russd.com) using
 mySQL.
The site is hosted on NT4 and has myODBC installed, I have some
 database
access working, but I'm looking for a way to implement boolean
types.
   
Using Access/SQL server I can simple do an insert using SQL like the
following (from within ASP):
   
INSERT INTO tblMyTable (booleanField) VALUES ("  myBooleanVariant 
  ");"
   
Unfortunately, mySQL doesn't appear 

Re: Boolean Datatype

2001-02-06 Thread Rolf Hopkins

I am surprised you said that.  There are many programming languages that do
not recognise boolean datatypes.  To define a boolean variable in these
languages, declare a variable as integer then 0 = false and any other number
= true.

In your case, I suggest you could try changing your Access/ASP datatype to
integers instead.  It should still be able to handle normal boolean
comparisons.  Ie "if myboolean then", you shouldn't need to change to "if
myboolean  0 then"


- Original Message -
From: "Russ Davies" [EMAIL PROTECTED]
To: "Oson, Chris M." [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Wednesday, February 07, 2001 4:45
Subject: Re: Boolean Datatype


 I can't do that for 2 reasons :
 1] 'True' and 'False' are reserved words in ASP
 2] 'True' would then be a variant holding the value 'T' - which would mean
I
 could not carry out logical comparisons with the two variants, evaluating
 things against True or False.

 I have to say after all the reccomendations I received for mySQL, I really
 am shocked to find there are no BOOLEAN values/datatypes. Unless I'm
missing
 something (and Im happy to admit I probably am) this seems like a very
 serious and time consuming omission from the mySQL spec.
 If anyone is aware of a solution to this, please email me, I quite like
 mySQL but I think I'd probably move to another DBMS rather than spend a
long
 time and get messy coding around this problem.

 Russ Davies


 - Original Message -
 From: "Oson, Chris M." [EMAIL PROTECTED]
 To: "Russ Davies" [EMAIL PROTECTED]; [EMAIL PROTECTED]
 Sent: Tuesday, February 06, 2001 8:02 PM
 Subject: RE: Boolean Datatype


  Maybe, but you could define a constant..
 
  CONST TRUE  "T"
  CONST FALSE "F"
 
  INSERT INTO logInfo2 (logID, ipAddress, boolVars) VALUES (null,
  '192.192.192.192', TRUE)
 
  -Original Message-
  From: Russ Davies [mailto:[EMAIL PROTECTED]]
  Sent: Tuesday, February 06, 2001 11:44 AM
  To: Oson, Chris M.; [EMAIL PROTECTED]
  Subject: Re: Boolean Datatype
 
 
  Thanks for the suggestion, but this would still mean converting the data
  type from within ASP (the 'True' type) down to a char ('T') would it
not?
 
  It is more sensical than using 1/0 but still involves the same number of
  processes?
 
  Russ Davies
 
 
 
  - Original Message -
  From: "Oson, Chris M." [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
  Sent: Tuesday, February 06, 2001 6:36 PM
  Subject: RE: Boolean Datatype
 
 
   Why not try using ENUM?
  
   http://www.mysql.com/doc/E/N/ENUM.html
  
   You could setup your table like this:
  
   CREATE TABLE logInfo2
   (
   logID   INT NOT NULL UNIQUE,
   ipAddress   VARCHAR(20) NOT NULL DEFAULT 'None',
   boolVarsENUM ('T', 'F') DEFAULT 'F'
   )
  
   SELECT ipAddress FROM logInfo2 WHERE boolVars = 'F';
  
   -Original Message-
   From: russ [mailto:[EMAIL PROTECTED]]
   Sent: Tuesday, February 06, 2001 9:10 AM
   To: [EMAIL PROTECTED]
   Subject: Boolean Datatype
  
  
   Im new to the list, apologies if this has been asked before.
  
   Im developing a backend for a personal site (www.russd.com) using
mySQL.
   The site is hosted on NT4 and has myODBC installed, I have some
database
   access working, but I'm looking for a way to implement boolean types.
  
   Using Access/SQL server I can simple do an insert using SQL like the
   following (from within ASP):
  
   INSERT INTO tblMyTable (booleanField) VALUES ("  myBooleanVariant 
 ");"
  
   Unfortunately, mySQL doesn't appear to have a boolean datatype and
 myODBC
   doesn't seem to convert True/False to 1/0.
   The best solution I have so far is to use a TINYINT and change the
   True/False values within my ASP code to 1/0. This isn't perfect
howevere
  as
   its more code, more work for the server and far less readable. I also
 have
   to cast to boolean when I SELECT data from the mySQL database.
  
   Could anyone suggest a better way of implementing this, or am I
missing
   something?
   I have done a Google search and searched the mySQL manual, but got
  nothing.
  
   Many thanks in advance of your efforts.
   Russ Davies
  
   -
   Before posting, please check:
  http://www.mysql.com/manual.php   (the manual)
  http://lists.mysql.com/   (the list archive)
  
   To request this thread, e-mail [EMAIL PROTECTED]
   To unsubscribe, e-mail
   [EMAIL PROTECTED]
   Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
  
 


 -
 Before posting, please check:
http://www.mysql.com/manual.php   (the manual)
http://lists.mysql.com/   (the list archive)

 To request this thread, e-mail [EMAIL PROTECTED]
 To unsu