Created
March 31, 2017 23:21
-
-
Save Willshaw/621a15502a3a3d6c1d66d6e46079988d to your computer and use it in GitHub Desktop.
Simple Script for Local Development to setup coldfusion datasources
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
writeOutput('starting db source installation...<br/ >'); | |
function createDSN( name ) { | |
// Login is always required. This example uses two lines of code. | |
adminObj = createObject("component","cfide.adminapi.administrator"); | |
adminObj.login("pete", "admin"); | |
// Instantiate the data source object. | |
myObj = createObject("component","cfide.adminapi.datasource"); | |
// Create a DSN. | |
myObj.setMYSQL5( | |
name="dsn#ARGUMENTS.name#", | |
host="127.0.0.1", | |
database=ARGUMENTS.name, | |
username="pete", | |
password="pete" | |
); | |
writeOutput('<br />created #ARGUMENTS.name# datasource'); | |
} | |
arr_names = [ | |
'books', | |
'authors' | |
]; | |
for( name in arr_names ) { | |
createDSN( name ); | |
} | |
writeOutput('<br />completed'); | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I need to check my chrome history to find the person who's code I modified to make this - credit must be given