Skip to content

Commit 3530139

Browse files
committed
First link test
1 parent acd4732 commit 3530139

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/JSONDB/JSONDB.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,6 +370,7 @@ public function connect($server, $username, $password, $database = NULL)
370370
{
371371
$this->benchmark->mark('jsondb_(connect)_start');
372372
$config = $this->config->getConfig('users');
373+
$server = realpath($server);
373374

374375
if (!array_key_exists($server, $config)) {
375376
$this->benchmark->mark('jsondb_(connect)_end');
@@ -381,8 +382,6 @@ public function connect($server, $username, $password, $database = NULL)
381382
throw new Exception("JSONDB Error: User's authentication failed for user \"{$username}\" on server \"{$server}\". Access denied.");
382383
}
383384

384-
$this->config->addUser($server, $username, $password);
385-
386385
$this->server = $server;
387386
$this->database = $database;
388387
$this->username = $username;
@@ -435,6 +434,7 @@ public function createTable($name, array $prototype)
435434
$has_ai = array_key_exists('auto_increment', $prop);
436435
$has_pk = array_key_exists('primary_key', $prop);
437436
$has_uk = array_key_exists('unique_key', $prop);
437+
$has_tp = array_key_exists('type', $prop);
438438
if ($ai_exist && $has_ai) {
439439
$this->benchmark->mark('jsondb_(createTable)_end');
440440
throw new Exception("JSONDB Error: Can't use the \"auto_increment\" property on more than one fields.");
@@ -452,6 +452,14 @@ public function createTable($name, array $prototype)
452452
$prototype[$field]['not_null'] = TRUE;
453453
$properties['unique_keys'][] = $field;
454454
}
455+
if ($has_tp) {
456+
if (preg_match('#link\((.+)\)#', $prop['type'], $link)) {
457+
print_r($link);
458+
exit;
459+
}
460+
} else {
461+
$prototype[$field]['type'] = 'string';
462+
}
455463
$fields[] = $field;
456464
}
457465
$properties = array_merge($properties, $prototype);

0 commit comments

Comments
 (0)