Skip to content

Commit

Permalink
Boxlang Certification
Browse files Browse the repository at this point in the history
Some variable names have changed to support the certification.
You shouldn't see any problems unless you have custom QueryBuilders that
are extending from the built-in models.

BREAKING CHANGE: Internal variable name changes
  • Loading branch information
elpete authored Sep 27, 2024
1 parent 57270ad commit bebc83d
Show file tree
Hide file tree
Showing 29 changed files with 464 additions and 202 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
cfengine: ["lucee@5", "lucee@be", "adobe@2018", "adobe@2021", "adobe@be"]
cfengine: ["lucee@5", "lucee@be", "adobe@2021", "adobe@2023", "adobe@be", "boxlang@be"]
javaVersion: ["openjdk8", "openjdk11"]
fullNull: ["true", "false"]
steps:
Expand All @@ -27,12 +27,22 @@ jobs:
- name: Set Up CommandBox
uses: elpete/[email protected]

- name: Install CommandBox-BoxLang
run: box install commandbox-boxlang

- name: Install dependencies
run: |
box install
- name: Start server
run: box server start cfengine=${{ matrix.cfengine }} javaVersion=${{ matrix.javaVersion }} --noSaveSettings
run: |
if [[ "${{ matrix.cfengine }}" == *"boxlang"* ]] ; then
box server start cfengine=${{ matrix.cfengine }} javaVersion=openjdk21_jdk
box run-script bx-modules:install
box server restart
else
box server start cfengine=${{ matrix.cfengine }} javaVersion=${{ matrix.javaVersion }}
fi
- name: Run TestBox Tests
env:
Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
strategy:
fail-fast: false
matrix:
cfengine: ["lucee@5", "adobe@2018", "adobe@2021"]
cfengine: ["lucee@5", "adobe@2021", "adobe@2023", "boxlang@be"]
fullNull: ["true", "false"]
steps:
- name: Checkout Repository
Expand All @@ -34,12 +34,22 @@ jobs:
- name: Set Up CommandBox
uses: elpete/[email protected]

- name: Install CommandBox-BoxLang
run: box install commandbox-boxlang

- name: Install dependencies
run: |
box install
- name: Start server
run: box server start cfengine=${{ matrix.cfengine }} --noSaveSettings
run: |
if [[ "${{ matrix.cfengine }}" == *"boxlang"* ]] ; then
box server start cfengine=${{ matrix.cfengine }} javaVersion=openjdk21_jdk
box run-script bx-modules:install
box server restart
else
box server start cfengine=${{ matrix.cfengine }}
fi
- name: Run TestBox Tests
env:
Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
fail-fast: false
matrix:
cfengine: ["lucee@5", "adobe@2018", "adobe@2021"]
cfengine: ["lucee@5", "adobe@2021", "adobe@2023", "boxlang@be"]
fullNull: ["true", "false"]
steps:
- name: Checkout Repository
Expand All @@ -28,12 +28,22 @@ jobs:
- name: Set Up CommandBox
uses: elpete/[email protected]

- name: Install CommandBox-BoxLang
run: box install commandbox-boxlang

- name: Install dependencies
run: |
box install
- name: Start server
run: box server start cfengine=${{ matrix.cfengine }} --noSaveSettings
run: |
if [[ "${{ matrix.cfengine }}" == *"boxlang"* ]] ; then
box server start cfengine=${{ matrix.cfengine }} javaVersion=openjdk21_jdk
box run-script bx-modules:install
box server restart
else
box server start cfengine=${{ matrix.cfengine }}
fi
- name: Run TestBox Tests
env:
Expand Down
14 changes: 12 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
cfengine: ["lucee@5", "adobe@2018", "adobe@2021"]
cfengine: ["lucee@5", "adobe@2021", "adobe@2023", "boxlang@be"]
fullNull: ["true", "false"]
steps:
- name: Checkout Repository
Expand All @@ -29,12 +29,22 @@ jobs:
- name: Set Up CommandBox
uses: elpete/[email protected]

- name: Install CommandBox-BoxLang
run: box install commandbox-boxlang

