use char instead of varchar

This commit is contained in:
Graham Knop 2009-02-18 03:18:20 +00:00
parent c90fa56507
commit e5ede77c29
17 changed files with 31 additions and 31 deletions

View file

@ -130,13 +130,13 @@ sub addThing {
}
$db->write("create table ".$db->dbh->quote_identifier("Thingy_".$newThingId)."(
thingDataId varchar(22) binary not null,
thingDataId CHAR(22) binary not null,
dateCreated int not null,
createdById varchar(22) not null,
updatedById varchar(22) not null,
updatedByName varchar(255) not null,
createdById CHAR(22) not null,
updatedById CHAR(22) not null,
updatedByName CHAR(255) not null,
lastUpdated int not null,
ipAddress varchar(255),
ipAddress CHAR(255),
primary key (thingDataId)
) ENGINE=MyISAM DEFAULT CHARSET=utf8");
@ -591,7 +591,7 @@ sub _getDbDataType {
my ($dbDataType, $formClass);
if ($fieldType =~ m/^otherThing/x){
$dbDataType = "varchar(22)";
$dbDataType = "CHAR(22)";
}
else{
$formClass = 'WebGUI::Form::' . ucfirst $fieldType;

View file

@ -64,7 +64,7 @@ sub install {
my $sql
= q{CREATE TABLE `}
. $installDef->{tableName} . q{` ( }
. q{`assetId` VARCHAR(22) BINARY NOT NULL, }
. q{`assetId` CHAR(22) BINARY NOT NULL, }
. q{`revisionDate` BIGINT NOT NULL, };
for my $column ( keys %{ $installDef->{properties} } ) {
my $control = WebGUI::Form::DynamicField->new( $session, %{ $installDef->{properties}->{$column} } );

View file

@ -209,7 +209,7 @@ sub crud_createTable {
my $tableName = $class->crud_getTableName($session);
$class->crud_dropTable($session);
$db->write('create table '.$dbh->quote_identifier($tableName).' (
'.$dbh->quote_identifier($class->crud_getTableKey($session)).' varchar(22) binary not null primary key,
'.$dbh->quote_identifier($class->crud_getTableKey($session)).' CHAR(22) binary not null primary key,
sequenceNumber int not null default 1,
dateCreated datetime,
lastUpdated datetime

View file

@ -102,12 +102,12 @@ sub definition {
=head2 getDatabaseFieldType ( )
Returns "VARCHAR(22) BINARY".
Returns "CHAR(22) BINARY".
=cut
sub getDatabaseFieldType {
return "VARCHAR(22) BINARY";
return "CHAR(22) BINARY";
}
#-------------------------------------------------------------------

View file

@ -40,12 +40,12 @@ The following methods are specifically available from this class. Check the supe
=head2 getDatabaseFieldType ( )
Returns "VARCHAR(7)".
Returns "CHAR(7)".
=cut
sub getDatabaseFieldType {
return "VARCHAR(7)";
return "CHAR(7)";
}
#-------------------------------------------------------------------

View file

@ -358,12 +358,12 @@ sub get {
=head2 getDatabaseFieldType ( )
A class method that tells you what database field type this form field should be stored in. Defaults to "VARCHAR(255)".
A class method that tells you what database field type this form field should be stored in. Defaults to "CHAR(255)".
=cut
sub getDatabaseFieldType {
return "VARCHAR(255)";
return "CHAR(255)";
}

View file

@ -92,12 +92,12 @@ sub definition {
=head2 getDatabaseFieldType ( )
Returns "VARCHAR(22) BINARY".
Returns "CHAR(22) BINARY".
=cut
sub getDatabaseFieldType {
return "VARCHAR(22) BINARY";
return "CHAR(22) BINARY";
}
#-------------------------------------------------------------------

View file

@ -96,12 +96,12 @@ sub definition {
=head2 getDatabaseFieldType ( )
Returns "VARCHAR(16)".
Returns "CHAR(16)".
=cut
sub getDatabaseFieldType {
return "VARCHAR(16)";
return "CHAR(16)";
}
#-------------------------------------------------------------------

View file

@ -71,12 +71,12 @@ sub definition {
=head2 getDatabaseFieldType ( )
Returns "VARCHAR(255)".
Returns "CHAR(255)".
=cut
sub getDatabaseFieldType {
return "VARCHAR(255)";
return "CHAR(255)";
}
#-------------------------------------------------------------------

View file

@ -86,12 +86,12 @@ sub definition {
=head2 getDatabaseFieldType ( )
Returns "VARCHAR(22) BINARY".
Returns "CHAR(22) BINARY".
=cut
sub getDatabaseFieldType {
return "VARCHAR(22) BINARY";
return "CHAR(22) BINARY";
}
#-------------------------------------------------------------------

View file

@ -88,12 +88,12 @@ sub definition {
=head2 getDatabaseFieldType ( )
Returns "VARCHAR(22) BINARY".
Returns "CHAR(22) BINARY".
=cut
sub getDatabaseFieldType {
return "VARCHAR(22) BINARY";
return "CHAR(22) BINARY";
}
#-------------------------------------------------------------------

View file

@ -53,4 +53,4 @@ sub process {
return $user->profileField($field);
}
1;
1;

View file

@ -154,4 +154,4 @@ sub www_viewInboxMessage {
return $instance->displayContent($instance->callMethod("viewMessage"));
}
1;
1;

View file

@ -37,7 +37,7 @@ WebGUI::Crud->crud_createTable($session);
my $sth = $session->db->read("describe unnamed_crud_table");
my ($col, $type) = $sth->array();
is($col, 'id', "structure: id name");
is($type, 'varchar(22)', "structure: id type");
is($type, 'char(22)', "structure: id type");
($col, $type) = $sth->array();
is($col, 'sequenceNumber', "structure: sequenceNumber name");
is($type, 'int(11)', "structure: sequenceNumber type");

View file

@ -384,7 +384,7 @@ cmp_bag($everyUsers, $everyoneGroup->getUsers(), 'addUsers will not add a user t
##Database based user membership in groups
$session->db->dbh->do('DROP TABLE IF EXISTS myUserTable');
$session->db->dbh->do(q!CREATE TABLE myUserTable (userId varchar(22) binary NOT NULL default '', PRIMARY KEY(userId)) TYPE=InnoDB!);
$session->db->dbh->do(q!CREATE TABLE myUserTable (userId CHAR(22) binary NOT NULL default '', PRIMARY KEY(userId)) TYPE=InnoDB!);
my $sth = $session->db->prepare('INSERT INTO myUserTable VALUES(?)');
foreach my $mob (@mob) {

View file

@ -56,7 +56,7 @@ is($output, 'Group Not a Group was not found', 'Non-existant group returns an er
##Create a small database
$session->db->dbh->do('DROP TABLE IF EXISTS myUserTable');
$session->db->dbh->do(q!CREATE TABLE myUserTable (userId varchar(22) binary NOT NULL default '', PRIMARY KEY(userId)) TYPE=InnoDB!);
$session->db->dbh->do(q!CREATE TABLE myUserTable (userId CHAR(22) binary NOT NULL default '', PRIMARY KEY(userId)) TYPE=InnoDB!);
##Create a bunch of users and put them in the table.

View file

@ -164,7 +164,7 @@ SKIP: {
skip("No InnoDB tables in this MySQL. Skipping all transaction related tests.",7) if (lc $mysqlVariables{have_innodb} ne 'yes');
$session->db->dbh->do('DROP TABLE IF EXISTS testTable');
$session->db->dbh->do('CREATE TABLE testTable (myIndex int(8) NOT NULL default 0, message varchar(64), PRIMARY KEY(myIndex)) TYPE=InnoDB');
$session->db->dbh->do('CREATE TABLE testTable (myIndex int(8) NOT NULL default 0, message CHAR(64), PRIMARY KEY(myIndex)) TYPE=InnoDB');
my $dbh2 = WebGUI::SQL->connect($session,$session->config->get("dsn"), $session->config->get("dbuser"), $session->config->get("dbpass"));
my ($sth, $sth2, $rc);
@ -215,7 +215,7 @@ SKIP: {
}
$session->db->dbh->do('CREATE TABLE testTable (myIndex int(8) NOT NULL default 0, message varchar(64), myKey varchar(32), PRIMARY KEY(myIndex))');
$session->db->dbh->do('CREATE TABLE testTable (myIndex int(8) NOT NULL default 0, message CHAR(64), myKey varchar(32), PRIMARY KEY(myIndex))');
my @tableData = (
[ 0, 'zero', 'A' ],