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,10 +46,10 @@ This is a single file application! Upload "api.php" somewhere and enjoy!
46 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 51
 	'password'=>'xxx',
52
-	'database'=>'xxx'
52
+	'database'=>'xxx',
53 53
 ));
54 54
 $api->executeCommand();
55 55
 ```
@@ -57,8 +57,9 @@ $api->executeCommand();
57 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 63
 	'password=>null,
63 64
 	'database=>false,
64 65
 // for connectivity (defaults to localhost):
@@ -74,8 +75,8 @@ $api = new MySQL_CRUD_API(array(
74 75
 	'input_sanitizer'=>function($cmd,$db,$tab,$col,$typ,$val) { return $val; },
75 76
 	'input_validator'=>function($cmd,$db,$tab,$col,$typ,$val,$ctx) { return true; },
76 77
 // dependencies (added for unit testing):
77
-	'db'=>null,
78
-	'method'=>$_SERVER['REQUEST_METHOD'],
78
+  'db'=>null,
79
+  'method'=>$_SERVER['REQUEST_METHOD'],
79 80
 	'request'=>$_SERVER['PATH_INFO'],
80 81
 	'get'=>$_GET,
81 82
 	'post'=>'php://input',
@@ -578,7 +579,7 @@ OK (19 tests, 39 assertions)
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 584
 ### SQL server on Windows:
584 585
 
@@ -594,7 +595,7 @@ OK (19 tests, 39 assertions)
594 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 600
 ### PostgreSQL on Linux
600 601
 
@@ -611,7 +612,7 @@ OK (22 tests, 42 assertions)
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 617
 ## Pretty URL
617 618
 

+ 5
- 2
api.php View File

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

Loading…
Cancel
Save