- name: Install dependencies
run: |
box install
- name: Start server
run: box server start cfengine=${{ matrix.cfengine }} --noSaveSettings
run: |
if [[ "${{ matrix.cfengine }}" == *"boxlang"* ]] ; then
box server start cfengine=${{ matrix.cfengine }} javaVersion=openjdk21_jdk
box run-script bx-modules:install
box server restart
else
box server start cfengine=${{ matrix.cfengine }}
fi
- name: Run TestBox Tests
env:
Expand Down
5 changes: 3 additions & 2 deletions box.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
"generateAPIDocs":"touch .tmp && rm .tmp --recurse --force && docbox generate mapping=qb excludes=test|ModuleConfig strategy-outputDir=.tmp/apidocs strategy-projectTitle=qb",
"commitAPIDocs":"run-script generateAPIDocs && !git add docs/apidocs/* && !git commit -m 'Updated API Docs'",
"format":"cfformat run models/**/*.cfc,tests/resources/**/*.cfc,tests/specs/**/*.cfc --overwrite",
"format:check":"cfformat check models/**/*.cfc,tests/resources/**/*.cfc,tests/specs/**/*.cfc"
"format:check":"cfformat check models/**/*.cfc,tests/resources/**/*.cfc,tests/specs/**/*.cfc",
"bx-modules:install":"install bx-compat-cfml@be,bx-esapi"
},
"repository":{
"type":"git",
Expand All @@ -36,7 +37,7 @@
"cbpaginator":"^2.4.0"
},
"devDependencies":{
"testbox":"be"
"testbox":"^6.0.0"
},
"installPaths":{
"testbox":"testbox/",
Expand Down
30 changes: 15 additions & 15 deletions models/Grammars/BaseGrammar.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ component displayname="Grammar" accessors="true" singleton {
"commonTables",
"aggregate",
"columns",
"from",
"tableName",
"joins",
"wheres",
"groups",
Expand Down Expand Up @@ -267,8 +267,8 @@ component displayname="Grammar" accessors="true" singleton {
*
* @return string
*/
private string function compileFrom( required QueryBuilder query, required any from ) {
var fullTable = arguments.from;
private string function compileTableName( required QueryBuilder query, required any tableName ) {
var fullTable = arguments.tableName;
if ( query.getAlias() != "" ) {
fullTable &= " #query.getAlias()#";
}
Expand Down Expand Up @@ -817,7 +817,7 @@ component displayname="Grammar" accessors="true" singleton {
.toList( ", " ) & ")";
} )
.toList( ", " );
return trim( "INSERT INTO #wrapTable( query.getFrom() )# (#columnsString#) VALUES #placeholderString#" );
return trim( "INSERT INTO #wrapTable( query.getTableName() )# (#columnsString#) VALUES #placeholderString#" );
}

/**
Expand Down Expand Up @@ -867,7 +867,7 @@ component displayname="Grammar" accessors="true" singleton {
.toList( ", " );

return trim(
compileCommonTables( query, query.getCommonTables() ) & " INSERT INTO #wrapTable( arguments.query.getFrom() )# (#columnsString#) #compileSelect( arguments.source )#"
compileCommonTables( query, query.getCommonTables() ) & " INSERT INTO #wrapTable( arguments.query.getTableName() )# (#columnsString#) #compileSelect( arguments.source )#"
);
}

Expand Down Expand Up @@ -901,7 +901,7 @@ component displayname="Grammar" accessors="true" singleton {
} )
.toList( ", " );

var updateStatement = "UPDATE #wrapTable( query.getFrom() )#";
var updateStatement = "UPDATE #wrapTable( query.getTableName() )#";

if ( !arguments.query.getJoins().isEmpty() ) {
updateStatement &= " " & compileJoins( arguments.query, arguments.query.getJoins() );
Expand All @@ -923,7 +923,7 @@ component displayname="Grammar" accessors="true" singleton {
if ( !arguments.query.getReturning().isEmpty() ) {
throw( type = "UnsupportedOperation", message = "This grammar does not support a RETURNING clause" );
}
return trim( "DELETE FROM #wrapTable( query.getFrom() )# #compileWheres( query, query.getWheres() )#" );
return trim( "DELETE FROM #wrapTable( query.getTableName() )# #compileWheres( query, query.getWheres() )#" );
}

/**
Expand Down Expand Up @@ -1226,15 +1226,15 @@ component displayname="Grammar" accessors="true" singleton {
}

function generateNullConstraint( column ) {
return column.getNullable() ? "" : "NOT NULL";
return column.getIsNullable() ? "" : "NOT NULL";
}

function generateUniqueConstraint( column, blueprint ) {
return column.getUnique() ? "UNIQUE" : "";
return column.getIsUnique() ? "UNIQUE" : "";
}

function modifyUnsigned( column ) {
return column.getUnsigned() ? "UNSIGNED" : "";
return column.getIsUnsigned() ? "UNSIGNED" : "";
}

function generateComputed( column ) {
Expand All @@ -1252,14 +1252,14 @@ component displayname="Grammar" accessors="true" singleton {
}

function generateDefault( column ) {
if ( column.getDefault() == "" ) {
if ( column.getDefaultValue() == "" ) {
return "";
}
return "DEFAULT #wrapDefaultType( column )#";
}

function generateComment( column ) {
return column.getComment() != "" ? "COMMENT '#column.getComment()#'" : "";
return column.getCommentValue() != "" ? "COMMENT '#column.getCommentValue()#'" : "";
}

function compileAddComment( blueprint, commandParameters ) {
Expand All @@ -1268,7 +1268,7 @@ component displayname="Grammar" accessors="true" singleton {
"COMMENT ON COLUMN",
wrapColumn( commandParameters.table & "." & commandParameters.column.getName() ),
"IS",
"'" & commandParameters.column.getComment() & "'"
"'" & commandParameters.column.getCommentValue() & "'"
],
" "
);
Expand Down Expand Up @@ -1743,8 +1743,8 @@ component displayname="Grammar" accessors="true" singleton {
"CONSTRAINT #wrapValue( index.getName() )#",
"FOREIGN KEY (#keys#)",
"REFERENCES #wrapTable( index.getTable() )# (#references#)",
"ON UPDATE #uCase( index.getOnUpdate() )#",
"ON DELETE #uCase( index.getOnDelete() )#"
"ON UPDATE #uCase( index.getOnUpdateAction() )#",
"ON DELETE #uCase( index.getOnDeleteAction() )#"
],
" "
);
Expand Down
12 changes: 6 additions & 6 deletions models/Grammars/MySQLGrammar.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ component extends="qb.models.Grammars.BaseGrammar" singleton {

var cteClause = query.getCommonTables().isEmpty() ? "" : " #compileCommonTables( query, query.getCommonTables() )#";

return "INSERT INTO #wrapTable( arguments.query.getFrom() )# (#columnsString#)#cteClause# #compileSelect( arguments.source )#";
return "INSERT INTO #wrapTable( arguments.query.getTableName() )# (#columnsString#)#cteClause# #compileSelect( arguments.source )#";
}

public string function compileUpsert(
Expand Down Expand Up @@ -199,10 +199,10 @@ component extends="qb.models.Grammars.BaseGrammar" singleton {

function generateDefault( column ) {
if (
column.getDefault() == "" &&
column.getDefaultValue() == "" &&
column.getType().findNoCase( "TIMESTAMP" ) > 0
) {
if ( column.getNullable() ) {
if ( column.getIsNullable() ) {
return "NULL DEFAULT NULL";
} else {
column.withCurrent();
Expand All @@ -214,12 +214,12 @@ component extends="qb.models.Grammars.BaseGrammar" singleton {
function wrapDefaultType( column ) {
switch ( column.getType() ) {
case "boolean":
return column.getDefault() ? 1 : 0;
return column.getDefaultValue() ? 1 : 0;
case "char":
case "string":
return "'#column.getDefault()#'";
return "'#column.getDefaultValue()#'";
default:
return column.getDefault();
return column.getDefaultValue();
}
}

Expand Down
Loading

0 comments on commit bebc83d

Please sign in to comment.