}
else {
$body .= "\"$hdr\" INT UNIQUE PRIMARY KEY GENERATED ALWAYS AS IDENTITY,\n";
- $where_id = "$hdr = ?";
+ $where_id = "\"$hdr\" = ?";
}
$spec[$i] = $CNF_DATA_TYPES{INT};
$primary = $hdr;
$primary = $hdr;
$primary_set = 1;
$idType = 'CNF_ID'; #UPDATE "main"."TASKS" SET "Completed"=? WHERE "_rowid_"='10'
- $where_id = "\"$hdr\" = ?";
+ $where_id = "\"$hdr\" = ?";
}elsif($hdr =~ s/$ID/""/ei){
#This is ID prefix to some other data id stored in this table, usually one to one/many relationship.
$body .= "\"$hdr\" INTEGER CHECK (\"$hdr\">0),\n";
- $spec[$i] = $CNF_DATA_TYPES{INT};
- $primary = $idType = 'ID'
+ $spec[$i] = $CNF_DATA_TYPES{INT};
}elsif($hdr =~ s/$INDEX/""/ei){
# This is where CNF instructs to make a indexed lookup type field,
# for inside database fast selecting, hashing, caching and other queries.
$body .= "\"$hdr\" NOT NULL,\n";
$spec[$i] = $CNF_DATA_TYPES{NUM};
}elsif($hdr =~ s/$BOOL/''/ei){
- if($isPostgreSQL){
- $body .= "\"$hdr\" BOOLEAN NOT NULL CHECK (\"$hdr\" IN (0, 1)),\n";
- }else{
- $body .= "\"$hdr\" BOOLEAN NOT NULL,\n";
+ # if($isPostgreSQL){
+ # $body .= "\"$hdr\" BOOLEAN NOT NULL CHECK (\"$hdr\" IN (0, 1)),\n";
+ # }else{
+ $body .= "\"$hdr\" BOOLEAN NOT NULL,\n";
- }
+ # }
$spec[$i] = $CNF_DATA_TYPES{BOOL};
}elsif($hdr =~ s/$TEXT/""/ei){
$body .= "\"$hdr\" TEXT NOT NULL CHECK (length(\"$hdr\")<=$SQL_CNF_VAR_LENGTH),\n";
my $ctpys = $hdr[$MHDR{COL_TYPES}];
my $tbody = ${$hdr[$MHDR{T_BODY} ]};
my $tmeta = $hdr[$MHDR{TABLE_META}];
- $idtyp = "AUTOINCREMENT" if $tbl_id_spec eq 'ID';
+ #Activate autonumbering to be done HERE, based on column name or type.
+ if($tbl_id_spec eq 'ID' && $idtyp ne 'CNF_ID'){
+ $idtyp = "AUTOINCREMENT"; $isAutonumber = 1
+ }elsif($idtyp eq 'CNF_ID'){
+ $isAutonumber = 1
+ }
$self->SQL()->createTable( $e, $tbody, $idtyp, $tmeta )
}
my @rel = CNFMeta::_deRefArray($hdr[$MHDR{RELATIONS}]);
my %log = $self -> property('%LOG');
my $time = CNFDateTime -> now(exists($self->{TZ})?{TZ=>$self->{TZ}}:undef) -> toTimestamp();
- $message = "$type $message" if $isWarning;
+ $message = "$type $message" if $isWarning; $message = "" if not $message;
if($message =~ /^ERROR/ || ($isWarning && $self->{ENABLE_WARNINGS})){
$message =~ s/(\s+line\s)(\d+)\.*\s+/:$2\n/gm;
warn $time . " " .$message;