Skip to content

Commit

Permalink
Merge pull request pharo-rdbms#16 from tblanchard/15-Default-port-to-…
Browse files Browse the repository at this point in the history
…3306-standard-mysql-port-and-add-convenience-methods-for-CSVJSON

Does not add NeoCSV as a dependency but provides asJSON and some convenience methods that make it easy to add asCSV later.  Also defaults the port to 3306 and changes some group names to be capitalized to match other packages.  Onwards!
  • Loading branch information
tblanchard authored Jul 14, 2021
2 parents 0a8d28b + 814918a commit 5d3cacd
Show file tree
Hide file tree
Showing 46 changed files with 76 additions and 15 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build
on: [push,pull_request]

jobs:
build:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -20,15 +20,15 @@ jobs:
- name: Set up Smalltalk CI
uses: hpi-swa/setup-smalltalkCI@v1
with:
smalltalk-version: ${{ matrix.smalltalk }}
smalltalk-image: ${{ matrix.smalltalk }}
- name: Load Image and Run Tests
run: smalltalkci -s ${{ matrix.smalltalk }}
timeout-minutes: 15
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RDBMS: ${{ matrix.rdbms }}
- run: echo "::set-env name=SCI_COVERAGE_FILE_LOCATION::${HOME}/.smalltalkCI/_builds/coveralls_results.json"
timeout-minutes: 15
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1.0.6
uses: codecov/codecov-action@v1
with:
name: ${{matrix.os}}-${{matrix.smalltalk}}-${{ matrix.rdbms }}
token: ${{ secrets.CODECOV_TOKEN }}
file: ${{ env.SCI_COVERAGE_FILE_LOCATION }}
6 changes: 2 additions & 4 deletions .smalltalk.ston
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ SmalltalkCISpec {
}
],
#testing : {
#coverage : {
#coverage : {
#packages : [ 'MySQL*' ],
#service: #codecov,
#auto_upload: false
}
#format: #lcov
}
}
}
4 changes: 2 additions & 2 deletions BaselineOfMySQL/BaselineOfMySQL.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ BaselineOfMySQL >> baseline: spec [
group: 'CI' with: #('Tests' 'Glorp-Tests');
group: 'Development' with: #('Tests' 'glorp');
group: 'default' with: #('all');
group: 'all' with: #('core' 'Tests')
group: 'all' with: #('Core' 'Tests')
]
]

Expand Down Expand Up @@ -53,7 +53,7 @@ BaselineOfMySQL >> setUpPackages: spec [

spec
package: 'MySQL-Core' with: [ spec requires: #('NeoJSON-Core' 'ZTimestamp') ];
group: 'core' with: 'MySQL-Core'.
group: 'Core' with: 'MySQL-Core'.

spec
package: 'MySQL-Glorp' with: [ spec requires: #('MySQL-Core' 'Glorp-Deployment') ];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,5 +293,5 @@ MySQLStatementReadTest >> testReadTimeTypesNull [
self assert: (resp rows third atIndex: 2) isNil.
self assert: (resp rows third atIndex: 3) isNil.
self assert: (resp rows third atIndex: 4) isNil.
self assert: (resp rows third atIndex: 5) isNotNil ]
self assert: (resp rows fourth atIndex: 5) isNotNil ]
]
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions MySQL-Core/MySQLBinaryRowData.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ MySQLBinaryRowData >> columnDescriptors: fieldList [

]

{ #category : #enumerating }
MySQLBinaryRowData >> do: aBlock [
^columnValues do: aBlock
]

{ #category : #testing }
MySQLBinaryRowData >> isColumnNullAt: index [
| byteIndex bitsToShift bitMask |
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ MySQLDriverSpec >> password: userPassword [

{ #category : #accessing }
MySQLDriverSpec >> port [
^ port
^ port ifNil: [ port := 3306 ]
]

{ #category : #accessing }
Expand Down
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions MySQL-Core/MysqlField.class.st → MySQL-Core/MySQLField.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,17 @@ MySQLField >> parse [

]

{ #category : #accessing }
MySQLField >> printOn: aStream [
super printOn: aStream.
aStream
nextPutAll: ' (';
nextPutAll: table;
nextPut: $.;
nextPutAll: self name;
nextPutAll: ')'
]

{ #category : #accessing }
MySQLField >> table [
^ table
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 10 additions & 0 deletions MySQL-Core/MySQLNetworkSession.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,16 @@ MySQLNetworkSession >> stream: aStream [

]

{ #category : #accessing }
MySQLNetworkSession >> timeout [
^theStream timeout
]

{ #category : #accessing }
MySQLNetworkSession >> timeout: seconds [
theStream timeout: seconds
]

{ #category : #accessing }
MySQLNetworkSession >> toHost: host andPort: port [
| aStream |
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,25 @@ Class {
#category : #'MySQL-Core-Packet-RowData'
}

{ #category : #accessing }
MySQLQueryRowData >> asDictionary [
| pairs |
pairs := OrderedCollection new: fields size.
fields doWithIndex: [ :f :i | pairs add: (f name -> (self atIndex: i)) ].
^pairs asDictionary
]

{ #category : #accessing }
MySQLQueryRowData >> at: indx [
^ self atIndex: indx
^ indx isInteger
ifTrue: [self atIndex: indx]
ifFalse: [ self atFieldNamed: indx ]
]

{ #category : #accessing }
MySQLQueryRowData >> atFieldNamed: aName [
^ self atIndex: (self indexOfFieldNamed: aName)

]

{ #category : #accessing }
Expand All @@ -27,6 +43,11 @@ MySQLQueryRowData >> columnCount: aCount [

]

{ #category : #enumerating }
MySQLQueryRowData >> do: aBlock [
^columns do: aBlock
]

{ #category : #accessing }
MySQLQueryRowData >> fields [
^ fields
Expand All @@ -37,6 +58,12 @@ MySQLQueryRowData >> fields: anObject [
fields := anObject
]

{ #category : #accessing }
MySQLQueryRowData >> indexOfFieldNamed: aName [
self fields doWithIndex: [ :f :idx | f name = aName ifTrue: [ ^idx ] ].
^0
]

{ #category : #accessing }
MySQLQueryRowData >> last [
^ columns atIndex: (columns size)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ Class {
#category : #'MySQL-Core-Packet-Results'
}

{ #category : #converting }
MySQLResultSet >> asJSON [
^NeoJSONWriter toString: (self rows collect: [ :ea | ea asDictionary ])
]

{ #category : #testing }
MySQLResultSet >> atEnd [

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions MySQL-Glorp/MySQLDatabaseDriver.class.st
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
"
I am a Glorp database driver implementation for using MySQL with Glorp.
The Glorp database driver provides a unifying common interface for interacting with SQL databases.
"
Class {
#name : #MySQLDatabaseDriver,
#superclass : #DatabaseDriver,
Expand Down
Empty file modified scripts/setup-RDBMS.sh
100644 → 100755
Empty file.

0 comments on commit 5d3cacd

Please sign in to comment.