Browse Source

Refactor database drivers

Maurits van der Schee 8 years ago
parent
commit
5d9f051024
2 changed files with 16 additions and 12 deletions
  1. 11
    10
      README.md
  2. 5
    2
      api.php

+ 11
- 10
README.md View File

46
 Edit the following lines in the bottom of the file "api.php":
46
 Edit the following lines in the bottom of the file "api.php":
47
 
47
 
48
 ```
48
 ```
49
-$api = new MySQL_CRUD_API(array(
50
-	'username'=>'xxx',
49
+$api = new PHP_CRUD_API(array(
50
+  'username'=>'xxx',
51
 	'password'=>'xxx',
51
 	'password'=>'xxx',
52
-	'database'=>'xxx'
52
+	'database'=>'xxx',
53
 ));
53
 ));
54
 $api->executeCommand();
54
 $api->executeCommand();
55
 ```
55
 ```
57
 These are all the configuration options and their default values:
57
 These are all the configuration options and their default values:
58
 
58
 
59
 ```
59
 ```
60
-$api = new MySQL_CRUD_API(array(
61
-	'username=>'root'
60
+$api = new PHP_CRUD_API(array(
61
+  'dbengine=>'MySQL',
62
+  'username=>'root',
62
 	'password=>null,
63
 	'password=>null,
63
 	'database=>false,
64
 	'database=>false,
64
 // for connectivity (defaults to localhost):
65
 // for connectivity (defaults to localhost):
74
 	'input_sanitizer'=>function($cmd,$db,$tab,$col,$typ,$val) { return $val; },
75
 	'input_sanitizer'=>function($cmd,$db,$tab,$col,$typ,$val) { return $val; },
75
 	'input_validator'=>function($cmd,$db,$tab,$col,$typ,$val,$ctx) { return true; },
76
 	'input_validator'=>function($cmd,$db,$tab,$col,$typ,$val,$ctx) { return true; },
76
 // dependencies (added for unit testing):
77
 // dependencies (added for unit testing):
77
-	'db'=>null,
78
-	'method'=>$_SERVER['REQUEST_METHOD'],
78
+  'db'=>null,
79
+  'method'=>$_SERVER['REQUEST_METHOD'],
79
 	'request'=>$_SERVER['PATH_INFO'],
80
 	'request'=>$_SERVER['PATH_INFO'],
80
 	'get'=>$_GET,
81
 	'get'=>$_GET,
81
 	'post'=>'php://input',
82
 	'post'=>'php://input',
578
 $
579
 $
579
 ```
580
 ```
580
 
581
 
581
-NB: You MUST use an empty database as a desctructive database fixture ('blog.mysql') is loaded.
582
+NB: You MUST use an empty database as a desctructive database fixture ('blog_mysql.sql') is loaded.
582
 
583
 
583
 ### SQL server on Windows:
584
 ### SQL server on Windows:
584
 
585
 
594
 C:\mysql-crud-api-master>
595
 C:\mysql-crud-api-master>
595
 ```
596
 ```
596
 
597
 
597
-NB: You MUST use an empty database as a desctructive database fixture ('blog.mssql') is loaded.
598
+NB: You MUST use an empty database as a desctructive database fixture ('blog_sqlserver.sql') is loaded.
598
 
599
 
599
 ### PostgreSQL on Linux
600
 ### PostgreSQL on Linux
600
 
601
 
611
 $
612
 $
612
 ```
613
 ```
613
 
614
 
614
-NB: You MUST use an empty database as a desctructive database fixture ('blog.pgsql') is loaded.
615
+NB: You MUST use an empty database as a desctructive database fixture ('blog_postgresql.sql') is loaded.
615
 
616
 
616
 ## Pretty URL
617
 ## Pretty URL
617
 
618
 

+ 5
- 2
api.php View File

1340
 // uncomment the lines below when running in stand-alone mode:
1340
 // uncomment the lines below when running in stand-alone mode:
1341
 
1341
 
1342
 // $api = new PHP_CRUD_API(array(
1342
 // $api = new PHP_CRUD_API(array(
1343
+// 	'dbengine'=>'MySQL',
1343
 // 	'hostname'=>'localhost',
1344
 // 	'hostname'=>'localhost',
1344
 //	'username'=>'xxx',
1345
 //	'username'=>'xxx',
1345
 //	'password'=>'xxx',
1346
 //	'password'=>'xxx',
1348
 // ));
1349
 // ));
1349
 // $api->executeCommand();
1350
 // $api->executeCommand();
1350
 
1351
 
1351
-// For Microsoft SQL Server use:
1352
+// For Microsoft SQL Server 2012 use:
1352
 
1353
 
1353
 // $api = new PHP_CRUD_API(array(
1354
 // $api = new PHP_CRUD_API(array(
1355
+// 	'dbengine'=>'SQLServer',
1354
 // 	'hostname'=>'(local)',
1356
 // 	'hostname'=>'(local)',
1355
 // 	'username'=>'',
1357
 // 	'username'=>'',
1356
 // 	'password'=>'',
1358
 // 	'password'=>'',
1359
 // ));
1361
 // ));
1360
 // $api->executeCommand();
1362
 // $api->executeCommand();
1361
 
1363
 
1362
-// For PostgreSQL use:
1364
+// For PostgreSQL 9 use:
1363
 
1365
 
1364
 // $api = new PHP_CRUD_API(array(
1366
 // $api = new PHP_CRUD_API(array(
1367
+// 	'dbengine'=>'PostgreSQL',
1365
 // 	'hostname'=>'localhost',
1368
 // 	'hostname'=>'localhost',
1366
 // 	'username'=>'xxx',
1369
 // 	'username'=>'xxx',
1367
 // 	'password'=>'xxx',
1370
 // 	'password'=>'xxx',

Loading…
Cancel
Save