<?php require_once 'SharedConfigurations.php'; require_once 'Predisql.php'; $database_connection['name'] = "backupdb"; $redisql = new Predisql_Client($database_connection, $single_server, NULL); //$redisql->echo_command = 1; //$redisql->echo_response = 1; //$redisql->mysql_echo_command = 1; $keys = $redisql->keys("*"); foreach ($keys as $key) { $type = $redisql->type($key); if ($type != "index" && $type != "string") { $backup_table = "backup_{$key}"; echo "BACKUP: {$key} TO REDISQL TABLE: {$backup_table}<br/>"; try { $redisql->dropTable($backup_table); } catch (Exception $e) { } $redisql->createTableFromRedisObject($backup_table, $key); $mysql_backup_table = "redis_backup_" . $key . "_" . gmdate("M_d_Y", time()); echo "DUMP: {$backup_table} TO MYSQL TABLE: {$mysql_backup_table}<br/>"; $redisql->dumpToMysql($backup_table, $mysql_backup_table); echo "DROP REDISQL TABLE: {$backup_table}<br/>"; $redisql->dropTable($backup_table); } }
<?php require_once 'SharedConfigurations.php'; require_once 'Predisql.php'; $redisql = new Predisql_Client($database_connection, $single_server); //$redisql->echo_command = 1; //$redisql->echo_response = 1; $drop = @$_GET['drop']; if ($drop) { try { $redisql->dropTable("user"); } catch (Exception $e) { } try { $redisql->dropTable("user_address"); } catch (Exception $e) { } try { $redisql->dropTable("user_payment"); } catch (Exception $e) { } echo "<br/>"; echo "<br/>"; } echo "First populate user:id:[name,age,status] <br/>"; echo "Then populate user:id:address[street,city,zipcode] <br/>"; echo "Then populate user:id:payment[type,account] <br/>"; $redisql->set("user:1:name", "bill"); $redisql->set("user:1:age", " 33"); $redisql->set("user:1:status", " member"); $redisql->set("user:1:address:street", "12345 main st");
<?php /* REQUIREMENTS: to run this script 1.) the database "tweet_archive" must exist 2.) the tables defined in "table_definitions.sql" need to exist */ require_once '../SharedConfigurations.php'; require_once 'Predisql.php'; require_once '../ZsetCache.php'; require_once 'tweet_populate.php'; require_once 'tweet_helper.php'; $database_connection['name'] = "tweet_archive"; $redisql = new Predisql_Client($database_connection, $single_server); //$redisql->echo_command = 1; //$redisql->echo_response = 1; //$redisql->mysql_echo_command = 1; $one_hour = 3600; $one_day = 86400; $now = gettimeofday(true); $yesterday = $now - $one_day; $two_days_ago = $now - 2 * $one_day; $user_id = 44; $z_name = "tweets"; $z_obj = $z_name . ":" . $user_id; $mysql_archive_table = $z_name . "_archive"; $temp_mysql_table = "user_" . gmdate("M_d_Y", time()); $drop = @$_GET['drop']; if ($drop) { $redisql->del($z_obj); try {
Requirements: 1.) Create Mysql database "test" 2.) issue the following SQL commands A.) CREATE TABLE employee_data ( emp_id int unsigned not null auto_increment primary key, f_name varchar(20), l_name varchar(20), title varchar(30), age int, yos int, salary int, perks int, email varchar(60) ); B.) INSERT INTO employee_data (f_name, l_name, title, age, yos, salary, perks, email) values ("Beth", "Smith", "CTO", 39, 1, 90000, 10000, "*****@*****.**"); C.) INSERT INTO employee_data (f_name, l_name, title, age, yos, salary, perks, email) values ("Bill", "Jones", "Manager", 29, 3, 100000, 20000, "*****@*****.**"); Then .... call this script w/ the following URL variables "?table=employee_data" To call this repeatedly (and each time dropping the Redisql table, use: "?table=employee_data&drop=1" */ $database_connection['name'] = "test"; // Mysql DatabaseName $redisql = new Predisql_Client($database_connection, $single_server, NULL); $redisql->echo_command = 1; $redisql->echo_response = 1; $redisql->mysql_echo_command = 1; $table = @$_GET['table']; if (!$table) { echo "this script makes the mysql table designated by the URL variable \"table=\" schemaless<br/>"; return; } $drop = @$_GET['drop']; if ($drop) { try { $redisql->dropTable($table); } catch (Exception $e) { } }