├── .gitignore ├── README.md ├── doc ├── NOTICE.md ├── PGClient Help │ ├── Databases.md │ ├── Introduction.md │ └── Queries.md └── Version.plist ├── etc ├── README.md ├── build-frameworks.sh ├── build-iosapps.sh ├── build-macapps.sh ├── lipo.sh ├── make-headerdoc.sh ├── make-libpq.sh ├── make-libpq.sh.orig ├── make-openssl.sh ├── make-openssl.sh.orig ├── make-postgresql.sh ├── reversion-plist.sh ├── reversion.sh └── test-frameworks.sh ├── old ├── PGClient │ ├── LocalConnectionWindow.xib │ ├── LocalConnectionWindowController.h │ ├── LocalConnectionWindowController.m │ ├── MainMenu.xib │ ├── PGClient.plist │ ├── PGClientApplication.h │ ├── PGClientApplication.m │ ├── PGConnectionController.h │ ├── PGConnectionController.m │ ├── PGSidebarDataSource.h │ ├── PGSidebarDataSource.m │ ├── PGSidebarNode.h │ ├── PGSidebarNode.m │ ├── PGSidebarViewController.h │ ├── PGSidebarViewController.m │ ├── PGTabViewController.h │ ├── PGTabViewController.m │ ├── RemoteConnectionWindow.xib │ ├── RemoteConnectionWindowController.h │ └── RemoteConnectionWindowController.m ├── PGConnection-old.h ├── PGConnection-old.m ├── PGConsoleView │ ├── PGConsoleView.h │ ├── PGConsoleView.m │ ├── PGConsoleView.xib │ ├── PGConsoleViewImpl.h │ ├── PGConsoleViewImpl.m │ ├── PGGutterView.h │ └── PGGutterView.m ├── PGServer │ ├── ConfigurationPrefs.h │ ├── ConfigurationPrefs.m │ ├── ConnectionPrefs.h │ ├── ConnectionPrefs.m │ ├── Controller.h │ ├── Controller.m │ ├── ControllerDelegate.h │ ├── PGServer-Info.plist │ └── PGServer.xib ├── PostgresClientKit │ ├── FLXGeometry.h │ ├── FLXGeometry.m │ ├── FLXMacAddr.h │ ├── FLXMacAddr.m │ ├── FLXPostgresArray.h │ ├── FLXPostgresArray.m │ ├── FLXPostgresConnection+Utils.h │ ├── FLXPostgresConnection+Utils.m │ ├── FLXPostgresConnection.h │ ├── FLXPostgresConnection.m │ ├── FLXPostgresException.h │ ├── FLXPostgresException.m │ ├── FLXPostgresResult.h │ ├── FLXPostgresResult.m │ ├── FLXPostgresStatement.h │ ├── FLXPostgresStatement.m │ ├── FLXPostgresTypeNSNumber.h │ ├── FLXPostgresTypeNSNumber.m │ ├── FLXPostgresTypeNSString.h │ ├── FLXPostgresTypeNSString.m │ ├── FLXPostgresTypes+Array.h │ ├── FLXPostgresTypes+Array.m │ ├── FLXPostgresTypes+DateTime.h │ ├── FLXPostgresTypes+DateTime.m │ ├── FLXPostgresTypes+Geometry.h │ ├── FLXPostgresTypes+Geometry.m │ ├── FLXPostgresTypes+NSData.h │ ├── FLXPostgresTypes+NSData.m │ ├── FLXPostgresTypes+NSNumber.h │ ├── FLXPostgresTypes+NSNumber.m │ ├── FLXPostgresTypes+NetAddr.h │ ├── FLXPostgresTypes+NetAddr.m │ ├── FLXPostgresTypes.h │ ├── FLXPostgresTypes.m │ ├── FLXTimeInterval.h │ ├── FLXTimeInterval.m │ ├── PostgresClientKit.h │ └── PostgresClientKitPrivate.h ├── PostgresDataKit │ ├── FLXPostgresConnection+DataUtils.h │ ├── FLXPostgresConnection+DataUtils.m │ ├── FLXPostgresDataCache.h │ ├── FLXPostgresDataCache.m │ ├── FLXPostgresDataObject.h │ ├── FLXPostgresDataObject.m │ ├── FLXPostgresDataObjectContext.h │ ├── FLXPostgresDataObjectContext.m │ ├── PostgresDataKit.h │ └── PostgresDataKitPrivate.h └── PostgresPrefPane │ ├── PostgresInstallerMain.m │ ├── PostgresPrefPaneBindings.h │ ├── PostgresPrefPaneBindings.m │ ├── PostgresPrefPaneController.h │ ├── PostgresPrefPaneController.m │ ├── PostgresPrefPaneShared.h │ ├── PostgresPrefPaneShared.m │ ├── PostgresServerApp.h │ ├── PostgresServerApp.m │ ├── PostgresServerKeychain.h │ ├── PostgresServerKeychain.m │ └── PostgresServerMain.m ├── postgresql-kit.xcodeproj ├── project.pbxproj └── project.xcworkspace │ └── contents.xcworkspacedata ├── resources ├── elephant-144.png ├── elephant-32.png ├── elephant-512.png ├── elephant-64.png ├── elephant-72.png ├── elephant.icns ├── gear-14x14.png ├── icons │ ├── database.tiff │ ├── halt.tiff │ ├── info.tiff │ ├── network.tiff │ ├── preferences.tiff │ ├── reload.tiff │ ├── start.tiff │ ├── stop.tiff │ ├── terminal.tiff │ └── user.tiff ├── logo_w_elephant.pdf ├── strapline-200x40.png ├── traffic │ ├── traffic-green.tiff │ ├── traffic-grey.png │ ├── traffic-orange.tiff │ └── traffic-red.tiff └── ui │ ├── Gradient.png │ └── ResizeControl.png ├── src ├── Apps │ ├── Cocoa │ │ ├── ControlsTest │ │ │ ├── AppDelegate.h │ │ │ ├── AppDelegate.m │ │ │ ├── Base.lproj │ │ │ │ └── MainMenu.xib │ │ │ ├── Images.xcassets │ │ │ │ └── AppIcon.appiconset │ │ │ │ │ └── Contents.json │ │ │ └── Info.plist │ │ ├── PGClient │ │ │ ├── Application.h │ │ │ ├── Application.m │ │ │ ├── ConsoleBuffer.h │ │ │ ├── ConsoleBuffer.m │ │ │ ├── Images.xcassets │ │ │ │ └── AppIcon.appiconset │ │ │ │ │ ├── Contents.json │ │ │ │ │ ├── elephant-32-1.png │ │ │ │ │ ├── elephant-32.png │ │ │ │ │ ├── elephant-512-1.png │ │ │ │ │ ├── elephant-512.png │ │ │ │ │ └── elephant-64.png │ │ │ ├── Info.plist │ │ │ └── MainMenu.xib │ │ ├── PGSchemaManager │ │ │ ├── MainMenu.xib │ │ │ ├── PGSchemaManager.plist │ │ │ ├── PGSchemaManagerApp.h │ │ │ ├── PGSchemaManagerApp.m │ │ │ └── tree.schema.xml │ │ ├── PGServer │ │ │ ├── AppAbout.h │ │ │ ├── AppAbout.m │ │ │ ├── AppDelegate.h │ │ │ ├── AppDelegate.m │ │ │ ├── AppPreferences.h │ │ │ ├── AppPreferences.m │ │ │ ├── ConnectionView.xib │ │ │ ├── ConnectionViewController.h │ │ │ ├── ConnectionViewController.m │ │ │ ├── ConnectionsView.xib │ │ │ ├── ConnectionsViewController.h │ │ │ ├── ConnectionsViewController.m │ │ │ ├── DatabaseView.xib │ │ │ ├── DatabaseViewController.h │ │ │ ├── DatabaseViewController.m │ │ │ ├── LogView.xib │ │ │ ├── LogViewController.h │ │ │ ├── LogViewController.m │ │ │ ├── MainWindow.xib │ │ │ ├── NSWindow+ResizeAdditions.h │ │ │ ├── NSWindow+ResizeAdditions.m │ │ │ ├── PGServer.plist │ │ │ ├── SQL.strings │ │ │ ├── UsersRolesView.xib │ │ │ ├── UsersRolesViewController.h │ │ │ ├── UsersRolesViewController.m │ │ │ ├── ViewController.h │ │ │ └── ViewController.m │ │ └── main.m │ ├── Foundation │ │ ├── PGFoundationApp.h │ │ ├── PGFoundationApp.m │ │ ├── PGFoundationClient.h │ │ ├── PGFoundationClient.m │ │ ├── PGFoundationServer.h │ │ ├── PGFoundationServer.m │ │ ├── Terminal.h │ │ └── Terminal.m │ └── iOS │ │ └── PGClient_ios │ │ ├── PGApplication.h │ │ ├── PGApplication.m │ │ ├── PGClientView.h │ │ ├── PGClientView.m │ │ ├── PGClient_ios.plist │ │ ├── main.m │ │ └── resources │ │ └── PGClientView.xib ├── Frameworks │ ├── PGClientKit │ │ ├── NSString+PGNetworkValidationAdditions.h │ │ ├── NSString+PGNetworkValidationAdditions.m │ │ ├── NSString+PrivateAdditions.h │ │ ├── NSString+PrivateAdditions.m │ │ ├── NSURL+PGAdditions.h │ │ ├── NSURL+PGAdditions.m │ │ ├── PGClientKit+Private.h │ │ ├── PGClientKit.h │ │ ├── PGClientKit_ios.plist │ │ ├── PGClientKit_mac.plist │ │ ├── PGClientParams.h │ │ ├── PGClientParams.m │ │ ├── PGConnection+Callbacks.m │ │ ├── PGConnection+Cancel.m │ │ ├── PGConnection+Connect.m │ │ ├── PGConnection+Disconnect.m │ │ ├── PGConnection+Errors.m │ │ ├── PGConnection+Execute.m │ │ ├── PGConnection+Notifications.m │ │ ├── PGConnection+Ping.m │ │ ├── PGConnection+Reset.m │ │ ├── PGConnection.h │ │ ├── PGConnection.m │ │ ├── PGConnectionPool.h │ │ ├── PGConnectionPool.m │ │ ├── PGConverters+Data2Object.m │ │ ├── PGConverters+Object2Data.m │ │ ├── PGConverters+Private.h │ │ ├── PGConverters.h │ │ ├── PGPasswordStore.h │ │ ├── PGPasswordStore.m │ │ ├── PGQuery.h │ │ ├── PGQuery.m │ │ ├── PGQueryDatabase.h │ │ ├── PGQueryDatabase.m │ │ ├── PGQueryObject.h │ │ ├── PGQueryObject.m │ │ ├── PGQueryPredicate.h │ │ ├── PGQueryPredicate.m │ │ ├── PGQueryRole.h │ │ ├── PGQueryRole.m │ │ ├── PGQuerySchema.h │ │ ├── PGQuerySchema.m │ │ ├── PGQuerySelect.h │ │ ├── PGQuerySelect.m │ │ ├── PGQuerySource.h │ │ ├── PGQuerySource.m │ │ ├── PGQueryTableView.h │ │ ├── PGQueryTableView.m │ │ ├── PGResult+TextTable.h │ │ ├── PGResult+TextTable.m │ │ ├── PGResult.h │ │ └── PGResult.m │ ├── PGControlsKit │ │ ├── PGConnectionWindow.xib │ │ ├── PGConnectionWindowController.h │ │ ├── PGConnectionWindowController.m │ │ ├── PGConnectionWindowFormatter.h │ │ ├── PGConnectionWindowFormatter.m │ │ ├── PGConsoleView.xib │ │ ├── PGConsoleViewBuffer.h │ │ ├── PGConsoleViewBuffer.m │ │ ├── PGConsoleViewController.h │ │ ├── PGConsoleViewController.m │ │ ├── PGControlsKit+Private.h │ │ ├── PGControlsKit.h │ │ ├── PGControlsKit.plist │ │ ├── PGDialog.xib │ │ ├── PGDialogBackgroundView.h │ │ ├── PGDialogBackgroundView.m │ │ ├── PGDialogCreateDatabaseView.h │ │ ├── PGDialogCreateDatabaseView.m │ │ ├── PGDialogView.h │ │ ├── PGDialogView.m │ │ ├── PGDialogWindow.h │ │ ├── PGDialogWindow.m │ │ ├── PGHelpTextView.h │ │ ├── PGHelpTextView.m │ │ ├── PGHelpWindow.xib │ │ ├── PGHelpWindowController.h │ │ ├── PGHelpWindowController.m │ │ ├── PGOutlineView.h │ │ ├── PGOutlineView.m │ │ ├── PGSourceView.xib │ │ ├── PGSourceViewConnection.h │ │ ├── PGSourceViewConnection.m │ │ ├── PGSourceViewController.h │ │ ├── PGSourceViewController.m │ │ ├── PGSourceViewHeading.h │ │ ├── PGSourceViewHeading.m │ │ ├── PGSourceViewNode.h │ │ ├── PGSourceViewNode.m │ │ ├── PGSourceViewTree.h │ │ ├── PGSourceViewTree.m │ │ ├── PGSplitView.xib │ │ ├── PGSplitViewController.h │ │ ├── PGSplitViewController.m │ │ ├── PGTabView.xib │ │ ├── PGTabViewController.h │ │ ├── PGTabViewController.m │ │ ├── PGTextFieldView.h │ │ └── PGTextFieldView.m │ ├── PGDataKit │ │ ├── PGCSVImporter.h │ │ ├── PGCSVImporter.m │ │ ├── PGDataKit.h │ │ ├── PGDataKit_mac.plist │ │ ├── PGTableModel.h │ │ └── PGTableModel.m │ ├── PGSchemaKit │ │ ├── PGSchemaKit+Private.h │ │ ├── PGSchemaKit.h │ │ ├── PGSchemaKit.plist │ │ ├── PGSchemaKitSQL.strings │ │ ├── PGSchemaManager.h │ │ ├── PGSchemaManager.m │ │ ├── PGSchemaProduct.h │ │ ├── PGSchemaProduct.m │ │ ├── PGSchemaProductNV.h │ │ ├── PGSchemaProductNV.m │ │ ├── PGSchemaProductOp.h │ │ ├── PGSchemaProductOp.m │ │ ├── PGSchemaProductOpTable.h │ │ ├── PGSchemaProductOpTable.m │ │ ├── pgschema.base.schema.xml │ │ └── pgschema.dtd │ └── PGServerKit │ │ ├── PGServer+Private.h │ │ ├── PGServer.h │ │ ├── PGServer.m │ │ ├── PGServerKit.h │ │ └── PGServerKit.plist └── UnitTests │ ├── PGClientKit_unittests │ ├── Info.plist │ ├── NSString_PGNetworkValidationAdditions_tests.m │ ├── NSURL_PGAdditions_tests.m │ ├── PGClientKit_tests.m │ ├── PGConnection_tests.m │ ├── PGQuery_tests.m │ └── type_tests.m │ ├── PGControlsKit_testcases │ ├── Info.plist │ └── PGControlsKit_testcases.m │ ├── PGFoundationServer.h │ ├── PGFoundationServer.m │ ├── PGServerKit_testcases │ ├── Info.plist │ └── PGServerKit_testcases.m │ ├── PGUnitTester.h │ └── PGUnitTester.m └── tar ├── CHCSVParser-2.1.0 ├── CHCSVParser.podspec ├── CHCSVParser.xcodeproj │ └── project.pbxproj ├── CHCSVParser │ ├── CHCSVParser │ │ ├── CHCSVParser.h │ │ └── CHCSVParser.m │ └── main.m ├── LICENSE.txt ├── README.markdown └── Unit Tests │ ├── Unit Tests-Info.plist │ ├── UnitTestContent.h │ ├── UnitTests.h │ └── UnitTests.m ├── GBCli-1.1 ├── GBCli.podspec ├── GBCli.xcodeproj │ └── project.pbxproj ├── GBCli │ ├── GBCli-Prefix.pch │ ├── GBSettings+Application.h │ ├── GBSettings+Application.m │ ├── main.m │ └── src │ │ ├── GBCli.h │ │ ├── GBCommandLineParser.h │ │ ├── GBCommandLineParser.m │ │ ├── GBOptionsHelper.h │ │ ├── GBOptionsHelper.m │ │ ├── GBPrint.h │ │ ├── GBPrint.m │ │ ├── GBSettings.h │ │ └── GBSettings.m ├── LICENSE └── Readme.markdown ├── MMMarkdown-0.4.1 ├── LICENSE.md ├── README.md ├── RELEASE_NOTES.md └── Source │ ├── MMDocument.h │ ├── MMDocument.m │ ├── MMDocument_Private.h │ ├── MMElement.h │ ├── MMElement.m │ ├── MMGenerator.h │ ├── MMGenerator.m │ ├── MMHTMLParser.h │ ├── MMHTMLParser.m │ ├── MMMarkdown.h │ ├── MMMarkdown.m │ ├── MMParser.h │ ├── MMParser.m │ ├── MMScanner.h │ ├── MMScanner.m │ ├── MMSpanParser.h │ └── MMSpanParser.m ├── openssl-1.0.1j.tar.gz ├── postgresql-9.4.0.tar.gz └── sskeychain-1.2.0 ├── LICENSE ├── Readme.markdown └── SSKeychain ├── SSKeychain.h ├── SSKeychain.m ├── SSKeychainQuery.h ├── SSKeychainQuery.m └── en.lproj └── SSKeychain.strings /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | ##### 3 | # OS X temporary files that should never be committed 4 | 5 | .DS_Store 6 | *.swp 7 | *.lock 8 | profile 9 | *~.nib 10 | *.pbxuser 11 | *.mode1v3 12 | *.mode2v3 13 | *.perspectivev3 14 | *~ 15 | # NB: also, whitelist the default ones, some projects need to use these 16 | !default.pbxuser 17 | !default.mode1v3 18 | !default.mode2v3 19 | !default.perspectivev3 20 | !xcshareddata 21 | !xcschemes 22 | project.xcworkspace/ 23 | xcuserdata/ 24 | 25 | # build subfolder 26 | build 27 | -------------------------------------------------------------------------------- /doc/PGClient Help/Databases.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Databases 4 | 5 | Blah blah databases connectioning to databases and so forth 6 | -------------------------------------------------------------------------------- /doc/PGClient Help/Introduction.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # How to use PGClient 4 | 5 | This framework is used to start, stop and restart a PostgresSQL server programatically, as a background process to the main executing process. The case for doing this is fairly limited, since you would ideally run your database server separately from any user-process. However, you may wish to 6 | have a feature-rich data storage engine in your application (you could also use CoreData or SQLite, of course). You should check out [PGServer](pgserver.md) or 7 | [PGFoundationServer](pgfoundationserver.md) example source code to see how you can use this framework in your own applications. 8 | 9 | * [Adding and Removing Databases](Databases.md) 10 | * [Running Queries](Queries.md) 11 | -------------------------------------------------------------------------------- /doc/PGClient Help/Queries.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Queries 4 | 5 | Running queries and so forth 6 | -------------------------------------------------------------------------------- /doc/Version.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BRANCH 6 | dev 7 | CF_BUNDLE_VERSION 8 | 0.1009.0 9 | RELEASE_COUNTER 10 | 0 11 | RELEASE_HASH 12 | 13 | RELEASE_TYPE 14 | alpha 15 | RELEASE_VERSION 16 | 1009 17 | TAG 18 | alpha-009 19 | 20 | 21 | -------------------------------------------------------------------------------- /etc/README.md: -------------------------------------------------------------------------------- 1 | 2 | There are a few scripts in this folder for building and testing. 3 | 4 | * `build-frameworks.sh` will build all iOS and Mac frameworks. 5 | This will build for Release, not Debug. 6 | * `test-frameworks.sh` will run the unit tests for the frameworks. This will 7 | build for Debug, not Release. 8 | * `build-macapps.sh` will build the Mac OSX applications for Release. 9 | * `build-iosapps.sh` will build the iOS applications for Release. 10 | 11 | Any of these commands will return the message `** BUILD FAILED **` or 12 | `** BUILD SUCCEEDED **` on completion. For those which failed, please file 13 | issues on GitHub with the text of the build log. 14 | 15 | The other scripts in this folder are used as part of the build process. 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /etc/build-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Build all frameworks in Release configuration 3 | # 4 | # Syntax: 5 | # build-frameworks.sh 6 | 7 | CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 8 | CONFIGURATION=Release 9 | PROJECT=${CURRENT_PATH}/../postgresql-kit.xcodeproj 10 | 11 | # Build Mac Frameworks 12 | xcodebuild -project ${PROJECT} -target "openssl_mac" -configuration ${CONFIGURATION} || exit -1 13 | xcodebuild -project ${PROJECT} -target "postgresql_mac" -configuration ${CONFIGURATION} || exit -1 14 | xcodebuild -project ${PROJECT} -target "PGClientKit_mac" -configuration ${CONFIGURATION} || exit -1 15 | xcodebuild -project ${PROJECT} -target "PGServerKit_mac" -configuration ${CONFIGURATION} || exit -1 16 | xcodebuild -project ${PROJECT} -target "PGControlsKit_mac" -configuration ${CONFIGURATION} || exit -1 17 | #xcodebuild -project ${PROJECT} -target "PGDataKit_mac" -configuration ${CONFIGURATION} || exit -1 18 | 19 | # Build iOS Frameworks 20 | xcodebuild -project ${PROJECT} -target "openssl_ios" -configuration ${CONFIGURATION} || exit -1 21 | xcodebuild -project ${PROJECT} -target "libpq_ios" -configuration ${CONFIGURATION} || exit -1 22 | xcodebuild -project ${PROJECT} -target "PGClientKit_ios" -configuration ${CONFIGURATION} || exit -1 23 | -------------------------------------------------------------------------------- /etc/build-iosapps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Build iOS apps in Release configuration 3 | # 4 | # Syntax: 5 | # build-iosapps.sh 6 | 7 | CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 8 | CONFIGURATION=Release 9 | PROJECT=${CURRENT_PATH}/../postgresql-kit.xcodeproj 10 | 11 | # Build iOS iApps 12 | xcodebuild -project ${PROJECT} -target "PGClientKit_ios" -configuration ${CONFIGURATION} || exit -1 13 | #xcodebuild -project ${PROJECT} -target "PGClient_ios" -configuration ${CONFIGURATION} || exit -1 14 | -------------------------------------------------------------------------------- /etc/build-macapps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Build Mac OS X apps in Release configuration 3 | # 4 | # Syntax: 5 | # build-macapps.sh 6 | 7 | CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 8 | CONFIGURATION=Release 9 | PROJECT=${CURRENT_PATH}/../postgresql-kit.xcodeproj 10 | 11 | # Build Foundation Apps 12 | xcodebuild -project ${PROJECT} -target "PGFoundationClient" -configuration ${CONFIGURATION} || exit -1 13 | xcodebuild -project ${PROJECT} -target "PGFoundationServer" -configuration ${CONFIGURATION} || exit -1 14 | 15 | # Build Cocoa Apps 16 | #xcodebuild -project ${PROJECT} -target "PGClient" -configuration ${CONFIGURATION} || exit -1 17 | #xcodebuild -project ${PROJECT} -target "PGServer" -configuration ${CONFIGURATION} || exit -1 18 | 19 | -------------------------------------------------------------------------------- /etc/reversion.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Reversion all plist files 4 | 5 | ############################################################## 6 | # Process command line arguments 7 | 8 | CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 9 | SCRIPT_NAME=$( basename $0 ) 10 | BIN="${CURRENT_PATH}/reversion-plist.sh" 11 | 12 | ${BIN} \ 13 | src/Frameworks/PGServerKit/PGServerKit.plist \ 14 | src/Frameworks/PGClientKit/PGClientKit_ios.plist \ 15 | src/Frameworks/PGClientKit/PGClientKit_mac.plist \ 16 | src/Frameworks/PGControlsKit/PGControlsKit.plist \ 17 | src/Frameworks/PGDataKit/PGDataKit_mac.plist \ 18 | src/Apps/Cocoa/PGClient/Info.plist 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /etc/test-frameworks.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | # Test all frameworks in Debug configuration 3 | # 4 | # Syntax: 5 | # test-frameworks.sh 6 | 7 | CURRENT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" 8 | CONFIGURATION=Debug 9 | PROJECT=${CURRENT_PATH}/../postgresql-kit.xcodeproj 10 | 11 | # Test Frameworks 12 | echo "Tests are currently in the process of being implemented" 13 | exit -1 14 | 15 | #xcodebuild test -project ${PROJECT} -scheme "PGClientKit_testcases" -configuration ${CONFIGURATION} || exit -1 16 | #xcodebuild test -project ${PROJECT} -scheme "PGServerKit_testcases" -configuration ${CONFIGURATION} || exit -1 17 | 18 | -------------------------------------------------------------------------------- /old/PGClient/LocalConnectionWindowController.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | @interface LocalConnectionWindowController : NSWindowController { 5 | NSUInteger _port; 6 | BOOL _defaultPort; 7 | NSString* _path; 8 | NSString* _username; 9 | NSString* _database; 10 | BOOL _validParameters; 11 | } 12 | 13 | // properties 14 | @property NSUInteger port; 15 | @property NSString* path; 16 | @property NSString* username; 17 | @property NSString* database; 18 | @property BOOL defaultPort; 19 | @property (readonly) NSString* displayedPath; 20 | @property (readonly) BOOL validParameters; 21 | 22 | // methods 23 | -(void)beginSheetForParentWindow:(NSWindow* )parentWindow; 24 | 25 | // ibactions 26 | -(IBAction)ibEndSheetForButton:(id)sender; 27 | -(IBAction)ibDoChooseFolder:(id)sender; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /old/PGClient/PGClient.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | elephant 11 | CFBundleIdentifier 12 | com.mutablelogic.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | ${MACOSX_DEPLOYMENT_TARGET} 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /old/PGClient/PGClientApplication.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | #import 4 | #import 5 | #import 6 | 7 | #import "LocalConnectionWindowController.h" 8 | #import "RemoteConnectionWindowController.h" 9 | #import "PGSidebarViewController.h" 10 | #import "PGConnectionController.h" 11 | #import "PGTabViewController.h" 12 | 13 | // notifications 14 | extern NSString* PGClientAddConnectionURL; 15 | extern NSString* PGClientNotificationOpenConnection; 16 | extern NSString* PGClientNotificationCloseConnection; 17 | extern NSString* PGClientNotificationDeleteConnection; 18 | extern NSString* PGClientNotificationEditConnection; 19 | 20 | @interface PGClientApplication : NSObject { 21 | PGServer* _internalServer; 22 | PGConnectionController* _connections; 23 | BOOL _terminationRequested; 24 | } 25 | 26 | // properties 27 | @property (assign) IBOutlet NSWindow* window; 28 | @property (assign) IBOutlet NSView* ibGrabberView; 29 | @property (assign) IBOutlet PGTabViewController* ibTabViewController; 30 | @property (assign) IBOutlet PGPasswordWindow* ibPasswordWindow; 31 | @property (assign) IBOutlet LocalConnectionWindowController* ibLocalConnectionWindowController; 32 | @property (assign) IBOutlet RemoteConnectionWindowController* ibRemoteConnectionWindowController; 33 | @property (assign) IBOutlet PGSidebarViewController* ibSidebarViewController; 34 | @property (readonly) PGConnectionController* connections; 35 | @property (readonly) PGServer* internalServer; 36 | @property BOOL terminationRequested; 37 | 38 | // IBActions 39 | -(IBAction)doAddLocalConnection:(id)sender; 40 | -(IBAction)doAddRemoteConnection:(id)sender; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /old/PGClient/PGConnectionController.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | #import 4 | 5 | // forward declarations 6 | @protocol PGConnectionControllerDelegate; 7 | 8 | // PGConnectionController 9 | @interface PGConnectionController : NSObject { 10 | PGPasswordStore* _passwords; 11 | NSMutableDictionary* _connections; 12 | NSMutableDictionary* _urls; 13 | } 14 | 15 | // properties 16 | @property (weak, nonatomic) id delegate; 17 | 18 | // methods for connections 19 | -(PGConnection* )createConnectionWithURL:(NSURL* )url forKey:(NSUInteger)key; 20 | -(PGConnection* )connectionForKey:(NSUInteger)key; 21 | -(BOOL)openConnectionForKey:(NSUInteger)key; 22 | -(void)closeConnectionForKey:(NSUInteger)key; 23 | -(void)closeAllConnections; 24 | -(NSString* )databaseSelectedForConnectionWithKey:(NSUInteger)key; 25 | 26 | // methods for passwords 27 | -(NSString* )passwordForKey:(NSUInteger)key; 28 | -(BOOL)setPassword:(NSString* )password forKey:(NSUInteger)key saveToKeychain:(BOOL)saveToKeychain; 29 | 30 | 31 | @end 32 | 33 | // delegate protocol 34 | @protocol PGConnectionControllerDelegate 35 | @optional 36 | -(void)connectionOpeningWithKey:(NSUInteger)key; 37 | -(void)connectionOpenWithKey:(NSUInteger)key; 38 | -(void)connectionRejectedWithKey:(NSUInteger)key error:(NSError* )error; 39 | -(void)connectionNeedsPasswordWithKey:(NSUInteger)key; 40 | -(void)connectionInvalidPasswordWithKey:(NSUInteger)key; 41 | -(void)connectionClosedWithKey:(NSUInteger)key; 42 | @end 43 | 44 | -------------------------------------------------------------------------------- /old/PGClient/PGSidebarDataSource.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | #import "PGSidebarNode.h" 4 | 5 | extern NSString* PGSidebarDragType; 6 | 7 | @interface PGSidebarDataSource : NSObject { 8 | NSMutableArray* _nodes; 9 | NSMutableDictionary* _keys; 10 | NSUInteger _nextkey; 11 | } 12 | 13 | // properties 14 | @property (readonly) NSArray* groups; 15 | 16 | // methods 17 | -(NSUInteger)nextKey; 18 | -(PGSidebarNode* )nodeForKey:(NSUInteger)key; 19 | -(BOOL)addGroup:(PGSidebarNode* )node; 20 | -(BOOL)addServer:(PGSidebarNode* )node; 21 | -(BOOL)addDatabase:(PGSidebarNode* )node; 22 | -(BOOL)addQuery:(PGSidebarNode* )node; 23 | -(BOOL)deleteNode:(PGSidebarNode* )node; 24 | 25 | @end 26 | 27 | 28 | -------------------------------------------------------------------------------- /old/PGClient/PGSidebarViewController.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | #import "PGSidebarDataSource.h" 4 | 5 | @interface PGSidebarViewController : NSViewController { 6 | PGSidebarDataSource* _datasource; 7 | } 8 | 9 | // properties 10 | @property (readonly) PGSidebarDataSource* datasource; 11 | @property (readonly) BOOL canOpen; 12 | @property (readonly) BOOL canClose; 13 | @property (readonly) BOOL canDelete; 14 | 15 | // application delegate methods 16 | -(void)applicationDidFinishLaunching:(NSNotification* )aNotification; 17 | -(void)applicationWillTerminate:(id)sender; 18 | 19 | // methods 20 | -(PGSidebarNode* )nodeForKey:(NSUInteger)key; 21 | -(PGSidebarNode* )selectedNode; 22 | -(void)selectNode:(PGSidebarNode* )node; 23 | -(void)deleteNode:(PGSidebarNode* )node; 24 | -(void)setNode:(PGSidebarNode* )node status:(PGSidebarNodeStatusType)status; 25 | -(void)expandNodeWithKey:(NSUInteger)key; 26 | 27 | // load and save to user defaults 28 | -(BOOL)loadFromUserDefaults; 29 | -(BOOL)saveToUserDefaults; 30 | 31 | // select database 32 | -(PGSidebarNode* )selectDatabaseNodeWithName:(NSString* )name serverWithKey:(NSUInteger)key; 33 | 34 | // ibactions 35 | -(IBAction)doOpen:(id)sender; 36 | -(IBAction)doClose:(id)sender; 37 | -(IBAction)doDelete:(id)sender; 38 | -(IBAction)doDoubleClick:(id)sender; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /old/PGClient/PGTabViewController.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | #import 4 | 5 | @interface PGTabViewController : NSObject { 6 | NSMutableDictionary* _consoles; 7 | NSMutableDictionary* _logs; 8 | } 9 | 10 | // properties 11 | @property (assign) IBOutlet NSTabView* ibTabView; 12 | 13 | // methods 14 | -(void)openConsoleViewWithName:(NSString* )name forKey:(NSUInteger)key; 15 | -(void)appendConsoleMessage:(NSString* )message forKey:(NSUInteger)key; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /old/PGClient/RemoteConnectionWindowController.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | #import 4 | 5 | @interface RemoteConnectionWindowController : NSWindowController { 6 | PGConnection* _connection; 7 | NSMutableDictionary* _parameters; 8 | } 9 | 10 | // properties 11 | @property (readonly) NSMutableDictionary* parameters; 12 | 13 | @property BOOL validParameters; 14 | @property (readonly) NSString* timeoutString; 15 | @property NSImage* statusImage; 16 | @property (readonly) NSURL* url; 17 | @property (assign) IBOutlet NSBox* ibAdvancedOptionsBox; 18 | @property NSTimer* pingTimer; 19 | 20 | // methods 21 | -(void)beginSheetForParentWindow:(NSWindow* )parentWindow url:(NSURL* )url; 22 | 23 | // ibactions 24 | -(IBAction)ibEndSheetForButton:(id)sender; 25 | 26 | @end 27 | -------------------------------------------------------------------------------- /old/PGConsoleView/PGConsoleView.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | @protocol PGConsoleViewDelegate 16 | @required 17 | -(NSUInteger)numberOfRowsInConsoleView:(PGConsoleView* )view; 18 | -(NSString* )consoleView:(PGConsoleView* )view stringForRow:(NSUInteger)row; 19 | @optional 20 | -(void)consoleView:(PGConsoleView* )view appendString:(NSString* )string; 21 | @end 22 | 23 | @interface PGConsoleView : NSViewController { 24 | NSFont* _textFont; 25 | NSColor* _textColor; 26 | NSColor* _backgroundColor; 27 | BOOL _showGutter; 28 | BOOL _editable; 29 | NSMutableString* _editBuffer; 30 | } 31 | 32 | // properties 33 | @property NSUInteger tag; 34 | @property (assign) IBOutlet NSTableView* tableView; 35 | @property (weak,nonatomic) id delegate; 36 | @property NSFont* textFont; 37 | @property NSColor* textColor; 38 | @property NSColor* backgroundColor; 39 | @property (readonly) CGFloat textHeight; 40 | @property BOOL showGutter; 41 | @property CGFloat defaultGutterWidth; 42 | @property BOOL editable; 43 | @property (readonly) NSMutableString* editBuffer; 44 | 45 | // methods 46 | -(void)reloadData; 47 | -(void)scrollToBottom; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /old/PGConsoleView/PGConsoleViewImpl.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | 17 | @interface PGConsoleViewImpl : NSTableView 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /old/PGConsoleView/PGConsoleViewImpl.m: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import "PGControlsKit.h" 16 | #import "PGControlsKit+Private.h" 17 | 18 | @implementation PGConsoleViewImpl 19 | 20 | -(void)keyDown:(NSEvent* )theEvent { 21 | PGConsoleView* delegate = (PGConsoleView* )[self delegate]; 22 | NSParameterAssert([delegate isKindOfClass:[PGConsoleView class]]); 23 | if([delegate editable] && [delegate respondsToSelector:@selector(keyDown:)]) { 24 | [delegate keyDown:theEvent]; 25 | } else { 26 | [super keyDown:theEvent]; 27 | } 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /old/PGConsoleView/PGGutterView.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | 17 | @interface PGGutterView : NSView 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /old/PGConsoleView/PGGutterView.m: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import "PGGutterView.h" 16 | 17 | @implementation PGGutterView 18 | 19 | -(id)initWithFrame:(NSRect)frame { 20 | self = [super initWithFrame:frame]; 21 | if (self) { 22 | // Initialization code here. 23 | } 24 | return self; 25 | } 26 | 27 | -(void)drawRect:(NSRect)dirtyRect { 28 | // Drawing code here. 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /old/PGServer/ConfigurationPrefs.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | #import 4 | #import "ControllerDelegate.h" 5 | 6 | @interface ConfigurationPrefs : NSObject 7 | 8 | @property id delegate; 9 | @property (assign) IBOutlet NSWindow* ibWindow; 10 | @property (assign) IBOutlet NSTableView* ibTableView; 11 | @property (assign) NSString* ibComment; 12 | 13 | -(IBAction)ibSheetOpen:(NSWindow* )window delegate:(id)sender; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /old/PGServer/ConnectionPrefs.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | #import "ControllerDelegate.h" 4 | 5 | @interface ConnectionPrefs : NSObject 6 | 7 | @property id delegate; 8 | @property (assign) IBOutlet NSWindow* ibWindow; 9 | 10 | @property BOOL remoteConnectionValue; 11 | @property BOOL bonjourValue; 12 | @property NSString* portValue; 13 | @property NSString* bonjourServiceValue; 14 | @property BOOL bonjourEnabled; 15 | @property NSUInteger maxConnectionsValue; 16 | @property NSUInteger superConnectionsValue; 17 | 18 | @property (readonly) NSUInteger port; 19 | @property (readonly) NSString* hostname; 20 | @property (readonly) NSString* bonjourName; 21 | 22 | @property BOOL portEditable; 23 | @property BOOL customPortEditable; 24 | @property NSUInteger selectedPortOption; 25 | @property NSString* portField; 26 | @property NSString* lastPortField; 27 | 28 | -(IBAction)ibSheetOpen:(NSWindow* )window delegate:(id)sender; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /old/PGServer/Controller.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | #import 4 | #import 5 | 6 | #import "ConnectionPrefs.h" 7 | #import "ConfigurationPrefs.h" 8 | #import "ControllerDelegate.h" 9 | 10 | @interface Controller : NSObject { 11 | PGConnection* _connection; 12 | PGServer* _server; 13 | } 14 | 15 | // objects 16 | @property (readonly) PGServer* server; 17 | @property (readonly) PGConnection* connection; 18 | 19 | // UI control properties 20 | @property (assign) IBOutlet NSWindow* ibWindow; 21 | @property (assign) IBOutlet NSTextView* ibLogTextView; 22 | @property (assign) IBOutlet NSToolbarItem* ibToolbarItemConnection; 23 | @property (assign) IBOutlet NSToolbarItem* ibToolbarItemConfiguration; 24 | 25 | // controllers 26 | @property (assign) IBOutlet ConnectionPrefs* ibConnectionPrefs; 27 | @property (assign) IBOutlet ConfigurationPrefs* ibConfigurationPrefs; 28 | 29 | // flags 30 | @property BOOL ibStartButtonEnabled; 31 | @property BOOL ibStopButtonEnabled; 32 | @property BOOL ibBackupButtonEnabled; 33 | @property NSImage* ibServerStatusIcon; 34 | @property NSString* ibServerVersion; 35 | @property NSDate* terminateRequested; 36 | 37 | // methods 38 | -(void)stopServer; 39 | -(void)restartServer; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /old/PGServer/ControllerDelegate.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | @protocol ControllerDelegate 5 | -(PGServerPreferences* )configuration; 6 | -(void)restartServer; 7 | -(void)reloadServer; 8 | @end 9 | -------------------------------------------------------------------------------- /old/PGServer/PGServer-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | elephant 11 | CFBundleIdentifier 12 | com.mutablelogic.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSApplicationCategoryType 26 | public.app-category.utilities 27 | LSMinimumSystemVersion 28 | ${MACOSX_DEPLOYMENT_TARGET} 29 | NSMainNibFile 30 | PGServer 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /old/PostgresClientKit/FLXMacAddr.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | @interface FLXMacAddr : NSObject { 5 | NSData* data; 6 | } 7 | 8 | @property (retain,readonly) NSData* data; 9 | 10 | +(FLXMacAddr* )macAddrWithBytes:(const void* )theBytes; 11 | -(NSString* )stringValue; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /old/PostgresClientKit/FLXMacAddr.m: -------------------------------------------------------------------------------- 1 | 2 | #import "PostgresClientKit.h" 3 | #import "PostgresClientKitPrivate.h" 4 | 5 | @implementation FLXMacAddr 6 | @synthesize data; 7 | 8 | -(id)init { 9 | self = [super init]; 10 | if (self != nil) { 11 | data = [[NSData dataWithBytes:"\0\0\0\0\0\0" length:6] retain]; 12 | } 13 | return self; 14 | } 15 | 16 | -(id)initWithBytes:(const void* )theBytes { 17 | self = [super init]; 18 | if (self != nil) { 19 | if(theBytes==nil) { 20 | return nil; 21 | } 22 | data = [[NSData dataWithBytes:theBytes length:6] retain]; 23 | } 24 | return self; 25 | } 26 | 27 | +(FLXMacAddr* )macAddrWithBytes:(const void* )theBytes { 28 | NSParameterAssert(theBytes); 29 | return [[[FLXMacAddr alloc] initWithBytes:theBytes] autorelease]; 30 | } 31 | 32 | -(void)dealloc { 33 | [data release]; 34 | [super dealloc]; 35 | } 36 | 37 | -(NSString* )stringValue { 38 | const uint8_t* ptr = [[self data] bytes]; 39 | return [NSString stringWithFormat:@"%02X:%02X:%02X:%02X:%02X:%02X",ptr[0],ptr[1],ptr[2],ptr[3],ptr[4],ptr[5]]; 40 | } 41 | 42 | -(NSString* )description { 43 | return [self stringValue]; 44 | } 45 | 46 | -(BOOL)isEqual:(id)anObject { 47 | if([anObject isKindOfClass:[FLXMacAddr class]]==NO) return NO; 48 | return [[self data] isEqual:[anObject data]]; 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /old/PostgresClientKit/FLXPostgresArray.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | // helper function for constructing arrays 5 | 6 | @interface FLXPostgresArray : NSObject { 7 | FLXPostgresType type; 8 | NSUInteger dimensions; 9 | NSUInteger* size; 10 | NSUInteger* lowerBound; 11 | NSUInteger numberOfTuples; 12 | NSMutableArray* tuples; 13 | } 14 | 15 | @property (retain) NSMutableArray* tuples; 16 | @property (assign) FLXPostgresType type; 17 | @property (assign) NSUInteger dimensions; 18 | @property (assign) NSUInteger numberOfTuples; 19 | @property (assign) NSUInteger* size; 20 | @property (assign) NSUInteger* lowerBound; 21 | 22 | +(FLXPostgresArray* )arrayWithDimensions:(NSUInteger)theDimensions type:(FLXPostgresType)theType; 23 | 24 | // methods 25 | -(void)setDimension:(NSUInteger)theDimension size:(NSUInteger)theSize lowerBound:(NSUInteger)theLowerBound; 26 | -(void)addTuple:(NSObject* )theObject; 27 | -(NSArray* )array; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /old/PostgresClientKit/FLXPostgresConnection+Utils.h: -------------------------------------------------------------------------------- 1 | 2 | @interface FLXPostgresConnection (Utils) 3 | 4 | -(NSArray* )databases; 5 | -(NSArray* )schemas; 6 | -(NSArray* )tablesInSchema:(NSString* )theSchema; 7 | -(NSString* )primaryKeyForTable:(NSString* )theTable inSchema:(NSString* )theSchema; 8 | -(NSArray* )columnNamesForTable:(NSString* )theTable inSchema:(NSString* )theSchema; 9 | @end 10 | -------------------------------------------------------------------------------- /old/PostgresClientKit/FLXPostgresException.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | @interface FLXPostgresException : NSException { 5 | 6 | } 7 | 8 | +(void)raise:(NSString* )theName connection:(void* )theConnection; 9 | +(void)raise:(NSString* )theName reason:(NSString* )theReason; 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /old/PostgresClientKit/FLXPostgresException.m: -------------------------------------------------------------------------------- 1 | 2 | #import "PostgresClientKit.h" 3 | #import "PostgresClientKitPrivate.h" 4 | 5 | @implementation FLXPostgresException 6 | 7 | +(void)raise:(NSString* )theName connection:(void* )theConnection { 8 | const char* theErrorMessage = theConnection ? PQerrorMessage(theConnection) : "Unknown error"; 9 | FLXPostgresException* theException = [[[FLXPostgresException alloc] initWithName:theName reason:[NSString stringWithUTF8String:theErrorMessage] userInfo:nil] autorelease]; 10 | [theException raise]; 11 | } 12 | 13 | +(void)raise:(NSString* )theName reason:(NSString* )theReason { 14 | FLXPostgresException* theException = [[[FLXPostgresException alloc] initWithName:theName reason:theReason userInfo:nil] autorelease]; 15 | [theException raise]; 16 | } 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /old/PostgresClientKit/FLXPostgresResult.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | @interface FLXPostgresResult : NSObject { 5 | void* m_theResult; 6 | NSString* m_theAffectedRows; 7 | NSUInteger m_theNumberOfRows; 8 | NSUInteger m_theNumberOfColumns; 9 | NSUInteger m_theRow; 10 | FLXPostgresConnection* m_theConnection; 11 | void** m_theTypeHandlers; 12 | } 13 | 14 | @property (readonly) NSUInteger numberOfColumns; 15 | @property (readonly) NSUInteger affectedRows; 16 | 17 | // properties 18 | -(BOOL)isDataReturned; 19 | 20 | // properties - columns 21 | -(NSUInteger)numberOfColumns; 22 | -(NSArray* )columns; 23 | -(NSInteger)modifierForColumn:(NSUInteger)theColumn; 24 | -(NSUInteger)sizeForColumn:(NSUInteger)theColumn; 25 | 26 | // methods 27 | -(void)dataSeek:(NSUInteger)theRow; 28 | -(NSArray* )fetchRowAsArray; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /old/PostgresClientKit/FLXPostgresStatement.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | @interface FLXPostgresStatement : NSObject { 5 | NSString* statement; 6 | NSString* name; 7 | } 8 | 9 | @property (retain) NSString* statement; 10 | @property (retain) NSString* name; 11 | 12 | -(const char* )UTF8Name; 13 | -(const char* )UTF8Statement; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /old/PostgresClientKit/FLXPostgresStatement.m: -------------------------------------------------------------------------------- 1 | 2 | #import "PostgresClientKit.h" 3 | #import "PostgresClientKitPrivate.h" 4 | 5 | @implementation FLXPostgresStatement 6 | 7 | @synthesize name; 8 | @synthesize statement; 9 | 10 | -(id)initWithStatement:(NSString* )theStatement { 11 | NSParameterAssert(theStatement); 12 | self = [super init]; 13 | if (self != nil) { 14 | [self setStatement:theStatement]; 15 | [self setName:nil]; 16 | } 17 | return self; 18 | } 19 | 20 | -(void)dealloc { 21 | [self setName:nil]; 22 | [self setStatement:nil]; 23 | [super dealloc]; 24 | } 25 | 26 | -(const char* )UTF8Name { 27 | return [[self name] UTF8String]; 28 | } 29 | 30 | -(const char* )UTF8Statement { 31 | return [[self statement] UTF8String]; 32 | } 33 | 34 | -(NSString* )description { 35 | if([self name]) { 36 | return [NSString stringWithFormat:@"",[self name]]; 37 | } else { 38 | return [NSString stringWithFormat:@""]; 39 | } 40 | } 41 | 42 | //////////////////////////////////////////////////////////////////////////////// 43 | /* 44 | -(void)_parseQueryForTypes:(NSObject* )theQuery { 45 | NSParameterAssert(theQuery); 46 | NSParameterAssert([theQuery isKindOfClass:[NSString class]] || [theQuery isKindOfClass:[FLXPostgresStatement class]]); 47 | 48 | // get statement 49 | NSString* theStatement = nil; 50 | if([theQuery isKindOfClass:[NSString class]]) { 51 | theStatement = (NSString* )theQuery; 52 | } else if([theQuery isKindOfClass:[FLXPostgresStatement class]]) { 53 | theStatement = [(FLXPostgresStatement* )theQuery statement]; 54 | } 55 | 56 | // parse statement 57 | NSScanner* theScanner = [NSScanner scannerWithString:theStatement]; 58 | NSParameterAssert(theScanner); 59 | enum { State0,StateQuote } theState = State0; 60 | while([theScanner isAtEnd]==NO) { 61 | // TODO 62 | // skip until we reach quote ' or parameter $ 63 | } 64 | 65 | } 66 | */ 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /old/PostgresClientKit/FLXPostgresTypeNSNumber.h: -------------------------------------------------------------------------------- 1 | 2 | @interface FLXPostgresTypeNSNumber : NSObject { 3 | FLXPostgresConnection* m_theConnection; 4 | } 5 | 6 | @end 7 | 8 | -------------------------------------------------------------------------------- /old/PostgresClientKit/FLXPostgresTypeNSString.h: -------------------------------------------------------------------------------- 1 | 2 | @interface FLXPostgresTypeNSString : NSObject { 3 | FLXPostgresConnection* m_theConnection; 4 | } 5 | 6 | @end 7 | 8 | -------------------------------------------------------------------------------- /old/PostgresClientKit/FLXPostgresTypes+Array.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | @interface FLXPostgresTypes (Array) 5 | -(NSObject* )arrayFromBytes:(const void* )theBytes length:(NSUInteger)theLength type:(FLXPostgresOid)theType; 6 | -(NSObject* )boundValueFromArray:(NSArray* )theArray type:(FLXPostgresOid* )theTypeOid; 7 | @end 8 | -------------------------------------------------------------------------------- /old/PostgresClientKit/FLXPostgresTypes+DateTime.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | @interface FLXPostgresTypes (DateTime) 5 | 6 | -(NSObject* )boundValueFromInterval:(FLXTimeInterval* )theInterval type:(FLXPostgresOid* )theTypeOid; 7 | -(FLXPostgresOid)boundTypeFromInterval:(FLXTimeInterval* )theInterval; 8 | 9 | -(FLXTimeInterval* )intervalFromBytes:(const void* )theBytes length:(NSUInteger)theLength; 10 | -(NSDate* )abstimeFromBytes:(const void* )theBytes length:(NSUInteger)theLength; 11 | -(NSDate* )dateFromBytes:(const void* )theBytes length:(NSUInteger)theLength; 12 | -(NSDate* )timestampFromBytes:(const void* )theBytes length:(NSUInteger)theLength; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /old/PostgresClientKit/FLXPostgresTypes+Geometry.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | @interface FLXPostgresTypes (Geometry) 5 | 6 | -(FLXPostgresOid)boundTypeFromGeometry:(FLXGeometry* )theGeometry; 7 | -(NSObject* )boundValueFromGeometry:(FLXGeometry* )theGeometry type:(FLXPostgresOid* )theTypeOid; 8 | -(FLXGeometry* )pointFromBytes:(const void* )theBytes length:(NSUInteger)theLength; 9 | -(FLXGeometry* )lineFromBytes:(const void* )theBytes length:(NSUInteger)theLength; 10 | -(FLXGeometry* )boxFromBytes:(const void* )theBytes length:(NSUInteger)theLength; 11 | -(FLXGeometry* )circleFromBytes:(const void* )theBytes length:(NSUInteger)theLength; 12 | -(FLXGeometry* )pathFromBytes:(const void* )theBytes length:(NSUInteger)theLength; 13 | -(FLXGeometry* )polygonFromBytes:(const void* )theBytes length:(NSUInteger)theLength; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /old/PostgresClientKit/FLXPostgresTypes+NSData.h: -------------------------------------------------------------------------------- 1 | 2 | @interface FLXPostgresTypes (NSData) 3 | 4 | -(NSObject* )boundValueFromData:(NSData* )theData type:(FLXPostgresOid* )theType; 5 | -(FLXPostgresOid)boundTypeFromData:(NSData* )theData; 6 | -(NSString* )quotedStringFromData:(NSData* )theData; 7 | -(NSObject* )dataObjectFromBytes:(const void* )theBytes length:(NSUInteger)theLength; 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /old/PostgresClientKit/FLXPostgresTypes+NSData.m: -------------------------------------------------------------------------------- 1 | 2 | #import "PostgresClientKit.h" 3 | #import "PostgresClientKitPrivate.h" 4 | #import "FLXPostgresTypes+NSData.h" 5 | 6 | @implementation FLXPostgresTypes (NSData) 7 | 8 | -(NSObject* )boundValueFromData:(NSData* )theData type:(FLXPostgresOid* )theType { 9 | NSParameterAssert(theData); 10 | NSParameterAssert(theType); 11 | (*theType) = FLXPostgresTypeData; 12 | return theData; 13 | } 14 | 15 | -(FLXPostgresOid)boundTypeFromData:(NSData* )theData { 16 | NSParameterAssert(theData); 17 | return FLXPostgresTypeData; 18 | } 19 | 20 | -(NSString* )quotedStringFromData:(NSData* )theData { 21 | size_t theLength = 0; 22 | unsigned char* theBuffer = PQescapeByteaConn([[self connection] PGconn],[theData bytes],[theData length],&theLength); 23 | if(theBuffer==nil) { 24 | return nil; 25 | } 26 | NSMutableString* theNewString = [[NSMutableString alloc] initWithBytesNoCopy:theBuffer length:(theLength-1) encoding:NSUTF8StringEncoding freeWhenDone:YES]; 27 | // add quotes 28 | [theNewString appendString:@"'"]; 29 | [theNewString insertString:@"'" atIndex:0]; 30 | // return the string 31 | return [theNewString autorelease]; 32 | } 33 | 34 | -(NSObject* )dataObjectFromBytes:(const void* )theBytes length:(NSUInteger)theLength { 35 | NSParameterAssert(theBytes); 36 | return [NSData dataWithBytes:theBytes length:theLength]; 37 | } 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /old/PostgresClientKit/FLXPostgresTypes+NSNumber.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | @interface FLXPostgresTypes (NSNumber) 5 | 6 | -(Float32)float32FromBytes:(const void* )theBytes; 7 | -(Float64)float64FromBytes:(const void* )theBytes; 8 | -(SInt16)int16FromBytes:(const void* )theBytes; 9 | -(SInt32)int32FromBytes:(const void* )theBytes; 10 | -(SInt64)int64FromBytes:(const void* )theBytes; 11 | -(UInt16)unsignedInt16FromBytes:(const void* )theBytes; 12 | -(UInt32)unsignedInt32FromBytes:(const void* )theBytes; 13 | -(UInt64)unsignedInt64FromBytes:(const void* )theBytes; 14 | -(BOOL)booleanFromBytes:(const void* )theBytes; 15 | 16 | -(NSData* )boundDataFromFloat32:(Float32)theValue; 17 | -(NSData* )boundDataFromFloat64:(Float64)theValue; 18 | -(NSData* )boundDataFromInt32:(SInt32)theValue; 19 | -(NSData* )boundDataFromInt64:(SInt64)theValue; 20 | -(NSData* )boundDataFromBoolean:(BOOL)theValue; 21 | 22 | -(NSObject* )boundValueFromNumber:(NSNumber* )theNumber type:(FLXPostgresOid* )theType; 23 | -(FLXPostgresOid)boundTypeFromNumber:(NSNumber* )theNumber; 24 | 25 | -(NSString* )quotedStringFromNumber:(NSNumber* )theNumber; 26 | -(NSNumber* )integerObjectFromBytes:(const void* )theBytes length:(NSUInteger)theLength; 27 | -(NSNumber* )unsignedIntegerObjectFromBytes:(const void* )theBytes length:(NSUInteger)theLength; 28 | -(NSNumber* )realObjectFromBytes:(const void* )theBytes length:(NSUInteger)theLength; 29 | -(NSNumber* )booleanObjectFromBytes:(const void* )theBytes length:(NSUInteger)theLength; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /old/PostgresClientKit/FLXPostgresTypes+NetAddr.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface FLXPostgresTypes (NetAddr) 4 | -(FLXMacAddr* )macAddrFromBytes:(const void* )theBytes length:(NSUInteger)theLength; 5 | -(NSObject* )boundValueFromMacAddr:(FLXMacAddr* )theMacAddr type:(FLXPostgresOid* )theTypeOid; 6 | -(FLXPostgresOid)boundTypeFromMacAddr:(FLXMacAddr* )theMacAddr; 7 | 8 | @end 9 | -------------------------------------------------------------------------------- /old/PostgresClientKit/FLXPostgresTypes+NetAddr.m: -------------------------------------------------------------------------------- 1 | 2 | #import "PostgresClientKit.h" 3 | #import "PostgresClientKitPrivate.h" 4 | 5 | @implementation FLXPostgresTypes (NetAddr) 6 | 7 | 8 | //////////////////////////////////////////////////////////////////////////////////////////////// 9 | // mac addr 10 | 11 | -(FLXMacAddr* )macAddrFromBytes:(const void* )theBytes length:(NSUInteger)theLength { 12 | NSParameterAssert(theBytes); 13 | NSParameterAssert(theLength==6); 14 | return [FLXMacAddr macAddrWithBytes:theBytes]; 15 | } 16 | 17 | -(NSObject* )boundValueFromMacAddr:(FLXMacAddr* )theMacAddr type:(FLXPostgresOid* )theTypeOid { 18 | NSParameterAssert(theMacAddr); 19 | NSParameterAssert(theTypeOid); 20 | (*theTypeOid) = FLXPostgresTypeMacAddr; 21 | return [theMacAddr data]; 22 | } 23 | 24 | -(FLXPostgresOid)boundTypeFromMacAddr:(FLXMacAddr* )theMacAddr { 25 | NSParameterAssert(theMacAddr); 26 | return FLXPostgresTypeMacAddr; 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /old/PostgresClientKit/FLXPostgresTypes.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | @interface FLXPostgresTypes : NSObject { 5 | FLXPostgresConnection* m_theConnection; 6 | } 7 | 8 | @property (readonly,retain) FLXPostgresConnection* connection; 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /old/PostgresClientKit/FLXTimeInterval.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | // encapsulates a NSTimeInterval value (a double float) and the day and month intervals 5 | 6 | @interface FLXTimeInterval : NSObject { 7 | NSTimeInterval seconds; 8 | NSInteger days; 9 | NSInteger months; 10 | } 11 | 12 | @property (assign) NSTimeInterval seconds; 13 | @property (assign) NSInteger days; 14 | @property (assign) NSInteger months; 15 | 16 | +(FLXTimeInterval* )interval; 17 | +(FLXTimeInterval* )intervalWithSeconds:(NSTimeInterval)theSeconds days:(NSInteger)days months:(NSInteger)months; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /old/PostgresClientKit/PostgresClientKit.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright 2008/2009 David Thorpe, djt@mutablelogic.com 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | use this file except in compliance with the License. You may obtain a copy of 8 | the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | License for the specific language governing permissions and limitations under 16 | the License. 17 | 18 | */ 19 | 20 | @class FLXPostgresConnection; 21 | @class FLXPostgresStatement; 22 | @class FLXPostgresResult; 23 | @class FLXPostgresException; 24 | 25 | // server properties 26 | extern NSString* FLXPostgresParameterServerVersion; 27 | extern NSString* FLXPostgresParameterServerEncoding; 28 | extern NSString* FLXPostgresParameterClientEncoding; 29 | extern NSString* FLXPostgresParameterSuperUser; 30 | extern NSString* FLXPostgresParameterSessionAuthorization; 31 | extern NSString* FLXPostgresParameterDateStyle; 32 | extern NSString* FLXPostgresParameterTimeZone; 33 | extern NSString* FLXPostgresParameterIntegerDateTimes; 34 | extern NSString* FLXPostgresParameterStandardConformingStrings; 35 | 36 | #import "FLXPostgresConnection.h" 37 | #import "FLXPostgresConnection+Utils.h" 38 | #import "FLXPostgresStatement.h" 39 | #import "FLXPostgresResult.h" 40 | #import "FLXPostgresException.h" 41 | -------------------------------------------------------------------------------- /old/PostgresDataKit/FLXPostgresConnection+DataUtils.h: -------------------------------------------------------------------------------- 1 | 2 | @interface FLXPostgresConnection (DataUtils) 3 | -(NSObject* )insertRowForObject:(FLXPostgresDataObject* )theObject full:(BOOL)isFullCommit; 4 | -(void)updateRowForObject:(FLXPostgresDataObject* )theObject full:(BOOL)isFullCommit; 5 | -(void)deleteRowForObject:(FLXPostgresDataObject* )theObject; 6 | @end 7 | -------------------------------------------------------------------------------- /old/PostgresDataKit/FLXPostgresDataCache.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | @interface FLXPostgresDataCache : NSObject { 5 | FLXPostgresConnection* connection; 6 | NSMutableDictionary* context; 7 | NSString* schema; 8 | } 9 | 10 | @property (retain) FLXPostgresConnection* connection; 11 | @property (retain) NSMutableDictionary* context; 12 | @property (retain) NSString* schema; 13 | 14 | +(FLXPostgresDataCache* )sharedCache; 15 | 16 | -(id)newObjectForClass:(Class)theClass; 17 | //-(id)fetchObjectForClass:(Class)theClass primaryKeyValue:(id)theValue; 18 | -(BOOL)saveObject:(FLXPostgresDataObject* )theObject; 19 | 20 | @end 21 | 22 | @interface NSObject (FLXPostgresDataCacheDelegate) 23 | -(void)dataCache:(FLXPostgresDataCache* )theCache error:(NSError* )theError; 24 | @end 25 | -------------------------------------------------------------------------------- /old/PostgresDataKit/FLXPostgresDataObject.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | @interface FLXPostgresDataObject : NSObject { 5 | FLXPostgresDataObjectContext* context; 6 | NSMutableDictionary* values; 7 | NSMutableDictionary* modifiedValues; 8 | BOOL modified; 9 | } 10 | 11 | @property (retain) NSMutableDictionary* values; 12 | @property (retain) NSMutableDictionary* modifiedValues; 13 | @property (assign) BOOL modified; 14 | @property (retain) FLXPostgresDataObjectContext* context; 15 | 16 | // methods which can be subclassed 17 | +(NSString* )tableName; 18 | +(NSArray* )tableColumns; 19 | +(NSString* )primaryKey; 20 | +(NSString* )serialKey; 21 | +(FLXPostgresDataObjectType)objectType; 22 | 23 | -(NSObject* )primaryValue; 24 | -(NSObject* )valueForKey:(NSString* )theKey; 25 | -(void)setValue:(NSObject* )theValue forKey:(NSString* )theKey; 26 | 27 | -(void)awakeFromInsert; 28 | -(void)awakeFromFetch; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /old/PostgresDataKit/FLXPostgresDataObjectContext.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | @interface FLXPostgresDataObjectContext : NSObject { 5 | NSString* className; 6 | NSString* tableName; 7 | NSString* schema; 8 | FLXPostgresDataObjectType type; 9 | NSString* primaryKey; 10 | NSString* serialKey; 11 | NSArray* tableColumns; 12 | } 13 | 14 | @property (retain) NSString* className; 15 | @property (retain) NSString* tableName; 16 | @property (retain) NSString* schema; 17 | @property (assign) FLXPostgresDataObjectType type; 18 | @property (retain) NSString* primaryKey; 19 | @property (retain) NSString* serialKey; 20 | @property (retain) NSArray* tableColumns; 21 | 22 | -(NSString* )tableSchemaName; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /old/PostgresDataKit/FLXPostgresDataObjectContext.m: -------------------------------------------------------------------------------- 1 | 2 | #import "PostgresDataKit.h" 3 | #import "PostgresDataKitPrivate.h" 4 | 5 | @implementation FLXPostgresDataObjectContext 6 | 7 | @synthesize className; 8 | @synthesize schema; 9 | @synthesize tableName; 10 | @synthesize primaryKey; 11 | @synthesize serialKey; 12 | @synthesize tableColumns; 13 | @synthesize type; 14 | 15 | /////////////////////////////////////////////////////////////////////////////// 16 | 17 | -(void)dealloc { 18 | [self setClassName:nil]; 19 | [self setSchema:nil]; 20 | [self setTableName:nil]; 21 | [self setPrimaryKey:nil]; 22 | [self setSerialKey:nil]; 23 | [self setTableColumns:nil]; 24 | [super dealloc]; 25 | } 26 | 27 | /////////////////////////////////////////////////////////////////////////////// 28 | 29 | -(NSString* )tableSchemaName { 30 | if([[self schema] length]) { 31 | return [NSString stringWithFormat:@"%@.%@",[self schema],[self tableName]]; 32 | } else { 33 | return [self tableName]; 34 | } 35 | } 36 | 37 | -(NSString* )description { 38 | switch([self type]) { 39 | case FLXPostgresDataObjectSimple: 40 | return [NSString stringWithFormat:@"{%@ => %@, primary key = %@, columns = { %@ }}",[self className],[self tableSchemaName],[self primaryKey],[[self tableColumns] componentsJoinedByString:@","]]; 41 | default: 42 | return [super description]; 43 | } 44 | } 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /old/PostgresDataKit/PostgresDataKit.h: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | 4 | Copyright 2008/2009 David Thorpe, djt@mutablelogic.com 5 | 6 | Licensed under the Apache License, Version 2.0 (the "License"); you may not 7 | use this file except in compliance with the License. You may obtain a copy of 8 | the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, software 13 | distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 14 | WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 15 | License for the specific language governing permissions and limitations under 16 | the License. 17 | 18 | */ 19 | 20 | #import 21 | 22 | typedef enum { 23 | FLXPostgresDataObjectSimple = 0, // simple type requires a primary key 24 | FLXPostgresDataObjectSerial = 1, // object serial means there is a '_serial' column for the table 25 | FLXPostgresDataTableSerial = 2 // table serial means there is a '_serial' table for this object 26 | } FLXPostgresDataObjectType; 27 | 28 | @class FLXPostgresDataCache; 29 | @class FLXPostgresDataObject; 30 | @class FLXPostgresDataObjectContext; 31 | 32 | #import "FLXPostgresDataCache.h" 33 | #import "FLXPostgresDataObject.h" 34 | #import "FLXPostgresDataObjectContext.h" 35 | #import "FLXPostgresConnection+DataUtils.h" 36 | 37 | -------------------------------------------------------------------------------- /old/PostgresDataKit/PostgresDataKitPrivate.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #import 4 | 5 | @interface FLXPostgresDataObject (Private) 6 | -(id)initWithContext:(FLXPostgresDataObjectContext* )theContext; 7 | -(NSArray* )_modifiedTableColumns; 8 | -(BOOL)_isNewObject; 9 | -(void)_commit; 10 | -(void)_rollback; 11 | @end 12 | 13 | @interface FLXPostgresDataCache (Private) 14 | -(FLXPostgresDataObjectContext* )objectContextForClass:(Class)theClass; 15 | @end 16 | -------------------------------------------------------------------------------- /old/PostgresPrefPane/PostgresPrefPaneController.h: -------------------------------------------------------------------------------- 1 | // 2 | // PrefPanePref.h 3 | // PrefPane 4 | // 5 | // Created by David Thorpe on 11/02/2009. 6 | // Copyright (c) 2009 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import "PostgresPrefPaneBindings.h" 12 | 13 | @interface PostgresPrefPaneController : NSPreferencePane { 14 | NSConnection* connection; 15 | NSTimer* timer; 16 | FLXServerState serverState; 17 | 18 | // bindings object 19 | IBOutlet PostgresPrefPaneBindings* bindings; 20 | IBOutlet NSWindow* ibPasswordSheet; 21 | IBOutlet NSWindow* ibInstallSheet; 22 | } 23 | 24 | // instance variables 25 | @property (retain) NSConnection* connection; 26 | @property (retain) NSTimer* timer; 27 | @property (assign) FLXServerState serverState; 28 | 29 | // IBAction 30 | -(IBAction)doStartServer:(id)sender; 31 | -(IBAction)doStopServer:(id)sender; 32 | -(IBAction)doUninstall:(id)sender; 33 | -(IBAction)doPassword:(id)sender; 34 | -(IBAction)doPasswordEndSheet:(id)sender; 35 | -(IBAction)doInstallEndSheet:(id)sender; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /old/PostgresPrefPane/PostgresPrefPaneShared.h: -------------------------------------------------------------------------------- 1 | 2 | extern NSString* PostgresServerAppIdentifier; 3 | 4 | -------------------------------------------------------------------------------- /old/PostgresPrefPane/PostgresPrefPaneShared.m: -------------------------------------------------------------------------------- 1 | 2 | NSString* PostgresServerAppIdentifier = @"com.mutablelogic.PostgresServerApp"; 3 | -------------------------------------------------------------------------------- /old/PostgresPrefPane/PostgresServerApp.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | #import 4 | #import 5 | #import "PostgresServerKeychain.h" 6 | 7 | @interface PostgresServerApp : NSObject { 8 | NSString* dataPath; 9 | NSString* backupPath; 10 | FLXPostgresServer* server; 11 | FLXPostgresConnection* client; 12 | NSConnection* connection; 13 | BOOL isRemoteAccess; 14 | BOOL isBackupEnabled; 15 | NSTimeInterval backupTimeInterval; 16 | NSDate* lastBackupTime; 17 | NSInteger backupFreeSpacePercent; 18 | NSUInteger serverPort; 19 | NSUInteger defaultServerPort; 20 | NSTimer* backupTimer; 21 | PostgresServerKeychain* keychain; 22 | 23 | } 24 | 25 | // properties 26 | @property (retain) FLXPostgresServer* server; 27 | @property (retain) FLXPostgresConnection* client; 28 | @property (retain) NSConnection* connection; 29 | @property (retain) NSString* dataPath; 30 | @property (retain) NSString* backupPath; 31 | @property (retain) NSDate* lastBackupTime; 32 | @property (assign) NSInteger backupFreeSpacePercent; 33 | @property (retain) NSTimer* backupTimer; 34 | @property (assign) BOOL isRemoteAccess; 35 | @property (assign) BOOL isBackupEnabled; 36 | @property (assign) NSTimeInterval backupTimeInterval; 37 | @property (assign) NSUInteger serverPort; 38 | @property (assign, readonly) NSUInteger defaultServerPort; 39 | @property (retain) PostgresServerKeychain* keychain; 40 | 41 | // methods 42 | -(BOOL)awakeThread; 43 | -(void)endThread; 44 | -(void)startServer; 45 | -(void)stopServer; 46 | -(NSString* )serverVersion; 47 | -(FLXServerState)serverState; 48 | -(NSString* )serverStateAsString; 49 | -(NSString* )dataSpaceFreeAsString; 50 | -(NSUInteger)dataSpaceFreeAsPercent; 51 | -(void)fireBackupCycle; 52 | -(BOOL)hasSuperuserPassword; 53 | -(BOOL)setSuperuserPassword:(NSString* )theNewPassword existingPassword:(NSString* )theOldPassword; 54 | 55 | @end 56 | -------------------------------------------------------------------------------- /old/PostgresPrefPane/PostgresServerKeychain.h: -------------------------------------------------------------------------------- 1 | 2 | @interface PostgresServerKeychain : NSObject { 3 | NSString* dataPath; 4 | NSString* serviceName; 5 | id delegate; 6 | SecKeychainRef keychain; 7 | } 8 | 9 | @property (retain) NSString* dataPath; 10 | @property (retain) NSString* serviceName; 11 | @property (assign) id delegate; 12 | @property (assign) SecKeychainRef keychain; 13 | 14 | -(id)initWithDataPath:(NSString* )dataPath serviceName:(NSString* )serviceName; 15 | -(BOOL)open; 16 | -(void)close; 17 | -(BOOL)setPassword:(NSString* )thePassword forAccount:(NSString* )theAccount; 18 | -(NSString* )passwordForAccount:(NSString* )theAccount; 19 | 20 | @end 21 | 22 | @interface NSObject (PostgresServerKeychainDelegate) 23 | -(void)keychainError:(NSError* )theError; 24 | @end -------------------------------------------------------------------------------- /postgresql-kit.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /resources/elephant-144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djthorpe/postgresql-kit/4622eb1a9a969e4f3342111fe3c13d565a215f56/resources/elephant-144.png -------------------------------------------------------------------------------- /resources/elephant-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djthorpe/postgresql-kit/4622eb1a9a969e4f3342111fe3c13d565a215f56/resources/elephant-32.png -------------------------------------------------------------------------------- /resources/elephant-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djthorpe/postgresql-kit/4622eb1a9a969e4f3342111fe3c13d565a215f56/resources/elephant-512.png -------------------------------------------------------------------------------- /resources/elephant-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djthorpe/postgresql-kit/4622eb1a9a969e4f3342111fe3c13d565a215f56/resources/elephant-64.png -------------------------------------------------------------------------------- /resources/elephant-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djthorpe/postgresql-kit/4622eb1a9a969e4f3342111fe3c13d565a215f56/resources/elephant-72.png -------------------------------------------------------------------------------- /resources/elephant.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djthorpe/postgresql-kit/4622eb1a9a969e4f3342111fe3c13d565a215f56/resources/elephant.icns -------------------------------------------------------------------------------- /resources/gear-14x14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djthorpe/postgresql-kit/4622eb1a9a969e4f3342111fe3c13d565a215f56/resources/gear-14x14.png -------------------------------------------------------------------------------- /resources/icons/database.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djthorpe/postgresql-kit/4622eb1a9a969e4f3342111fe3c13d565a215f56/resources/icons/database.tiff -------------------------------------------------------------------------------- /resources/icons/halt.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djthorpe/postgresql-kit/4622eb1a9a969e4f3342111fe3c13d565a215f56/resources/icons/halt.tiff -------------------------------------------------------------------------------- /resources/icons/info.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djthorpe/postgresql-kit/4622eb1a9a969e4f3342111fe3c13d565a215f56/resources/icons/info.tiff -------------------------------------------------------------------------------- /resources/icons/network.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djthorpe/postgresql-kit/4622eb1a9a969e4f3342111fe3c13d565a215f56/resources/icons/network.tiff -------------------------------------------------------------------------------- /resources/icons/preferences.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djthorpe/postgresql-kit/4622eb1a9a969e4f3342111fe3c13d565a215f56/resources/icons/preferences.tiff -------------------------------------------------------------------------------- /resources/icons/reload.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djthorpe/postgresql-kit/4622eb1a9a969e4f3342111fe3c13d565a215f56/resources/icons/reload.tiff -------------------------------------------------------------------------------- /resources/icons/start.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djthorpe/postgresql-kit/4622eb1a9a969e4f3342111fe3c13d565a215f56/resources/icons/start.tiff -------------------------------------------------------------------------------- /resources/icons/stop.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djthorpe/postgresql-kit/4622eb1a9a969e4f3342111fe3c13d565a215f56/resources/icons/stop.tiff -------------------------------------------------------------------------------- /resources/icons/terminal.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djthorpe/postgresql-kit/4622eb1a9a969e4f3342111fe3c13d565a215f56/resources/icons/terminal.tiff -------------------------------------------------------------------------------- /resources/icons/user.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djthorpe/postgresql-kit/4622eb1a9a969e4f3342111fe3c13d565a215f56/resources/icons/user.tiff -------------------------------------------------------------------------------- /resources/logo_w_elephant.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djthorpe/postgresql-kit/4622eb1a9a969e4f3342111fe3c13d565a215f56/resources/logo_w_elephant.pdf -------------------------------------------------------------------------------- /resources/strapline-200x40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djthorpe/postgresql-kit/4622eb1a9a969e4f3342111fe3c13d565a215f56/resources/strapline-200x40.png -------------------------------------------------------------------------------- /resources/traffic/traffic-green.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djthorpe/postgresql-kit/4622eb1a9a969e4f3342111fe3c13d565a215f56/resources/traffic/traffic-green.tiff -------------------------------------------------------------------------------- /resources/traffic/traffic-grey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djthorpe/postgresql-kit/4622eb1a9a969e4f3342111fe3c13d565a215f56/resources/traffic/traffic-grey.png -------------------------------------------------------------------------------- /resources/traffic/traffic-orange.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djthorpe/postgresql-kit/4622eb1a9a969e4f3342111fe3c13d565a215f56/resources/traffic/traffic-orange.tiff -------------------------------------------------------------------------------- /resources/traffic/traffic-red.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djthorpe/postgresql-kit/4622eb1a9a969e4f3342111fe3c13d565a215f56/resources/traffic/traffic-red.tiff -------------------------------------------------------------------------------- /resources/ui/Gradient.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djthorpe/postgresql-kit/4622eb1a9a969e4f3342111fe3c13d565a215f56/resources/ui/Gradient.png -------------------------------------------------------------------------------- /resources/ui/ResizeControl.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djthorpe/postgresql-kit/4622eb1a9a969e4f3342111fe3c13d565a215f56/resources/ui/ResizeControl.png -------------------------------------------------------------------------------- /src/Apps/Cocoa/ControlsTest/AppDelegate.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | #import 4 | #import 5 | 6 | @interface AppDelegate : NSObject 7 | 8 | @end 9 | 10 | -------------------------------------------------------------------------------- /src/Apps/Cocoa/ControlsTest/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "idiom" : "mac", 10 | "size" : "16x16", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "mac", 15 | "size" : "32x32", 16 | "scale" : "1x" 17 | }, 18 | { 19 | "idiom" : "mac", 20 | "size" : "32x32", 21 | "scale" : "2x" 22 | }, 23 | { 24 | "idiom" : "mac", 25 | "size" : "128x128", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "idiom" : "mac", 30 | "size" : "128x128", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "idiom" : "mac", 35 | "size" : "256x256", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "mac", 40 | "size" : "256x256", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "mac", 45 | "size" : "512x512", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "mac", 50 | "size" : "512x512", 51 | "scale" : "2x" 52 | } 53 | ], 54 | "info" : { 55 | "version" : 1, 56 | "author" : "xcode" 57 | } 58 | } -------------------------------------------------------------------------------- /src/Apps/Cocoa/ControlsTest/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.mutablelogic.$(PRODUCT_NAME:rfc1034identifier) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSMinimumSystemVersion 26 | $(MACOSX_DEPLOYMENT_TARGET) 27 | NSMainNibFile 28 | MainMenu 29 | NSPrincipalClass 30 | NSApplication 31 | 32 | 33 | -------------------------------------------------------------------------------- /src/Apps/Cocoa/PGClient/Application.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | #import 17 | #import "ConsoleBuffer.h" 18 | 19 | @interface Application : NSObject { 20 | PGConnectionPool* _connections; 21 | PGSplitViewController* _splitView; 22 | PGSourceViewController* _sourceView; 23 | PGTabViewController* _tabView; 24 | PGHelpWindowController* _helpWindow; 25 | PGConnectionWindowController* _connectionWindow; 26 | ConsoleBuffer* _buffers; 27 | } 28 | 29 | // properties 30 | @property (readonly) PGConnectionPool* connections; 31 | @property (readonly) PGSplitViewController* splitView; 32 | @property (readonly) PGTabViewController* tabView; 33 | @property (readonly) PGSourceViewController* sourceView; 34 | @property (readonly) PGHelpWindowController* helpWindow; 35 | @property (readonly) PGConnectionWindowController* connectionWindow; 36 | 37 | @end 38 | 39 | -------------------------------------------------------------------------------- /src/Apps/Cocoa/PGClient/ConsoleBuffer.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | #import 17 | 18 | @interface ConsoleBuffer : NSObject { 19 | NSMutableDictionary* _buffers; 20 | } 21 | 22 | // methods 23 | -(PGConsoleViewBuffer* )bufferForTag:(NSInteger)tag; 24 | -(void)setBuffer:(PGConsoleViewBuffer* )buffer forTag:(NSInteger)tag; 25 | -(void)appendString:(NSString* )string forTag:(NSInteger)tag; 26 | -(void)removeAll; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /src/Apps/Cocoa/PGClient/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "mac", 5 | "size" : "16x16", 6 | "scale" : "1x" 7 | }, 8 | { 9 | "size" : "16x16", 10 | "idiom" : "mac", 11 | "filename" : "elephant-32-1.png", 12 | "scale" : "2x" 13 | }, 14 | { 15 | "size" : "32x32", 16 | "idiom" : "mac", 17 | "filename" : "elephant-32.png", 18 | "scale" : "1x" 19 | }, 20 | { 21 | "size" : "32x32", 22 | "idiom" : "mac", 23 | "filename" : "elephant-64.png", 24 | "scale" : "2x" 25 | }, 26 | { 27 | "idiom" : "mac", 28 | "size" : "128x128", 29 | "scale" : "1x" 30 | }, 31 | { 32 | "idiom" : "mac", 33 | "size" : "128x128", 34 | "scale" : "2x" 35 | }, 36 | { 37 | "idiom" : "mac", 38 | "size" : "256x256", 39 | "scale" : "1x" 40 | }, 41 | { 42 | "size" : "256x256", 43 | "idiom" : "mac", 44 | "filename" : "elephant-512-1.png", 45 | "scale" : "2x" 46 | }, 47 | { 48 | "size" : "512x512", 49 | "idiom" : "mac", 50 | "filename" : "elephant-512.png", 51 | "scale" : "1x" 52 | }, 53 | { 54 | "idiom" : "mac", 55 | "size" : "512x512", 56 | "scale" : "2x" 57 | } 58 | ], 59 | "info" : { 60 | "version" : 1, 61 | "author" : "xcode" 62 | } 63 | } -------------------------------------------------------------------------------- /src/Apps/Cocoa/PGClient/Images.xcassets/AppIcon.appiconset/elephant-32-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djthorpe/postgresql-kit/4622eb1a9a969e4f3342111fe3c13d565a215f56/src/Apps/Cocoa/PGClient/Images.xcassets/AppIcon.appiconset/elephant-32-1.png -------------------------------------------------------------------------------- /src/Apps/Cocoa/PGClient/Images.xcassets/AppIcon.appiconset/elephant-32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djthorpe/postgresql-kit/4622eb1a9a969e4f3342111fe3c13d565a215f56/src/Apps/Cocoa/PGClient/Images.xcassets/AppIcon.appiconset/elephant-32.png -------------------------------------------------------------------------------- /src/Apps/Cocoa/PGClient/Images.xcassets/AppIcon.appiconset/elephant-512-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djthorpe/postgresql-kit/4622eb1a9a969e4f3342111fe3c13d565a215f56/src/Apps/Cocoa/PGClient/Images.xcassets/AppIcon.appiconset/elephant-512-1.png -------------------------------------------------------------------------------- /src/Apps/Cocoa/PGClient/Images.xcassets/AppIcon.appiconset/elephant-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djthorpe/postgresql-kit/4622eb1a9a969e4f3342111fe3c13d565a215f56/src/Apps/Cocoa/PGClient/Images.xcassets/AppIcon.appiconset/elephant-512.png -------------------------------------------------------------------------------- /src/Apps/Cocoa/PGClient/Images.xcassets/AppIcon.appiconset/elephant-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djthorpe/postgresql-kit/4622eb1a9a969e4f3342111fe3c13d565a215f56/src/Apps/Cocoa/PGClient/Images.xcassets/AppIcon.appiconset/elephant-64.png -------------------------------------------------------------------------------- /src/Apps/Cocoa/PGClient/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.mutablelogic.$(PRODUCT_NAME:rfc1034identifier) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 0.1009.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 0.1009.0 25 | LSApplicationCategoryType 26 | 27 | LSMinimumSystemVersion 28 | $(MACOSX_DEPLOYMENT_TARGET) 29 | NSHumanReadableCopyright 30 | © Copyright 2015 David Thorpe, All Rights Reserved 31 | NSMainNibFile 32 | MainMenu 33 | NSPrincipalClass 34 | NSApplication 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/Apps/Cocoa/PGSchemaManager/PGSchemaManager.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | elephant 11 | CFBundleIdentifier 12 | com.mutablelogic.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSApplicationCategoryType 26 | public.app-category.developer-tools 27 | LSMinimumSystemVersion 28 | ${MACOSX_DEPLOYMENT_TARGET} 29 | NSMainNibFile 30 | MainMenu 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/Apps/Cocoa/PGSchemaManager/PGSchemaManagerApp.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | #import 4 | #import 5 | #import 6 | 7 | @interface PGSchemaManagerApp : NSObject { 8 | PGConnection* _connection; 9 | PGLoginController* _logincontroller; 10 | PGSchemaManager* _schema; 11 | PGSchemaProduct* _selected; 12 | } 13 | 14 | // properties 15 | @property (assign) IBOutlet NSWindow* window; 16 | @property (readonly) PGLoginController* logincontroller; 17 | @property (readonly) PGConnection* connection; 18 | @property (readonly) PGSchemaManager* schema; 19 | @property (readonly) NSArray* schemas; 20 | @property (readonly) BOOL ibCanLogin; 21 | @property (readonly) BOOL ibCanLogout; 22 | @property (retain) PGSchemaProduct* selected; 23 | 24 | // methods 25 | -(void)addSchemaPath:(NSString* )path; 26 | 27 | // actions 28 | -(IBAction)doLogin:(id)sender; 29 | -(IBAction)doLogout:(id)sender; 30 | -(IBAction)doCreate:(id)sender; 31 | -(IBAction)doDrop:(id)sender; 32 | -(IBAction)doAddSearchPath:(id)sender; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /src/Apps/Cocoa/PGSchemaManager/tree.schema.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | Table Schema for implementing a tree structure 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/Apps/Cocoa/PGServer/AppAbout.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | @interface AppAbout : NSObject { 5 | IBOutlet NSWindow* _mainWindow; 6 | IBOutlet NSWindow* _sheetWindow; 7 | } 8 | 9 | // properties 10 | @property (readonly) NSString* title; 11 | @property (readonly) NSAttributedString* notice; 12 | 13 | // actions 14 | -(IBAction)ibSheetStart:(id)sender; 15 | -(IBAction)ibSheetEnd:(id)sender; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /src/Apps/Cocoa/PGServer/AppDelegate.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | #import 4 | #import 5 | #import "AppPreferences.h" 6 | #import "ViewController.h" 7 | 8 | 9 | extern NSString* PGServerMessageNotificationError; 10 | extern NSString* PGServerMessageNotificationWarning; 11 | extern NSString* PGServerMessageNotificationFatal; 12 | extern NSString* PGServerMessageNotificationInfo; 13 | 14 | @interface AppDelegate : NSObject { 15 | IBOutlet NSWindow* _mainWindow; 16 | IBOutlet NSWindow* _closeConfirmSheet; 17 | IBOutlet NSTabView* _tabView; 18 | IBOutlet AppPreferences* _preferences; 19 | NSMutableDictionary* _views; 20 | PGConnection* _connection; 21 | PGServer* _server; 22 | } 23 | 24 | // properties 25 | @property (readonly) PGServer* server; 26 | @property (readonly) PGConnection* connection; 27 | @property (readonly) AppPreferences* preferences; 28 | @property (readonly) NSWindow* mainWindow; 29 | @property (retain) NSString* uptimeString; 30 | @property (retain) NSString* statusString; 31 | @property (retain) NSString* versionString; 32 | @property (assign) NSUInteger numberOfConnections; 33 | @property (retain) NSString* buttonText; 34 | @property (assign) BOOL buttonEnabled; 35 | @property (assign) BOOL serverRunning; 36 | @property (assign) BOOL serverStopped; 37 | @property (assign) BOOL clientConnected; 38 | @property (retain) NSImage* buttonImage; 39 | @property (assign) BOOL terminateRequested; 40 | 41 | // toolbar/menu items clicked 42 | -(IBAction)ibToolbarItemClicked:(id)sender; 43 | -(IBAction)ibViewMenuItemClicked:(NSMenuItem* )menuItem; 44 | -(IBAction)ibServerMenuItemClicked:(NSMenuItem* )menuItem; 45 | -(IBAction)ibStatusStringClicked:(id)sender; 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /src/Apps/Cocoa/PGServer/AppPreferences.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | @interface AppPreferences : NSObject { 5 | IBOutlet NSWindow* _mainWindow; 6 | IBOutlet NSWindow* _preferencesSheet; 7 | } 8 | 9 | // properties 10 | @property BOOL autoStartServer; 11 | @property BOOL autoHideWindow; 12 | @property NSTimeInterval statusRefreshInterval; 13 | 14 | // actions 15 | -(IBAction)ibPreferencesStart:(id)sender; 16 | -(IBAction)ibPreferencesEnd:(id)sender; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /src/Apps/Cocoa/PGServer/AppPreferences.m: -------------------------------------------------------------------------------- 1 | 2 | #import "AppPreferences.h" 3 | 4 | @implementation AppPreferences 5 | 6 | //////////////////////////////////////////////////////////////////////////////// 7 | // load and save user defaults 8 | 9 | -(void)loadUserDefaults { 10 | NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; 11 | [self setAutoHideWindow:[defaults boolForKey:@"autoHideWindow"]]; 12 | [self setAutoStartServer:[defaults boolForKey:@"autoStartServer"]]; 13 | [self setStatusRefreshInterval:[defaults floatForKey:@"statusRefreshInterval"]]; 14 | 15 | // set defaults 16 | if([self statusRefreshInterval] <= 0.0) { 17 | [self setStatusRefreshInterval:5.0]; 18 | [self saveUserDefaults]; 19 | } 20 | } 21 | 22 | -(void)saveUserDefaults { 23 | NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; 24 | [defaults setBool:[self autoHideWindow] forKey:@"autoHideWindow"]; 25 | [defaults setBool:[self autoStartServer] forKey:@"autoStartServer"]; 26 | [defaults synchronize]; 27 | } 28 | 29 | //////////////////////////////////////////////////////////////////////////////// 30 | // init method 31 | 32 | -(void)awakeFromNib { 33 | [self loadUserDefaults]; 34 | } 35 | 36 | //////////////////////////////////////////////////////////////////////////////// 37 | // IBActions 38 | 39 | -(IBAction)ibPreferencesStart:(id)sender { 40 | [NSApp beginSheet:_preferencesSheet modalForWindow:_mainWindow modalDelegate:self didEndSelector:@selector(ibPreferencesSheetEnd:returnCode:contextInfo:) contextInfo:nil]; 41 | } 42 | 43 | -(IBAction)ibPreferencesEnd:(id)sender { 44 | NSParameterAssert([sender isKindOfClass:[NSButton class]]); 45 | [NSApp endSheet:[(NSButton* )sender window] returnCode:NSOKButton]; 46 | } 47 | 48 | -(IBAction)ibPreferencesSheetEnd:(NSWindow* )sheet returnCode:(NSInteger)returnCode contextInfo:(void* )contextInfo { 49 | [sheet orderOut:self]; 50 | [self saveUserDefaults]; 51 | } 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /src/Apps/Cocoa/PGServer/ConnectionViewController.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | #import "ViewController.h" 4 | 5 | @interface ConnectionViewController : ViewController 6 | 7 | @property (assign) BOOL isRemoteConnection; 8 | @property (assign) NSUInteger port; 9 | @property (assign) BOOL isDefaultPort; 10 | 11 | -(IBAction)ibUseDefaultPort:(id)sender; 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /src/Apps/Cocoa/PGServer/ConnectionViewController.m: -------------------------------------------------------------------------------- 1 | 2 | #import "ConnectionViewController.h" 3 | #import 4 | 5 | @implementation ConnectionViewController 6 | 7 | //////////////////////////////////////////////////////////////////////////////// 8 | // properties 9 | 10 | @synthesize isRemoteConnection; 11 | @synthesize port; 12 | @synthesize isDefaultPort; 13 | 14 | -(NSString* )nibName { 15 | return @"ConnectionView"; 16 | } 17 | 18 | -(NSString* )identifier { 19 | return @"network"; 20 | } 21 | 22 | -(NSInteger)tag { 23 | return 1; 24 | } 25 | 26 | //////////////////////////////////////////////////////////////////////////////// 27 | // get hostname 28 | 29 | -(NSString* )listenAddresses { 30 | // if server is running, then get from there 31 | PGServer* server = [[self delegate] server]; 32 | PGServerState state = [server state]; 33 | if(state==PGServerStateRunning || state==PGServerStateAlreadyRunning) { 34 | return [server hostname]; 35 | } else { 36 | return nil; 37 | } 38 | } 39 | 40 | -(NSUInteger)configPort { 41 | // if server is running, then get from there 42 | PGServer* server = [[self delegate] server]; 43 | PGServerState state = [server state]; 44 | if(state==PGServerStateRunning || state==PGServerStateAlreadyRunning) { 45 | return [server port]; 46 | } else { 47 | return 0; 48 | } 49 | } 50 | 51 | //////////////////////////////////////////////////////////////////////////////// 52 | // methods 53 | 54 | -(void)loadView { 55 | [super loadView]; 56 | #ifdef DEBUG 57 | NSLog(@"listen = %@",[self listenAddresses]); 58 | NSLog(@"port = %lu",[self configPort]); 59 | #endif 60 | } 61 | 62 | -(IBAction)ibUseDefaultPort:(id)sender { 63 | [self setPort:PGServerDefaultPort]; 64 | [self setIsDefaultPort:YES]; 65 | } 66 | 67 | @end 68 | -------------------------------------------------------------------------------- /src/Apps/Cocoa/PGServer/ConnectionsViewController.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | #import "ViewController.h" 4 | 5 | @interface ConnectionsViewController : ViewController { 6 | IBOutlet NSTableView* _tableView; 7 | } 8 | 9 | @property PGResult* connections; 10 | @property NSTimer* timer; 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /src/Apps/Cocoa/PGServer/DatabaseViewController.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | #import "ViewController.h" 4 | 5 | @interface DatabaseViewController : ViewController { 6 | IBOutlet NSWindow* _createDatabaseSheet; 7 | IBOutlet NSSplitView* _splitView; 8 | IBOutlet NSImageView* _resizeView; 9 | IBOutlet NSTableView* _tableView; 10 | } 11 | 12 | @property PGResult* result; 13 | 14 | // IB Bindings 15 | @property NSString* ibDatabaseName; 16 | @property NSString* ibOwnerName; 17 | @property NSString* ibNotes; 18 | 19 | // IBActions 20 | -(IBAction)ibCreateDatabase:(id)sender; 21 | -(IBAction)ibDropDatabase:(id)sender; 22 | -(IBAction)ibBackupDatabase:(id)sender; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /src/Apps/Cocoa/PGServer/LogViewController.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | #import "ViewController.h" 4 | 5 | @interface LogViewController : ViewController { 6 | IBOutlet NSTextView* _textView; 7 | } 8 | 9 | // actions 10 | -(IBAction)doClearLog:(id)sender; 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /src/Apps/Cocoa/PGServer/NSWindow+ResizeAdditions.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | @interface NSWindow (ResizeAdditions) 5 | -(void)resizeToSize:(NSSize)newSize; 6 | @end 7 | -------------------------------------------------------------------------------- /src/Apps/Cocoa/PGServer/NSWindow+ResizeAdditions.m: -------------------------------------------------------------------------------- 1 | #import "NSWindow+ResizeAdditions.h" 2 | 3 | @implementation NSWindow (ResizeAdditions) 4 | 5 | -(CGFloat)toolbarHeight { 6 | NSToolbar* toolbar = [self toolbar]; 7 | CGFloat toolbarHeight = 0.0; 8 | NSRect windowFrame; 9 | if(toolbar && [toolbar isVisible]) { 10 | windowFrame = [[self class] contentRectForFrameRect:[self frame] styleMask:[self styleMask]]; 11 | toolbarHeight = NSHeight(windowFrame) - NSHeight([[self contentView] frame]); 12 | } 13 | return toolbarHeight; 14 | } 15 | 16 | -(void)resizeToSize:(NSSize)newSize { 17 | CGFloat newHeight = newSize.height + [self toolbarHeight]; 18 | CGFloat newWidth = newSize.width; 19 | NSRect aFrame = [[self class] contentRectForFrameRect:[self frame] styleMask:[self styleMask]]; 20 | aFrame.origin.y += aFrame.size.height; 21 | aFrame.origin.y -= newHeight; 22 | aFrame.size.height = newHeight; 23 | aFrame.size.width = newWidth; 24 | aFrame = [[self class] frameRectForContentRect:aFrame styleMask:[self styleMask]]; 25 | [self setFrame:aFrame display:YES animate:YES]; 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /src/Apps/Cocoa/PGServer/PGServer.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | elephant 11 | CFBundleIdentifier 12 | com.mutablelogic.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 0.1 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSApplicationCategoryType 26 | public.app-category.utilities 27 | LSMinimumSystemVersion 28 | ${MACOSX_DEPLOYMENT_TARGET} 29 | NSMainNibFile 30 | MainWindow 31 | NSPrincipalClass 32 | NSApplication 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/Apps/Cocoa/PGServer/SQL.strings: -------------------------------------------------------------------------------- 1 | 2 | "PGServerNumberOfConnections" = 3 | "SELECT 4 | COUNT(*) AS num_connections 5 | FROM 6 | pg_stat_activity 7 | WHERE 8 | pid <> pg_backend_pid()" 9 | ; 10 | 11 | "PGServerConnectionTable" = 12 | "SELECT 13 | datname AS database,procpid AS pid,current_query AS query, 14 | usename AS username,client_hostname AS remotehost, 15 | application_name,query_start,waiting 16 | FROM 17 | pg_stat_activity 18 | WHERE 19 | pid <> pg_backend_pid()" 20 | ; 21 | 22 | "PGServerCreateDatabase" = 23 | "CREATE DATABASE $1; 24 | COMMENT ON DATABASE $1 IS $2" 25 | ; 26 | 27 | -------------------------------------------------------------------------------- /src/Apps/Cocoa/PGServer/UsersRolesViewController.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | #import "ViewController.h" 4 | 5 | @interface UsersRolesViewController : ViewController { 6 | IBOutlet NSSplitView* _splitView; 7 | IBOutlet NSImageView* _resizeView; 8 | IBOutlet NSTableView* _tableView; 9 | } 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /src/Apps/Cocoa/PGServer/UsersRolesViewController.m: -------------------------------------------------------------------------------- 1 | 2 | #import "UsersRolesViewController.h" 3 | #import "AppDelegate.h" 4 | 5 | @implementation UsersRolesViewController 6 | 7 | -(NSString* )nibName { 8 | return @"UsersRolesView"; 9 | } 10 | 11 | -(NSString* )identifier { 12 | return @"users"; 13 | } 14 | 15 | 16 | -(NSInteger)tag { 17 | return 4; 18 | } 19 | 20 | -(void)loadView { 21 | [super loadView]; 22 | } 23 | 24 | //////////////////////////////////////////////////////////////////////////////// 25 | // NSSplitView delegate methods 26 | 27 | -(NSRect)splitView:(NSSplitView* )splitView additionalEffectiveRectOfDividerAtIndex:(NSInteger)dividerIndex { 28 | return [_resizeView convertRect:[_resizeView bounds] toView:splitView]; 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /src/Apps/Cocoa/PGServer/ViewController.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | #import 4 | #import 5 | 6 | //////////////////////////////////////////////////////////////////////////////// 7 | 8 | @protocol ViewControllerDelegate 9 | -(PGServer* )server; 10 | -(PGConnection* )connection; 11 | -(NSWindow* )mainWindow; 12 | @end 13 | 14 | //////////////////////////////////////////////////////////////////////////////// 15 | 16 | @interface ViewController : NSViewController 17 | 18 | @property id delegate; 19 | @property NSSize frameSize; 20 | @property (readonly) NSString* identifier; 21 | @property (readonly) NSInteger tag; 22 | 23 | // messages sent to ViewController 24 | -(BOOL)willSelectView:(id)sender; 25 | -(BOOL)willUnselectView:(id)sender; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /src/Apps/Cocoa/PGServer/ViewController.m: -------------------------------------------------------------------------------- 1 | 2 | #import "ViewController.h" 3 | 4 | @implementation ViewController 5 | 6 | @dynamic tag; 7 | 8 | -(void)loadView { 9 | [super loadView]; 10 | [self setFrameSize:[[self view] frame].size]; 11 | } 12 | 13 | // called just before view is selected, return NO to 14 | // not select the view 15 | -(BOOL)willSelectView:(id)sender { 16 | return YES; 17 | } 18 | 19 | // called just before view is selected, return NO to 20 | // not unselect the view 21 | -(BOOL)willUnselectView:(id)sender { 22 | return YES; 23 | } 24 | 25 | -(NSInteger)tag { 26 | return -1; 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /src/Apps/Cocoa/main.m: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | 17 | int main(int argc, const char * argv[]) { 18 | return NSApplicationMain(argc, argv); 19 | } 20 | -------------------------------------------------------------------------------- /src/Apps/Foundation/PGFoundationApp.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | #import "GBCli.h" 17 | 18 | @interface PGFoundationApp : NSObject { 19 | BOOL _stop; 20 | int _returnValue; 21 | GBSettings* _settings; 22 | } 23 | 24 | // constructor 25 | +(id)sharedApp; 26 | 27 | // properties 28 | @property (readonly) BOOL stopping; 29 | @property (readonly) GBSettings* settings; 30 | 31 | // methods 32 | 33 | // run is called to start the application and will block. will return 0 on 34 | // successful completion, or error code otherwise 35 | -(int)run; 36 | 37 | // setup is called to do one-time initial set-up, you can override this method 38 | -(BOOL)setup; 39 | 40 | // call stop when you wish to stop the application 41 | -(void)stop; 42 | 43 | // you should call stopped when the application is finally stopped 44 | -(void)stoppedWithReturnValue:(int)returnValue; 45 | 46 | // parsing command-line options 47 | -(BOOL)parseOptionsWithArguments:(const char** )argv count:(int)argc error:(NSError** )error; 48 | -(void)registerCommandLineOptionsWithParser:(GBCommandLineParser* )parser; 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /src/Apps/Foundation/PGFoundationClient.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | #import 17 | 18 | #import "PGFoundationApp.h" 19 | #import "Terminal.h" 20 | 21 | @interface PGFoundationClient : PGFoundationApp { 22 | PGConnection* _db; 23 | PGPasswordStore* _passwordstore; 24 | Terminal* _term; 25 | } 26 | 27 | // properties 28 | @property (readonly) NSURL* url; 29 | @property (retain) NSString* password; 30 | @property (readonly) PGConnection* db; 31 | @property (readonly) PGPasswordStore* passwordstore; 32 | @property (readonly) Terminal* term; 33 | @property (readonly) NSString* prompt; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /src/Apps/Foundation/PGFoundationServer.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | #import "PGFoundationApp.h" 17 | 18 | @interface PGFoundationServer : PGFoundationApp 19 | 20 | // properties 21 | @property PGServer* server; 22 | @property (readonly) NSString* dataPath; 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /src/Apps/Foundation/Terminal.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | 17 | @interface Terminal : NSObject 18 | 19 | // properties 20 | @property (retain) NSString* prompt; 21 | @property (readonly) NSInteger columns; 22 | 23 | // methods 24 | -(NSString* )readline; 25 | -(void)addHistory:(NSString* )line; 26 | -(void)printf:(NSString* )format,...; 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /src/Apps/iOS/PGClient_ios/PGApplication.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | #import 4 | 5 | @interface PGApplication : UIResponder { 6 | PGConnection* _connection; 7 | } 8 | 9 | // properties 10 | @property (strong, nonatomic) UIWindow* window; 11 | 12 | // methods 13 | -(BOOL)connect; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /src/Apps/iOS/PGClient_ios/PGClientView.h: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | @interface PGClientView : UIViewController { 5 | __weak IBOutlet UILabel* _statusLabel; 6 | } 7 | 8 | -(IBAction)doConnect:(id)sender; 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /src/Apps/iOS/PGClient_ios/PGClientView.m: -------------------------------------------------------------------------------- 1 | 2 | #import "PGApplication.h" 3 | #import "PGClientView.h" 4 | 5 | @implementation PGClientView 6 | 7 | //////////////////////////////////////////////////////////////////////////////// 8 | // constructors 9 | 10 | -(id)init { 11 | self = [super initWithNibName:@"PGClientView" bundle:nil]; 12 | if (self) { 13 | // Custom initialization 14 | } 15 | return self; 16 | } 17 | 18 | //////////////////////////////////////////////////////////////////////////////// 19 | // properties 20 | 21 | //////////////////////////////////////////////////////////////////////////////// 22 | // methods 23 | 24 | -(void)viewDidLoad { 25 | [super viewDidLoad]; 26 | [_statusLabel setText:@"Disconnected"]; 27 | } 28 | 29 | - (void)didReceiveMemoryWarning { 30 | [super didReceiveMemoryWarning]; 31 | // Dispose of any resources that can be recreated. 32 | } 33 | 34 | //////////////////////////////////////////////////////////////////////////////// 35 | // IBActions 36 | 37 | -(IBAction)doConnect:(id)sender { 38 | PGApplication* app = (PGApplication* )[[UIApplication sharedApplication] delegate]; 39 | NSParameterAssert(app); 40 | BOOL success = [app connect]; 41 | if(success) { 42 | [_statusLabel setText:@"Connected"]; 43 | } else { 44 | [_statusLabel setText:@"Disconnected"]; 45 | } 46 | } 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /src/Apps/iOS/PGClient_ios/PGClient_ios.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIcons 12 | 13 | CFBundlePrimaryIcon 14 | 15 | CFBundleIconFiles 16 | 17 | elephant-72.png 18 | elephant-144.png 19 | 20 | 21 | 22 | CFBundleIdentifier 23 | com.mutablelogic.${PRODUCT_NAME:rfc1034identifier} 24 | CFBundleInfoDictionaryVersion 25 | 6.0 26 | CFBundleName 27 | ${PRODUCT_NAME} 28 | CFBundlePackageType 29 | APPL 30 | CFBundleShortVersionString 31 | 1.0 32 | CFBundleSignature 33 | ???? 34 | CFBundleVersion 35 | 1.0 36 | LSRequiresIPhoneOS 37 | 38 | NSMainNibFile~ipad 39 | 40 | UIRequiredDeviceCapabilities 41 | 42 | armv7 43 | 44 | UISupportedInterfaceOrientations~ipad 45 | 46 | UIInterfaceOrientationPortrait 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/Apps/iOS/PGClient_ios/main.m: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | #import "PGApplication.h" 4 | 5 | int main(int argc, char *argv[]) { 6 | @autoreleasepool { 7 | return UIApplicationMain(argc,argv,nil,NSStringFromClass([PGApplication class])); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/Frameworks/PGClientKit/NSString+PGNetworkValidationAdditions.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | @interface NSString (PGNetworkValidationAdditions) 16 | 17 | /** 18 | * Determine if the string is a valid hostname 19 | * 20 | * @return returns YES if the string is a valid hostname 21 | */ 22 | -(BOOL)isNetworkHostname; 23 | 24 | /** 25 | * Determine if the string is a valid IP address (either IPv4 or IPv6) 26 | * 27 | * @return returns YES if the string is a valid IP address 28 | */ 29 | -(BOOL)isNetworkAddress; 30 | 31 | /** 32 | * Determine if the string is a valid IPv4 address 33 | * 34 | * @return returns YES if the string is a valid IPv4 address 35 | */ 36 | -(BOOL)isNetworkAddressV4; 37 | 38 | /** 39 | * Determine if the string is a valid IPv6 address 40 | * 41 | * @return returns YES if the string is a valid IPv6 address 42 | */ 43 | -(BOOL)isNetworkAddressV6; 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /src/Frameworks/PGClientKit/NSString+PGNetworkValidationAdditions.m: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | #import 17 | #include 18 | 19 | @implementation NSString (PGNetworkValidationAdditions) 20 | 21 | -(BOOL)isNetworkHostname { 22 | static NSRegularExpression* regex = nil; 23 | if([self isNetworkAddressV4]) { 24 | return NO; 25 | } 26 | if(regex==nil) { 27 | regex = [NSRegularExpression regularExpressionWithPattern:@"^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9])$" options:0 error:nil]; 28 | } 29 | NSParameterAssert(regex); 30 | NSArray* matches = [regex matchesInString:self options:0 range:NSMakeRange(0,[self length])]; 31 | return [matches count] ? YES : NO; 32 | } 33 | 34 | -(BOOL)isNetworkAddressV4 { 35 | struct in_addr dst; 36 | int success = inet_pton(AF_INET,[self UTF8String],&dst); 37 | return success == 1 ? YES : NO; 38 | } 39 | 40 | -(BOOL)isNetworkAddressV6 { 41 | struct in6_addr dst6; 42 | int success = inet_pton(AF_INET6,[self UTF8String],&dst6); 43 | return success == 1 ? YES : NO; 44 | } 45 | 46 | 47 | -(BOOL)isNetworkAddress { 48 | return [self isNetworkAddressV4] || [self isNetworkAddressV6]; 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /src/Frameworks/PGClientKit/NSString+PrivateAdditions.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | @interface NSString (PrivateAdditions) 16 | 17 | /** 18 | * Determines if the string only contains alphanumeric characters 19 | * 20 | * @return Returns YES if the string only contains alphanumeric characters, 21 | * else returns NO 22 | */ 23 | -(BOOL)isAlphanumeric; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /src/Frameworks/PGClientKit/NSString+PrivateAdditions.m: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | #import 17 | 18 | @implementation NSString (PrivateAdditions) 19 | 20 | -(BOOL)isAlphanumeric { 21 | static NSCharacterSet* unwantedCharacters = nil; 22 | if(unwantedCharacters==nil) { 23 | unwantedCharacters = [[NSCharacterSet alphanumericCharacterSet] invertedSet]; 24 | NSParameterAssert(unwantedCharacters); 25 | } 26 | return ([self rangeOfCharacterFromSet:unwantedCharacters].location == NSNotFound) ? YES : NO; 27 | } 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /src/Frameworks/PGClientKit/PGClientKit+Private.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #include 16 | #include 17 | 18 | /** 19 | * This file includes declarations which are private to the framework 20 | */ 21 | 22 | #import "PGClientParams.h" 23 | #import "PGConverters.h" 24 | #import "NSString+PrivateAdditions.h" 25 | 26 | @interface PGConnection (Private) 27 | -(void)_updateStatus; 28 | -(NSError* )raiseError:(NSError** )error code:(PGClientErrorDomainCode)code reason:(NSString* )format,...; 29 | -(NSError* )raiseError:(NSError** )error code:(PGClientErrorDomainCode)code; 30 | -(void)_socketConnect:(PGConnectionState)state; 31 | -(void)_socketDisconnect; 32 | -(void)_socketCallback:(CFSocketCallBackType)callBackType; 33 | -(NSDictionary* )_connectionParametersForURL:(NSURL* )theURL; 34 | -(BOOL)_cancelCreate; 35 | -(void)_cancelDestroy; 36 | @end 37 | 38 | @interface PGResult (Private) 39 | -(id)initWithResult:(PGresult* )theResult format:(PGClientTupleFormat)format; 40 | @end 41 | 42 | @interface PGQueryPredicate (Private) 43 | +(PGQueryPredicate* )predicateOrExpression:(id)expression; 44 | @end 45 | 46 | typedef struct { 47 | const char** keywords; 48 | const char** values; 49 | } PGKVPairs; 50 | 51 | PGKVPairs* makeKVPairs(NSDictionary* dict); 52 | void freeKVPairs(PGKVPairs* pairs); 53 | -------------------------------------------------------------------------------- /src/Frameworks/PGClientKit/PGClientKit_ios.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.mutablelogic.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 0.1009.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 0.1009.0 25 | NSPrincipalClass 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/Frameworks/PGClientKit/PGClientKit_mac.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.mutablelogic.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 0.1009.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 0.1009.0 25 | NSPrincipalClass 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/Frameworks/PGClientKit/PGClientParams.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #include 16 | 17 | typedef struct { 18 | NSUInteger size; 19 | const void** values; 20 | BOOL* freeWhenDone; 21 | Oid* types; 22 | int* lengths; 23 | int* formats; 24 | } PGClientParams; 25 | 26 | PGClientParams* _paramAllocForValues(NSArray* values); 27 | void _paramFree(PGClientParams* params); 28 | void _paramSetNull(PGClientParams* params,NSUInteger i); 29 | void _paramSetBinary(PGClientParams* params,NSUInteger i,NSData* data,Oid pgtype); 30 | void _paramSetText(PGClientParams* params,NSUInteger i,NSString* text,NSStringEncoding encoding,Oid pgtype); 31 | -------------------------------------------------------------------------------- /src/Frameworks/PGClientKit/PGConnection+Disconnect.m: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | #import 17 | 18 | @implementation PGConnection (Disconnect) 19 | 20 | -(void)disconnect { 21 | [self _cancelDestroy]; 22 | [self _socketDisconnect]; 23 | if(_connection) { 24 | PQfinish(_connection); 25 | _connection = nil; 26 | } 27 | [self _updateStatus]; 28 | } 29 | 30 | @end 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/Frameworks/PGClientKit/PGConverters.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | 17 | // initialize and destroy lookup cache 18 | void pgdata2obj_init(); 19 | void pgdata2obj_destroy(); 20 | 21 | // public methods to convert 22 | id pgdata_bin2obj(NSUInteger oid,const void* bytes,NSUInteger size,NSStringEncoding encoding); 23 | id pgdata_text2obj(NSUInteger oid,const void* bytes,NSUInteger size,NSStringEncoding encoding); 24 | 25 | // protocol for conversion 26 | @protocol PGObjectConverter 27 | +(NSData* )obj2bin; 28 | +(NSData* )obj2text; 29 | @end -------------------------------------------------------------------------------- /src/Frameworks/PGClientKit/PGResult+TextTable.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | @interface PGResult (TextTable) 16 | -(NSString* )tableWithWidth:(NSUInteger)lineWidth; 17 | @end 18 | -------------------------------------------------------------------------------- /src/Frameworks/PGClientKit/PGResult.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | @interface PGResult : NSObject { 16 | void* _result; 17 | PGClientTupleFormat _format; 18 | NSStringEncoding _encoding; 19 | NSUInteger _rowNumber; 20 | NSMutableDictionary* _cachedData; 21 | } 22 | 23 | //////////////////////////////////////////////////////////////////////////////// 24 | // properties 25 | 26 | @property (readonly) NSUInteger numberOfColumns; 27 | @property (readonly) NSUInteger affectedRows; 28 | @property (readonly) NSUInteger size; 29 | @property (readwrite) NSUInteger rowNumber; 30 | @property (readonly) BOOL dataReturned; 31 | @property (readonly) NSArray* columnNames; 32 | @property (readonly) PGClientTupleFormat format; 33 | 34 | //////////////////////////////////////////////////////////////////////////////// 35 | // methods 36 | 37 | // fetch rows 38 | -(NSArray* )fetchRowAsArray; 39 | -(NSDictionary* )fetchRowAsDictionary; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /src/Frameworks/PGControlsKit/PGConnectionWindowController.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | #import 17 | 18 | @interface PGConnectionWindowController : NSWindowController { 19 | PGConnection* _connection; 20 | NSMutableDictionary* _params; 21 | } 22 | 23 | // static methods 24 | +(NSURL* )defaultNetworkURL; 25 | +(NSURL* )defaultSocketURL; 26 | 27 | // properties 28 | @property (weak,nonatomic) IBOutlet NSView* ibCreateRoleView; 29 | @property (weak,nonatomic) IBOutlet NSView* ibCreateSchemaView; 30 | @property (weak,nonatomic) IBOutlet NSView* ibCreateDatabaseView; 31 | 32 | // methods to show dialogs 33 | -(void)beginConnectionSheetWithURL:(NSURL* )url parentWindow:(NSWindow* )parentWindow whenDone:(void(^)(NSURL* url)) callback; 34 | -(void)beginPasswordSheetWithParentWindow:(NSWindow* )parentWindow whenDone:(void(^)(NSString* password,BOOL useKeychain)) callback; 35 | -(void)beginErrorSheetWithError:(NSError* )error parentWindow:(NSWindow* )parentWindow whenDone:(void(^)(NSModalResponse response)) callback; 36 | -(void)beginCustomSheetWithTitle:(NSString* )title description:(NSString* )description view:(NSView* )view parentWindow:(NSWindow* )parentWindow whenDone:(void(^)(NSModalResponse response)) callback; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /src/Frameworks/PGControlsKit/PGConnectionWindowFormatter.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | 17 | @interface PGConnectionWindowFormatter : NSFormatter { 18 | NSCharacterSet* _cs; 19 | } 20 | 21 | @property NSString* type; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /src/Frameworks/PGControlsKit/PGConsoleViewBuffer.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | 17 | @interface PGConsoleViewBuffer : NSObject { 18 | NSMutableArray* _rows; 19 | } 20 | 21 | // methods 22 | -(void)appendString:(NSString* )string; 23 | -(void)appendString:(NSString* )string textColor:(NSColor* )color; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /src/Frameworks/PGControlsKit/PGConsoleViewBuffer.m: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | 17 | @implementation PGConsoleViewBuffer 18 | 19 | //////////////////////////////////////////////////////////////////////////////// 20 | // constructor 21 | 22 | -(id)init { 23 | self = [super init]; 24 | if(self) { 25 | _rows = [NSMutableArray new]; 26 | NSParameterAssert(_rows); 27 | } 28 | return self; 29 | } 30 | 31 | //////////////////////////////////////////////////////////////////////////////// 32 | // public methods 33 | 34 | -(void)appendString:(NSString* )string textColor:(NSColor* )color { 35 | NSParameterAssert(string); 36 | [_rows addObject:string]; 37 | } 38 | 39 | -(void)appendString:(NSString* )string { 40 | [self appendString:string textColor:nil]; 41 | } 42 | 43 | //////////////////////////////////////////////////////////////////////////////// 44 | // PGConsoleViewDataSource implementation 45 | 46 | -(NSUInteger)numberOfRowsForConsoleView:(PGConsoleViewController* )view { 47 | return [_rows count]; 48 | } 49 | 50 | -(NSString* )consoleView:(PGConsoleViewController* )consoleView stringForRow:(NSUInteger)row { 51 | NSParameterAssert(row >= 0 && row < [_rows count]); 52 | NSString* string = [_rows objectAtIndex:row]; 53 | NSParameterAssert([string isKindOfClass:[NSString class]]); 54 | return string; 55 | } 56 | 57 | @end 58 | -------------------------------------------------------------------------------- /src/Frameworks/PGControlsKit/PGControlsKit+Private.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | // Private Views 16 | #import "PGDialogBackgroundView.h" 17 | -------------------------------------------------------------------------------- /src/Frameworks/PGControlsKit/PGControlsKit.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | #import 17 | 18 | // Forward class delarations 19 | @class PGSplitViewController; 20 | 21 | @class PGConnectionWindowController; 22 | 23 | @class PGSourceViewController; 24 | @class PGSourceViewNode; 25 | @class PGSourceViewHeading; 26 | @class PGSourceViewConnection; 27 | 28 | @class PGTabViewController; 29 | 30 | @class PGHelpWindowController; 31 | 32 | @class PGConsoleViewController; 33 | @class PGConsoleViewBuffer; 34 | 35 | @class PGDialogController; 36 | 37 | @class PGDialogView; 38 | @class PGDialogCreateDatabaseView; 39 | @class PGDialogCreateRoleView; 40 | @class PGDialogCreateSchemaView; 41 | 42 | // PGDialog 43 | #import "PGDialogWindow.h" 44 | #import "PGDialogView.h" 45 | #import "PGDialogCreateDatabaseView.h" 46 | 47 | // Windows 48 | #import "PGConnectionWindowController.h" 49 | #import "PGHelpWindowController.h" 50 | 51 | // Views 52 | #import "PGSplitViewController.h" 53 | #import "PGSourceViewController.h" 54 | #import "PGTabViewController.h" 55 | #import "PGConsoleViewController.h" 56 | 57 | // Nodes for Source View 58 | #import "PGSourceViewNode.h" 59 | #import "PGSourceViewHeading.h" 60 | #import "PGSourceViewConnection.h" 61 | 62 | // Buffer model for console view 63 | #import "PGConsoleViewBuffer.h" 64 | 65 | 66 | -------------------------------------------------------------------------------- /src/Frameworks/PGControlsKit/PGControlsKit.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.mutablelogic.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 0.1009.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 0.1009.0 25 | NSPrincipalClass 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/Frameworks/PGControlsKit/PGDialogBackgroundView.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | 17 | @interface PGDialogBackgroundView : NSView 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /src/Frameworks/PGControlsKit/PGDialogBackgroundView.m: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import "PGDialogBackgroundView.h" 16 | 17 | @implementation PGDialogBackgroundView 18 | 19 | -(void)drawRect:(NSRect)dirtyRect { 20 | // Fill in background color to something slighty darker 21 | CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; 22 | CGContextSetRGBFillColor(context,0.85,0.85,0.85,1.0); 23 | CGContextFillRect(context, NSRectToCGRect(dirtyRect)); 24 | // draw content 25 | [super drawRect:dirtyRect]; 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /src/Frameworks/PGControlsKit/PGDialogCreateDatabaseView.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | @interface PGDialogCreateDatabaseView : PGDialogView 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /src/Frameworks/PGControlsKit/PGDialogCreateDatabaseView.m: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | #import 17 | 18 | @implementation PGDialogCreateDatabaseView 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /src/Frameworks/PGControlsKit/PGDialogView.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | @interface PGDialogView : NSObject 16 | 17 | //////////////////////////////////////////////////////////////////////////////// 18 | // properties 19 | 20 | @property (weak,nonatomic) IBOutlet NSView* view; 21 | 22 | //////////////////////////////////////////////////////////////////////////////// 23 | // public methods 24 | 25 | /** 26 | * Pass the parameters to a view in order to fill the view's details, before 27 | * the view is displayed on screen. 28 | * 29 | * @param parameters The dictionary of parameters 30 | */ 31 | -(void)setViewParameters:(NSDictionary* )parameters; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /src/Frameworks/PGControlsKit/PGDialogView.m: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | #import 17 | 18 | @implementation PGDialogView 19 | 20 | -(void)setViewParameters:(NSDictionary* )parameters { 21 | NSParameterAssert(parameters); 22 | NSLog(@"setViewParameters: %@",parameters); 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /src/Frameworks/PGControlsKit/PGHelpTextView.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | 17 | @interface PGHelpTextView : NSTextView 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /src/Frameworks/PGControlsKit/PGHelpTextView.m: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import "PGHelpTextView.h" 16 | 17 | @implementation PGHelpTextView 18 | 19 | -(void)awakeFromNib { 20 | // add margins to left/right/top/bottom 21 | [super setTextContainerInset:NSMakeSize(15.0f, 5.0f)]; 22 | } 23 | 24 | -(NSPoint)textContainerOrigin { 25 | NSPoint origin = [super textContainerOrigin]; 26 | NSPoint newOrigin = NSMakePoint(origin.x + 5.0f, origin.y); 27 | return newOrigin; 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /src/Frameworks/PGControlsKit/PGHelpWindowController.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | 17 | @interface PGHelpWindowController : NSWindowController { 18 | NSAttributedString* _text; 19 | NSMutableArray* _files; 20 | } 21 | 22 | // properties 23 | @property (retain) NSString* applicationName; 24 | @property (retain) NSString* versionNumber; 25 | @property (retain) NSString* copyrightNotice; 26 | 27 | // methods 28 | -(BOOL)addPath:(NSString* )path bundle:(NSBundle* )bundle error:(NSError** )error; 29 | -(BOOL)addResource:(NSString* )resourceName bundle:(NSBundle* )bundle error:(NSError** )error; 30 | -(void)setVisible:(BOOL)isVisible; 31 | 32 | -(BOOL)displayHelpFromMarkdownFile:(NSString* )fileName error:(NSError** )error; 33 | -(BOOL)displayHelpFromMarkdownResource:(NSString* )resourceName bundle:(NSBundle* )bundle error:(NSError** )error; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /src/Frameworks/PGControlsKit/PGOutlineView.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | 17 | @interface PGOutlineView : NSOutlineView 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /src/Frameworks/PGControlsKit/PGOutlineView.m: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | #import "PGOutlineView.h" 17 | 18 | @interface PGSourceViewController (PGOutlineViewDelegate) 19 | -(NSMenu* )menuForItem:(id)item; 20 | @end 21 | 22 | @implementation PGOutlineView 23 | 24 | -(BOOL)performKeyEquivalent:(NSEvent* )theEvent { 25 | NSString* chars = [theEvent charactersIgnoringModifiers]; 26 | if([theEvent type] == NSKeyDown && [chars length] == 1) { 27 | int val = [chars characterAtIndex:0]; 28 | // check for a delete 29 | if (val == 127 || val == 63272) { 30 | if ([[self delegate] respondsToSelector:@selector(doDeleteKeyPressed:)]) { 31 | [[self delegate] performSelector:@selector(doDeleteKeyPressed:) withObject:self]; 32 | return YES; 33 | } 34 | } 35 | } 36 | return [super performKeyEquivalent:theEvent]; 37 | } 38 | 39 | -(NSMenu* )menuForEvent:(NSEvent* )theEvent { 40 | NSPoint pt = [self convertPoint:[theEvent locationInWindow] fromView:nil]; 41 | id item = [self itemAtRow:[self rowAtPoint:pt]]; 42 | if(item && [[self delegate] isKindOfClass:[PGSourceViewController class]]) { 43 | return [(PGSourceViewController* )[self delegate] menuForItem:item]; 44 | } else { 45 | return nil; 46 | } 47 | } 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /src/Frameworks/PGControlsKit/PGSourceViewConnection.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | 17 | typedef enum { 18 | PGSourceViewConnectionIconDisconnected = 100, 19 | PGSourceViewConnectionIconConnecting, 20 | PGSourceViewConnectionIconConnected, 21 | PGSourceViewConnectionIconRejected 22 | } PGSourceViewConnectionIcon; 23 | 24 | @interface PGSourceViewConnection : PGSourceViewNode 25 | 26 | // properties 27 | @property PGSourceViewConnectionIcon iconStatus; 28 | @property NSURL* URL; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /src/Frameworks/PGControlsKit/PGSourceViewHeading.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | 17 | @interface PGSourceViewHeading : PGSourceViewNode 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /src/Frameworks/PGControlsKit/PGSourceViewHeading.m: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | #import "PGSourceViewHeading.h" 17 | 18 | @implementation PGSourceViewHeading 19 | 20 | -(BOOL)isGroupItem { 21 | return YES; 22 | } 23 | 24 | -(BOOL)isSelectable { 25 | return NO; 26 | } 27 | 28 | @end 29 | -------------------------------------------------------------------------------- /src/Frameworks/PGControlsKit/PGSourceViewNode.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | 17 | @interface PGSourceViewNode : NSObject { 18 | NSString* _name; 19 | NSMutableDictionary* _dictionary; 20 | } 21 | 22 | // constructors 23 | +(PGSourceViewNode* )headingWithName:(NSString* )name; 24 | +(PGSourceViewNode* )connectionWithURL:(NSURL* )url; 25 | +(PGSourceViewNode* )nodeFromDictionary:(NSDictionary* )dictionary; 26 | 27 | // properties 28 | @property NSString* name; 29 | @property (readonly) BOOL isGroupItem; 30 | @property (readonly) BOOL isSelectable; 31 | @property (readonly) BOOL isNameEditable; 32 | @property (readonly) BOOL isDraggable; 33 | @property (readonly) BOOL isDeletable; 34 | @property (retain) NSArray* childClasses; 35 | @property (readonly) NSDictionary* dictionary; 36 | 37 | // methods 38 | -(NSDictionary* )dictionaryWithKey:(id)key; 39 | -(NSTableCellView* )cellViewForOutlineView:(NSOutlineView* )outlineView tableColumn:(NSTableColumn* )tableColumn owner:(id)owner tag:(NSInteger)tag; 40 | -(BOOL)canAcceptDrop:(PGSourceViewNode* )node; 41 | -(void)writeToPasteboard:(NSPasteboard* )pboard; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /src/Frameworks/PGControlsKit/PGSourceViewTree.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | #import 17 | 18 | @interface PGSourceViewTree : NSObject { 19 | NSMutableDictionary* _tags; 20 | NSMutableDictionary* _children; 21 | NSInteger _counter; 22 | } 23 | 24 | // properties 25 | @property (readonly) NSUInteger count; 26 | 27 | // methods 28 | -(void)removeAllNodes; 29 | -(void)removeNode:(PGSourceViewNode* )node; 30 | -(NSInteger)addNode:(PGSourceViewNode* )node parent:(PGSourceViewNode* )parent; 31 | -(NSInteger)addNode:(PGSourceViewNode* )node parent:(PGSourceViewNode* )parent tag:(NSInteger)tag; 32 | -(PGSourceViewNode* )nodeAtIndex:(NSInteger)index parent:(PGSourceViewNode* )parent; 33 | -(NSInteger)numberOfChildrenOfParent:(PGSourceViewNode* )parent; 34 | -(PGSourceViewNode* )nodeForTag:(NSInteger)tag; 35 | -(NSInteger)tagForNode:(PGSourceViewNode* )node; 36 | -(BOOL)moveNode:(PGSourceViewNode* )node parent:(PGSourceViewNode* )parent index:(NSInteger)index; 37 | 38 | // methods - NSUserDefaults 39 | -(BOOL)loadFromUserDefaults; 40 | -(BOOL)saveToUserDefaults; 41 | 42 | @end 43 | -------------------------------------------------------------------------------- /src/Frameworks/PGControlsKit/PGSplitViewController.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | 17 | @interface PGSplitViewController : NSViewController 18 | 19 | // properties 20 | @property NSString* autosaveName; 21 | @property CGFloat minimumSize; 22 | 23 | // methods 24 | -(BOOL)setLeftView:(id)viewOrController; 25 | -(BOOL)setRightView:(id)viewOrController; 26 | -(void)addMenuItem:(NSMenuItem* )menuItem; 27 | -(void)removeAllMenuItems; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /src/Frameworks/PGControlsKit/PGTabView.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /src/Frameworks/PGControlsKit/PGTabViewController.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | 17 | //////////////////////////////////////////////////////////////////////////////// 18 | 19 | @protocol PGTabViewDelegate 20 | @required 21 | -(NSViewController* )tabView:(PGTabViewController* )tabView newViewForTag:(NSInteger)tag; 22 | @end 23 | 24 | //////////////////////////////////////////////////////////////////////////////// 25 | 26 | @interface PGTabViewController : NSViewController { 27 | NSMutableDictionary* _views; 28 | } 29 | 30 | // properties 31 | @property (weak,nonatomic) id delegate; 32 | 33 | // methods 34 | -(NSViewController* )selectViewWithTag:(NSInteger)tag; 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /src/Frameworks/PGControlsKit/PGTextFieldView.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | 17 | @interface PGTextFieldView : NSTextField 18 | 19 | @property NSRange selectedRange; 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /src/Frameworks/PGControlsKit/PGTextFieldView.m: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import "PGTextFieldView.h" 16 | 17 | @implementation PGTextFieldView 18 | 19 | -(void)drawInsertionPointInRect:(NSRect)rect color:(NSColor* )color { 20 | [[self font] set]; 21 | NSRect stringBoundsRect = [[self stringValue] boundingRectWithSize:[self bounds].size options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingDisableScreenFontSubstitution attributes:nil]; 22 | color = [color colorWithAlphaComponent:0.5]; 23 | [color set]; 24 | NSRectFillUsingOperation(stringBoundsRect,NSCompositeSourceOver); 25 | } 26 | 27 | /* 28 | 29 | -(void)drawInsertionPointInRect:(NSRect)rect color:(NSColor *)color turnedOn:(BOOL)flag{ 30 | // Call super class first. 31 | [super drawInsertionPointInRect:rect color:color turnedOn:flag]; 32 | // Then tell the view to redraw to clear a caret. 33 | if( !flag ){ 34 | [self setNeedsDisplay:YES]; 35 | } 36 | } 37 | */ 38 | 39 | -(void)drawRect:(NSRect)dirtyRect { 40 | [self drawInsertionPointInRect:[self bounds] color:[NSColor redColor]]; 41 | [super drawRect:dirtyRect]; 42 | } 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /src/Frameworks/PGDataKit/PGCSVImporter.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | 17 | @interface PGCSVImporter : NSObject 18 | 19 | // detecting table specification from URL 20 | +(BOOL)detectTableSpecificationForURL:(NSURL* )URL options:(int)options delimiter:(unichar)delimiter maxBytes:(NSUInteger)maxBytes whenDone:(void (^)(void)) callback; 21 | +(BOOL)detectTableSpecificationForURL:(NSURL* )URL options:(int)options maxBytes:(NSUInteger)maxBytes whenDone:(void (^)(void)) callback; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /src/Frameworks/PGDataKit/PGCSVImporter.m: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | #import 17 | #import "CHCSVParser.h" 18 | 19 | @implementation PGCSVImporter 20 | 21 | +(BOOL)detectTableSpecificationForURL:(NSURL* )URL options:(int)options delimiter:(unichar)delimiter maxBytes:(NSUInteger)maxBytes whenDone:(void (^)(void)) callback { 22 | CHCSVParser* parser = [[CHCSVParser alloc] initWithContentsOfCSVURL:URL]; 23 | 24 | return YES; 25 | } 26 | 27 | +(BOOL)detectTableSpecificationForURL:(NSURL* )URL options:(int)options maxBytes:(NSUInteger)maxBytes whenDone:(void (^)(void)) callback { 28 | return [self detectTableSpecificationForURL:URL options:options delimiter:',' maxBytes:maxBytes whenDone:callback]; 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /src/Frameworks/PGDataKit/PGDataKit.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | 17 | //////////////////////////////////////////////////////////////////////////////// 18 | 19 | enum { 20 | PGCSVImporterHasHeader = 0x00000001, // use line 0 as the headings 21 | PGCSVImporterIgnoreHashComments = 0x00000002, // ignore lines starting with # 22 | PGCSVImporterIgnoreCodeComments = 0x00000004, // ignore lines starting with // 23 | PGCSVImporterIgnoreComments = 0x00000006, // ignore lines starting with # or // 24 | }; 25 | 26 | //////////////////////////////////////////////////////////////////////////////// 27 | 28 | // forward class declarations 29 | @class PGCSVImporter; 30 | @class PGTableModel; 31 | 32 | // header includes 33 | #import "PGCSVImporter.h" 34 | #import "PGTableModel.h" 35 | 36 | -------------------------------------------------------------------------------- /src/Frameworks/PGDataKit/PGDataKit_mac.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.mutablelogic.$(PRODUCT_NAME:rfc1034identifier) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 0.1009.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 0.1009.0 25 | NSPrincipalClass 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/Frameworks/PGDataKit/PGTableModel.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | 17 | enum { 18 | PGTableModelTemporary = 1 19 | } PGTableModelOptions; 20 | 21 | 22 | @interface PGTableModel : NSObject 23 | 24 | // constructors 25 | -(id)initWithName:(NSString* )name; 26 | 27 | // properties 28 | @property (copy) NSString* name; 29 | @property (assign) int options; 30 | @property (readonly) NSArray* columns; 31 | 32 | // methods 33 | //-(void)appendColumn:(PGTableColumnModel* )column; 34 | 35 | @end 36 | 37 | @interface PGConnection (PGTableModelAdditions) 38 | -(BOOL)create:(PGTableModel* )model schema:(NSString* )schema options:(int)options whenDone:(void(^)(NSError* error)) callback; 39 | -(PGTableModel* )modelForTable:(NSString* )table schema:(NSString* )schema; 40 | @end 41 | 42 | -------------------------------------------------------------------------------- /src/Frameworks/PGDataKit/PGTableModel.m: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | #import 17 | 18 | @implementation PGTableModel 19 | 20 | @end 21 | -------------------------------------------------------------------------------- /src/Frameworks/PGSchemaKit/PGSchemaKit+Private.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import "PGSchemaProductNV.h" 16 | #import "PGSchemaProductOp.h" 17 | #import "PGSchemaProductOpTable.h" 18 | 19 | @interface PGSchemaManager (Private) 20 | // generate error objects 21 | +(NSError* )errorWithCode:(PGSchemaErrorType)code path:(NSString* )path description:(NSString* )description,...; 22 | +(NSError* )errorWithCode:(PGSchemaErrorType)code description:(NSString* )description,...; 23 | 24 | +(NSString* )sqlWithFormatFromStringTable:(NSString* )key attributes:(NSDictionary* )attr error:(NSError** )error; 25 | 26 | -(BOOL)_addSearchPath:(NSString* )path; 27 | -(NSArray* )_subpathsAtPath:(NSString* )path; 28 | -(NSArray* )_productsAtPath:(NSString* )path error:(NSError** )error; 29 | -(BOOL)_hasProductTableWithError:(NSError** )error; 30 | -(BOOL)_hasProductInstalled:(PGSchemaProduct* )product error:(NSError** )error; 31 | -(NSArray* )_checkDependentProductsNV:(PGSchemaProductNV* )productnv error:(NSError** )error; 32 | @end 33 | 34 | @interface PGSchemaProduct (Private) 35 | -(BOOL)_initWithPath:(NSString* )path error:(NSError** )error; 36 | @property (readonly) PGSchemaProductNV* productnv; 37 | @end 38 | -------------------------------------------------------------------------------- /src/Frameworks/PGSchemaKit/PGSchemaKit.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | #import 17 | 18 | // externs 19 | extern NSString* PGSchemaErrorDomain; 20 | extern NSString* PGSchemaFileExtension; 21 | 22 | // typedefs 23 | typedef enum { 24 | PGSchemaErrorMissingDTD = 100, 25 | PGSchemaErrorParse = 101, 26 | PGSchemaErrorSearchPath = 102, 27 | PGSchemaErrorDependency = 103, 28 | PGSchemaErrorDatabase = 104, 29 | PGSchemaErrorInternal = 105 30 | } PGSchemaErrorType; 31 | 32 | // forward class declarations 33 | @class PGSchemaProduct; 34 | @class PGSchemaManager; 35 | 36 | // header includes 37 | #import "PGSchemaManager.h" 38 | #import "PGSchemaProduct.h" 39 | 40 | -------------------------------------------------------------------------------- /src/Frameworks/PGSchemaKit/PGSchemaKit.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.mutablelogic.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 0.1008.19 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 0.1008.19 25 | NSPrincipalClass 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/Frameworks/PGSchemaKit/PGSchemaKitSQL.strings: -------------------------------------------------------------------------------- 1 | 2 | "PGSchemaHasTable" = " 3 | SELECT 4 | table_catalog,table_schema,table_name,table_type 5 | FROM 6 | information_schema.tables 7 | WHERE 8 | table_catalog=$1 9 | AND 10 | table_schema=$2 11 | AND 12 | table_name=$3 13 | "; 14 | 15 | "PGSchemaProductOpTableCreate" = " 16 | CREATE TABLE IF NOT EXISTS $schema$.$name$ ( 17 | $cdata$ 18 | ); 19 | "; 20 | -------------------------------------------------------------------------------- /src/Frameworks/PGSchemaKit/PGSchemaManager.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | @interface PGSchemaManager : NSObject { 16 | PGConnection* _connection; 17 | NSString* _sysschema; 18 | NSString* _usrschema; 19 | NSMutableArray* _searchpath; 20 | NSMutableDictionary* _products; 21 | } 22 | 23 | // constructor 24 | -(id)initWithConnection:(PGConnection* )connection userSchema:(NSString* )usrschema systemSchema:(NSString* )sysschema; 25 | -(id)initWithConnection:(PGConnection* )connection userSchema:(NSString* )usrschema; 26 | 27 | // properties 28 | @property (readonly) NSString* systemSchema; 29 | @property (readonly) NSString* userSchema; 30 | @property (readonly) NSArray* products; 31 | @property (readonly) PGConnection* connection; 32 | 33 | // methods 34 | +(NSArray* )defaultSearchPath; 35 | -(BOOL)addSearchPath:(NSString* )path error:(NSError** )error; 36 | -(BOOL)addSearchPath:(NSString* )path recursive:(BOOL)isRecursive error:(NSError** )error; 37 | -(BOOL)create:(PGSchemaProduct* )product dryrun:(BOOL)isDryrun error:(NSError** )error; 38 | -(BOOL)update:(PGSchemaProduct* )product dryrun:(BOOL)isDryrun error:(NSError** )error; 39 | -(BOOL)drop:(PGSchemaProduct* )product dryrun:(BOOL)isDryrun error:(NSError** )error; 40 | @end 41 | -------------------------------------------------------------------------------- /src/Frameworks/PGSchemaKit/PGSchemaProduct.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | @interface PGSchemaProduct : NSObject { 16 | id _productnv; // returns PGSchemaProductNV* 17 | NSString* _comment; 18 | NSMutableArray* _requires; // array of PGSchemaProductNV* 19 | NSMutableArray* _create; // array of PGSchemaProductOp* 20 | NSMutableArray* _update; // array of PGSchemaProductOp* 21 | NSMutableArray* _drop; // array of PGSchemaProductOp* 22 | } 23 | 24 | // constructors 25 | -(id)initWithPath:(NSString* )path error:(NSError** )error; 26 | +(PGSchemaProduct* )schemaWithPath:(NSString* )path error:(NSError** )error; 27 | 28 | // properties 29 | @property (readonly) NSString* name; 30 | @property (readonly) NSUInteger version; 31 | @property (readonly) NSString* comment; 32 | @property (readonly) NSArray* requires; 33 | @property (readonly) NSString* key; 34 | 35 | // methods 36 | -(BOOL)createWithConnection:(PGConnection* )connection dryrun:(BOOL)isDryrun error:(NSError** )error; 37 | -(BOOL)updateWithConnection:(PGConnection* )connection dryrun:(BOOL)isDryrun error:(NSError** )error; 38 | -(BOOL)dropWithConnection:(PGConnection* )connection dryrun:(BOOL)isDryrun error:(NSError** )error; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /src/Frameworks/PGSchemaKit/PGSchemaProductNV.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | @interface PGSchemaProductNV : NSObject { 16 | NSString* _name; 17 | NSUInteger _version; 18 | } 19 | 20 | // constructors 21 | -(id)initWithXMLNode:(NSXMLElement* )node; 22 | -(id)initWithName:(NSString* )name version:(NSUInteger)version; 23 | 24 | // properties 25 | @property (readonly) NSString* name; 26 | @property (readonly) NSUInteger version; 27 | @property (readonly) NSString* key; 28 | 29 | @end 30 | -------------------------------------------------------------------------------- /src/Frameworks/PGSchemaKit/PGSchemaProductOp.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | @interface PGSchemaProductOp : NSObject { 16 | NSDictionary* _attributes; 17 | } 18 | 19 | // constructors 20 | +(PGSchemaProductOp* )operationWithXMLNode:(NSXMLElement* )node; 21 | -(id)initWithXMLNode:(NSXMLElement* )node; 22 | 23 | // properties 24 | @property (readonly) NSDictionary* attributes; 25 | 26 | // methods 27 | -(BOOL)createWithConnection:(PGConnection* )connection dryrun:(BOOL)isDryrun error:(NSError** )error; 28 | -(BOOL)updateWithConnection:(PGConnection* )connection dryrun:(BOOL)isDryrun error:(NSError** )error; 29 | -(BOOL)dropWithConnection:(PGConnection* )connection dryrun:(BOOL)isDryrun error:(NSError** )error; 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /src/Frameworks/PGSchemaKit/PGSchemaProductOpTable.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | @interface PGSchemaProductOpTable : PGSchemaProductOp 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /src/Frameworks/PGSchemaKit/PGSchemaProductOpTable.m: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import "PGSchemaKit.h" 16 | #import "PGSchemaKit+Private.h" 17 | 18 | @implementation PGSchemaProductOpTable 19 | 20 | -(BOOL)createWithConnection:(PGConnection* )connection dryrun:(BOOL)isDryrun error:(NSError** )error { 21 | if(isDryrun) { 22 | // TODO: check to make sure table is not created 23 | } else { 24 | NSString* statement = [PGSchemaManager sqlWithFormat:@"PGSchemaProductOpTableCreate" attributes:[self attributes] error:error]; 25 | if(statement==nil) { 26 | return NO; 27 | } 28 | NSLog(@"TODO: Create %@",statement); 29 | } 30 | return YES; 31 | } 32 | 33 | -(BOOL)updateWithConnection:(PGConnection* )connection dryrun:(BOOL)isDryrun error:(NSError** )error { 34 | NSLog(@"TODO: Update %@",self); 35 | return NO; 36 | } 37 | 38 | -(BOOL)dropWithConnection:(PGConnection* )connection dryrun:(BOOL)isDryrun error:(NSError** )error { 39 | NSLog(@"TODO: Drop %@",self); 40 | return NO; 41 | } 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /src/Frameworks/PGSchemaKit/pgschema.base.schema.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Provides product and serial number services for all postgresql-kit 5 | functionality, see https://github.com/djthorpe/postgresql-kit/wiki 6 | for more information. 7 | 8 | 9 | 10 | product CHAR(80) NOT NULL, 11 | schema CHAR(80) NOT NULL, 12 | version INTEGER NOT NULL, 13 | comment VARCHAR(200), 14 | stamp TIMESTAMP NOT NULL, 15 | PRIMARY KEY (product,version) 16 | 17 | 18 | schema CHAR(80) NOT NULL, 19 | class CHAR(32) NOT NULL, 20 | serial INTEGER NOT NULL DEFAULT 0, 21 | PRIMARY KEY (class), 22 | CONSTRAINT CHECK (CHAR_LENGTH(class) > 0), 23 | CONSTRAINT CHECK (serial > 0) 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /src/Frameworks/PGSchemaKit/pgschema.dtd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 25 | 26 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /src/Frameworks/PGServerKit/PGServer+Private.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | @interface PGServer (Private) 16 | +(NSString* )_bundlePath; 17 | +(NSString* )_serverBinary; 18 | +(NSString* )_initBinary; 19 | +(NSString* )_libraryPath; 20 | +(NSString* )_dumpBinary; 21 | -(void)_delegateMessage:(NSString* )message; 22 | -(void)_delegateMessageFromData:(NSData* )theData; 23 | @end -------------------------------------------------------------------------------- /src/Frameworks/PGServerKit/PGServerKit.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | 17 | typedef enum { 18 | PGServerStateUnknown = 0, 19 | PGServerStateAlreadyRunning0, // server is already running - get PID 20 | PGServerStateAlreadyRunning, // server is already running 21 | PGServerStateIgnition, // fire up the database 22 | PGServerStateInitialize, // initializing the data directory 23 | PGServerStateInitializing, // initializing the data directory 24 | PGServerStateInitialized,// initialized the data directory 25 | PGServerStateStarting, // starting the server 26 | PGServerStateRunning0, // server is running - get PID 27 | PGServerStateRunning, // server is running 28 | PGServerStateStopping, // stopping the server 29 | PGServerStateStopped, // stopped the server without error 30 | PGServerStateRestart, // signal to restart the server 31 | PGServerStateError // error occurred 32 | } PGServerState; 33 | 34 | // forward class declarations 35 | @class PGServer; 36 | 37 | // PGServerDelegate protocol 38 | @protocol PGServerDelegate 39 | @optional 40 | -(void)pgserver:(PGServer* )sender stateChange:(PGServerState)state; 41 | -(void)pgserver:(PGServer* )sender message:(NSString* )message; 42 | @end 43 | 44 | // include public header files 45 | #import "PGServer.h" 46 | 47 | -------------------------------------------------------------------------------- /src/Frameworks/PGServerKit/PGServerKit.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | 11 | CFBundleIdentifier 12 | com.mutablelogic.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | FMWK 19 | CFBundleShortVersionString 20 | 0.1009.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 0.1009.0 25 | NSPrincipalClass 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /src/UnitTests/PGClientKit_unittests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.mutablelogic.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/UnitTests/PGClientKit_unittests/PGClientKit_tests.m: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | #import 17 | #import 18 | 19 | //////////////////////////////////////////////////////////////////////////////// 20 | 21 | @interface PGClientKit_tests : XCTestCase 22 | 23 | @end 24 | 25 | //////////////////////////////////////////////////////////////////////////////// 26 | 27 | @implementation PGClientKit_tests 28 | 29 | - (void)setUp { 30 | [super setUp]; 31 | // Put setup code here. This method is called before the invocation of each test method in the class. 32 | } 33 | 34 | - (void)tearDown { 35 | // Put teardown code here. This method is called after the invocation of each test method in the class. 36 | [super tearDown]; 37 | } 38 | 39 | /* 40 | - (void)testExample { 41 | // This is an example of a functional test case. 42 | XCTAssert(YES, @"Pass"); 43 | } 44 | 45 | - (void)testPerformanceExample { 46 | // This is an example of a performance test case. 47 | [self measureBlock:^{ 48 | // Put the code you want to measure the time of here. 49 | }]; 50 | } 51 | */ 52 | 53 | @end 54 | -------------------------------------------------------------------------------- /src/UnitTests/PGControlsKit_testcases/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.mutablelogic.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/UnitTests/PGFoundationServer.h: -------------------------------------------------------------------------------- 1 | 2 | // Copyright 2009-2015 David Thorpe 3 | // https://github.com/djthorpe/postgresql-kit 4 | // 5 | // Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 | // use this file except in compliance with the License. You may obtain a copy 7 | // of the License at http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 11 | // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 12 | // License for the specific language governing permissions and limitations 13 | // under the License. 14 | 15 | #import 16 | #import 17 | 18 | @interface PGFoundationServer : NSObject { 19 | PGServer* _server; 20 | BOOL _stop; 21 | } 22 | 23 | // static methods 24 | +(NSString* )defaultDataPath; 25 | 26 | // constructor 27 | -(id)init; 28 | -(id)initWithServer:(PGServer* )server; 29 | 30 | // properties 31 | @property (readonly) BOOL isStarted; 32 | @property (readonly) BOOL isStopped; 33 | @property (readonly) BOOL isError; 34 | @property (readonly) NSString* dataPath; 35 | @property (readonly) int pid; 36 | @property (readonly) NSUInteger port; 37 | 38 | // methods 39 | -(BOOL)start; 40 | -(BOOL)startWithPort:(NSUInteger)port; 41 | -(BOOL)stop; 42 | -(BOOL)deleteData; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /src/UnitTests/PGServerKit_testcases/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | com.mutablelogic.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /tar/CHCSVParser-2.1.0/CHCSVParser.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |spec| 2 | spec.name = "CHCSVParser" 3 | spec.version = "2.1.0" 4 | spec.summary = "A proper CSV parser for Objective-C" 5 | spec.description = <<-DESC 6 | A robust class for reading and writing delimited files in Cocoa. 7 | DESC 8 | spec.homepage = "https://github.com/davedelong/CHCSVParser" 9 | spec.license = { :type => 'MIT', :file => 'LICENSE.txt' } 10 | spec.author = "Dave DeLong" 11 | spec.social_media_url = "http://twitter.com/davedelong" 12 | spec.ios.deployment_target = "6.0" 13 | spec.osx.deployment_target = "10.7" 14 | spec.source = { :git => "https://github.com/davedelong/CHCSVParser.git", :tag => "2.1.0" } 15 | spec.source_files = "CHCSVParser/CHCSVParser/CHCSVParser.{h,m}" 16 | spec.requires_arc = true 17 | end 18 | -------------------------------------------------------------------------------- /tar/CHCSVParser-2.1.0/LICENSE.txt: -------------------------------------------------------------------------------- 1 | CHCSVParser 2 | 3 | Copyright (c) 2014 Dave DeLong 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /tar/CHCSVParser-2.1.0/Unit Tests/Unit Tests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.yourcompany.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /tar/CHCSVParser-2.1.0/Unit Tests/UnitTestContent.h: -------------------------------------------------------------------------------- 1 | // 2 | // UnitTestContent.h 3 | // CHCSVParser 4 | // 5 | // Created by Dave DeLong on 5/5/13. 6 | // 7 | // 8 | 9 | #define EMPTY @"" 10 | #define COMMA @"," 11 | #define SEMICOLON @";" 12 | #define DOUBLEQUOTE @"\"" 13 | #define NEWLINE @"\n" 14 | #define SPACE @" " 15 | #define BACKSLASH @"\\" 16 | #define OCTOTHORPE @"#" 17 | #define EQUAL @"=" 18 | 19 | #define FIELD1 @"field1" 20 | #define FIELD2 @"field2" 21 | #define FIELD3 @"field3" 22 | #define UTF8FIELD4 @"ḟīễłđ➃" 23 | 24 | #define QUOTED_FIELD1 DOUBLEQUOTE FIELD1 DOUBLEQUOTE 25 | #define QUOTED_FIELD2 DOUBLEQUOTE FIELD2 DOUBLEQUOTE 26 | #define QUOTED_FIELD3 DOUBLEQUOTE FIELD3 DOUBLEQUOTE 27 | 28 | #define MULTILINE_FIELD FIELD1 NEWLINE FIELD2 -------------------------------------------------------------------------------- /tar/CHCSVParser-2.1.0/Unit Tests/UnitTests.h: -------------------------------------------------------------------------------- 1 | // 2 | // UnitTests.h 3 | // CHCSVParser 4 | /** 5 | Copyright (c) 2014 Dave DeLong 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | THE SOFTWARE. 24 | **/ 25 | 26 | #import 27 | 28 | 29 | @interface UnitTests : XCTestCase 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /tar/GBCli-1.1/GBCli.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = 'GBCli' 3 | s.version = '1.1' 4 | s.summary = 'Objective C foundation tool command line interface library.' 5 | s.homepage = 'http://github.com/tomaz/GBCli' 6 | s.license = 'MIT' 7 | s.author = { 'Tomaz Kragelj' => 'tkragelj@gmail.com' } 8 | s.source = { :git => 'https://github.com/tomaz/GBCli.git', :tag => '1.1' } 9 | s.platform = :osx, '10.8' 10 | s.source_files = 'GBCli/src' 11 | s.requires_arc = true 12 | end 13 | -------------------------------------------------------------------------------- /tar/GBCli-1.1/GBCli/GBCli-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header for all source files of the 'GBCli' target in the 'GBCli' project 3 | // 4 | 5 | #ifdef __OBJC__ 6 | #import 7 | #endif 8 | -------------------------------------------------------------------------------- /tar/GBCli-1.1/GBCli/GBSettings+Application.m: -------------------------------------------------------------------------------- 1 | // 2 | // GbSettings+Application.m 3 | // GBCli 4 | // 5 | // Created by Tomaž Kragelj on 3/15/12. 6 | // Copyright (c) 2012 __MyCompanyName__. All rights reserved. 7 | // 8 | 9 | #import "GBSettings+Application.h" 10 | 11 | @implementation GBSettings (Application) 12 | 13 | #pragma mark - Initialization & disposal 14 | 15 | + (instancetype)mySettingsWithName:(NSString *)name parent:(GBSettings *)parent { 16 | id result = [self settingsWithName:name parent:parent]; 17 | if (result) { 18 | [result registerArrayForKey:GBSettingKeys.inputPaths]; 19 | [result registerArrayForKey:GBSettingKeys.outputPaths]; 20 | } 21 | return result; 22 | } 23 | 24 | #pragma mark - Project information 25 | 26 | GB_SYNTHESIZE_COPY(NSString *, projectName, setProjectName, GBSettingKeys.projectName) 27 | GB_SYNTHESIZE_COPY(NSString *, projectVersion, setProjectVersion, GBSettingKeys.projectVersion) 28 | 29 | #pragma mark - Paths 30 | 31 | GB_SYNTHESIZE_OBJECT(NSArray *, inputPaths, setInputPaths, GBSettingKeys.inputPaths) 32 | GB_SYNTHESIZE_OBJECT(NSArray *, outputPaths, setOutputPaths, GBSettingKeys.outputPaths) 33 | 34 | #pragma mark - Debugging aid 35 | 36 | GB_SYNTHESIZE_BOOL(printSettings, setPrintSettings, GBSettingKeys.printSettings) 37 | GB_SYNTHESIZE_BOOL(printVersion, setPrintVersion, GBSettingKeys.printVersion) 38 | GB_SYNTHESIZE_BOOL(printHelp, setPrintHelp, GBSettingKeys.printHelp) 39 | 40 | @end 41 | 42 | #pragma mark - 43 | 44 | @implementation GBSettings (Helpers) 45 | 46 | - (void)applyFactoryDefaults { 47 | self.projectVersion = @"1.0"; 48 | self.printSettings = NO; 49 | } 50 | 51 | @end 52 | 53 | #pragma mark - 54 | 55 | const struct GBSettingKeys GBSettingKeys = { 56 | .projectName = @"project-name", 57 | .projectVersion = @"project-version", 58 | .inputPaths = @"input", 59 | .outputPaths = @"output", 60 | .printSettings = @"print-settings", 61 | .printVersion = @"version", 62 | .printHelp = @"help", 63 | }; -------------------------------------------------------------------------------- /tar/GBCli-1.1/GBCli/src/GBCli.h: -------------------------------------------------------------------------------- 1 | // 2 | // GBCli.h 3 | // GBCli 4 | // 5 | // Created by Tomaz Kragelj on 23.05.14. 6 | // 7 | // 8 | 9 | // Imports all source files for GBCli 10 | 11 | #import "GBCommandLineParser.h" 12 | #import "GBSettings.h" 13 | #import "GBOptionsHelper.h" 14 | #import "GBPrint.h" 15 | -------------------------------------------------------------------------------- /tar/GBCli-1.1/GBCli/src/GBPrint.h: -------------------------------------------------------------------------------- 1 | // 2 | // GBPrint.h 3 | // GBCli 4 | // 5 | // Created by Tomaz Kragelj on 23.05.14. 6 | // 7 | // 8 | 9 | #import 10 | 11 | extern void gbprint(NSString *format, ...); 12 | extern void gbprintln(NSString *format, ...); 13 | extern void gbfprint(FILE *file, NSString *format, ...); 14 | extern void gbfprintln(FILE *file, NSString *format, ...); 15 | -------------------------------------------------------------------------------- /tar/GBCli-1.1/GBCli/src/GBPrint.m: -------------------------------------------------------------------------------- 1 | // 2 | // GBPrint.m 3 | // GBCli 4 | // 5 | // Created by Tomaz Kragelj on 23.05.14. 6 | // 7 | // 8 | 9 | #import "GBPrint.h" 10 | 11 | static void gb_printf_worker(FILE *file, NSString *format, va_list arguments) { 12 | NSString *msg = [[NSString alloc] initWithFormat:format arguments:arguments]; 13 | fprintf(file, "%s", [msg UTF8String]); 14 | } 15 | 16 | void gbprint(NSString *format, ...) { 17 | va_list arguments; 18 | va_start(arguments, format); 19 | gb_printf_worker(stdout, format, arguments); 20 | va_end(arguments); 21 | } 22 | 23 | void gbprintln(NSString *format, ...) { 24 | va_list arguments; 25 | va_start(arguments, format); 26 | format = [format stringByAppendingString:@"\n"]; 27 | gb_printf_worker(stdout, format, arguments); 28 | va_end(arguments); 29 | } 30 | 31 | void gbfprint(FILE *file, NSString *format, ...) { 32 | va_list arguments; 33 | va_start(arguments, format); 34 | gb_printf_worker(file, format, arguments); 35 | va_end(arguments); 36 | } 37 | 38 | void gbfprintln(FILE *file, NSString *format, ...) { 39 | va_list arguments; 40 | va_start(arguments, format); 41 | format = [format stringByAppendingString:@"\n"]; 42 | gb_printf_worker(file, format, arguments); 43 | va_end(arguments); 44 | } 45 | -------------------------------------------------------------------------------- /tar/GBCli-1.1/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2012 by Tomaz Kragelj 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. -------------------------------------------------------------------------------- /tar/MMMarkdown-0.4.1/LICENSE.md: -------------------------------------------------------------------------------- 1 | **Copyright (c) 2012-2013 Matt Diephouse** 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of 4 | this software and associated documentation files (the "Software"), to deal in 5 | the Software without restriction, including without limitation the rights to 6 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 7 | the Software, and to permit persons to whom the Software is furnished to do so, 8 | subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 15 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 16 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 17 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 18 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 19 | -------------------------------------------------------------------------------- /tar/MMMarkdown-0.4.1/RELEASE_NOTES.md: -------------------------------------------------------------------------------- 1 | # MMMarkdown Release Notes 2 | 3 | ## 0.4.1 4 | Fix an exception when whitespace preceded what would otherwise be a header ([#47](https://github.com/mdiep/MMMarkdown/issues/47)). 5 | 6 | ## 0.4 7 | This release adds support for GitHub-flavored Markdown and extensions. It also includes bug fixes, updated Xcode project settings, and more modernization. 8 | 9 | ## 0.3 10 | This release adds an HTML parser, which is needed to properly handle HTML inside Markdown. It also removes the precompiled libraries in favor of including the project. 11 | 12 | Other changes include: 13 | 14 | - Support newer iOS architectures 15 | - Fix a crash when passed an empty string 16 | - Fix code spans with multiple backticks 17 | - Fix code spans that contain newlines 18 | - Fix handling of images with no alt text 19 | - Annotate that the markdown can't be nil 20 | - Fix behavior of archive builds 21 | - Update Xcode project settings 22 | - Modernize the code 23 | 24 | ## 0.2.3 25 | Fix the iOS deployment target and static library to support iOS 5.0. 26 | 27 | ## 0.2.2 28 | Updated the iOS static library to include armv7s architecture. 29 | 30 | ## 0.2.1 31 | Bugfix release that fixes 2 issues: 32 | 33 | - Add support for alternate ASCII line endings (\r\n and \r) 34 | - Fix a crash when list items have leading spaces beyond their 35 | indentation level 36 | 37 | ## 0.2 - Correctness 38 | This release focused on expanding the test suite and fixing bugs. Many bugs were fixed and support for the Markdown image syntax was added. 39 | 40 | ## 0.1 41 | The initial release of MMMarkdown. Implemented enough of markdown to pass all of Gruber's tests. 42 | -------------------------------------------------------------------------------- /tar/MMMarkdown-0.4.1/Source/MMDocument.h: -------------------------------------------------------------------------------- 1 | // 2 | // MMDocument.h 3 | // MMMarkdown 4 | // 5 | // Copyright (c) 2012 Matt Diephouse. 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | // 25 | 26 | #import 27 | 28 | 29 | @interface MMDocument : NSObject 30 | 31 | @property (strong, nonatomic, readonly) NSString *markdown; 32 | @property (copy, nonatomic, readonly) NSArray *elements; 33 | 34 | + (id)documentWithMarkdown:(NSString *)markdown; 35 | - (id)initWithMarkdown:(NSString *)markdown; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /tar/MMMarkdown-0.4.1/Source/MMDocument_Private.h: -------------------------------------------------------------------------------- 1 | // 2 | // MMDocument_Private.h 3 | // MMMarkdown 4 | // 5 | // Copyright (c) 2012 Matt Diephouse. 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | // 25 | 26 | #import "MMDocument.h" 27 | 28 | 29 | @class MMElement; 30 | 31 | @interface MMDocument (MMDocumentPrivate) 32 | 33 | @property (copy, nonatomic) NSArray *elements; 34 | 35 | - (void)addElement:(MMElement *)anElement; 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /tar/MMMarkdown-0.4.1/Source/MMGenerator.h: -------------------------------------------------------------------------------- 1 | // 2 | // MMGenerator.h 3 | // MMMarkdown 4 | // 5 | // Copyright (c) 2012 Matt Diephouse. 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | // 25 | 26 | #import 27 | 28 | 29 | @class MMDocument; 30 | 31 | @interface MMGenerator : NSObject 32 | 33 | - (NSString *)generateHTML:(MMDocument *)aDocument; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /tar/MMMarkdown-0.4.1/Source/MMHTMLParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // MMHTMLParser.h 3 | // MMMarkdown 4 | // 5 | // Copyright (c) 2012 Matt Diephouse. 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | // 25 | 26 | #import 27 | 28 | 29 | @class MMElement; 30 | @class MMScanner; 31 | 32 | @interface MMHTMLParser : NSObject 33 | 34 | - (MMElement *)parseBlockTagWithScanner:(MMScanner *)scanner; 35 | - (MMElement *)parseCommentWithScanner:(MMScanner *)scanner; 36 | - (MMElement *)parseInlineTagWithScanner:(MMScanner *)scanner; 37 | 38 | @end 39 | -------------------------------------------------------------------------------- /tar/MMMarkdown-0.4.1/Source/MMParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // MMParser.h 3 | // MMMarkdown 4 | // 5 | // Copyright (c) 2012 Matt Diephouse. 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | // 25 | 26 | #import 27 | 28 | 29 | #import "MMMarkdown.h" 30 | 31 | @class MMDocument; 32 | 33 | @interface MMParser : NSObject 34 | 35 | - (id)initWithExtensions:(MMMarkdownExtensions)extensions; 36 | 37 | - (MMDocument *)parseMarkdown:(NSString *)markdown error:(__autoreleasing NSError **)error; 38 | 39 | @end 40 | -------------------------------------------------------------------------------- /tar/MMMarkdown-0.4.1/Source/MMSpanParser.h: -------------------------------------------------------------------------------- 1 | // 2 | // MMSpanParser.h 3 | // MMMarkdown 4 | // 5 | // Copyright (c) 2012 Matt Diephouse. 6 | // 7 | // Permission is hereby granted, free of charge, to any person obtaining a copy 8 | // of this software and associated documentation files (the "Software"), to deal 9 | // in the Software without restriction, including without limitation the rights 10 | // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | // copies of the Software, and to permit persons to whom the Software is 12 | // furnished to do so, subject to the following conditions: 13 | // 14 | // The above copyright notice and this permission notice shall be included in 15 | // all copies or substantial portions of the Software. 16 | // 17 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | // THE SOFTWARE. 24 | // 25 | 26 | #import 27 | 28 | 29 | #import "MMMarkdown.h" 30 | #import "MMParser.h" 31 | 32 | @class MMElement; 33 | @class MMScanner; 34 | 35 | @interface MMSpanParser : NSObject 36 | 37 | - (id)initWithExtensions:(MMMarkdownExtensions)extensions; 38 | 39 | - (NSArray *)parseSpansInBlockElement:(MMElement *)block withScanner:(MMScanner *)scanner; 40 | 41 | - (NSArray *)parseSpansInTableColumns:(NSArray *)columns withScanner:(MMScanner *)scanner; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /tar/openssl-1.0.1j.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djthorpe/postgresql-kit/4622eb1a9a969e4f3342111fe3c13d565a215f56/tar/openssl-1.0.1j.tar.gz -------------------------------------------------------------------------------- /tar/postgresql-9.4.0.tar.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/djthorpe/postgresql-kit/4622eb1a9a969e4f3342111fe3c13d565a215f56/tar/postgresql-9.4.0.tar.gz -------------------------------------------------------------------------------- /tar/sskeychain-1.2.0/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2010-2013 Sam Soffes. 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /tar/sskeychain-1.2.0/SSKeychain/en.lproj/SSKeychain.strings: -------------------------------------------------------------------------------- 1 | /* SSKeychainQuery */ 2 | "SSKeychainErrorBadArguments" = "Some of the arguments were invalid"; 3 | "errSecUnimplemented" = "Function or operation not implemented"; 4 | "errSecParam" = "One or more parameters passed to a function were not valid"; 5 | "errSecAllocate" = "Failed to allocate memory"; 6 | "errSecNotAvailable" = "No keychain is available. You may need to restart your computer"; 7 | "errSecDuplicateItem" = "The specified item already exists in the keychain"; 8 | "errSecItemNotFound" = "The specified item could not be found in the keychain"; 9 | "errSecInteractionNotAllowed" = "User interaction is not allowed"; 10 | "errSecDecode" = "Unable to decode the provided data"; 11 | "errSecAuthFailed" = "The user name or passphrase you entered is not correct"; 12 | "errSecDefault" = "Refer to SecBase.h for description"; 13 | --------------------------------------------------------------------------------