public function create()
 {
     require 'shard-key-mapper.php';
     require 'shard-query-config.php';
     //init vars
     $this->initPutVars();
     $column_id = $this->puts['column_id'];
     $shard_id = $this->puts['shard_id'];
     $key_value = $this->puts['key_value'];
     //get column info
     $cs = new ColumnSequences();
     $cs->id = $column_id;
     $cs = $cs->getOne(array('asArray' => true));
     //get shard info
     $s = new Shards();
     $s->id = $shard_id;
     $shard = $s->getOne();
     //get schemata info
     $s = new Schemata();
     $s->id = $shard->schema_id;
     $schemata = $s->getOne();
     //init DirectoryShardKeyMapper
     $mapper = new DirectoryShardKeyMapper($config_database);
     $result = $mapper->new_key($cs['sequence_name'], $key_value, $shard->shard_name, $schemata->schema_name, $cs);
     //assumed success
     $this->res->message = $result;
     $this->res->success = true;
 }
 public function __construct($config, $no_connect = false)
 {
     parent::__construct($config);
 }
Exemple #3
0
}
#check password to ensure it matches
$secret = trim(file_get_contents('../protected/configured'));
$md5secret = md5($secret);
$salt = $_REQUEST['s'];
$hashed = md5($secret . $salt);
$pass = $_REQUEST['p'];
$user = $_REQUEST['u'];
if (md5($md5secret . $salt) != $pass) {
    echo "badauth";
    exit;
}
$schema = $_REQUEST['sn'];
$host = $_REQUEST['h'];
switch (strtolower($_REQUEST['store'])) {
    case 'iee':
        $port = array(0 => 5029);
        break;
    case 'ice':
        $port = array(0 => 5029);
        break;
    case 'mysql':
    default:
        $port = array(0 => 3306);
}
$mapper = new DirectoryShardKeyMapper(array('host' => '127.0.0.1', 'user' => 'root', 'db' => 'sq', 'password' => ''));
foreach ($port as $the_port) {
    $shard = array('host' => $host, 'user' => $user, 'password' => $secret, 'db' => $schema, 'port' => $the_port);
    $mapper->add_shard($host, $shard, true, true, null, $schema);
}
echo "registered";