function process_cli_params($params) { $success = 0; // 0 == success. if (isset($params['version'])) { print_version(); return [$params, 2]; } if (isset($params['help']) || !isset($params['g'])) { print_help(); return [$params, 1]; } if (@$params['logfile']) { mylogger()->set_log_file($params['logfile']); mylogger()->echo_log = false; } $loglevel = @$params['loglevel'] ?: 'info'; mylogger()->set_log_level_by_name($loglevel); $xpublist = get_xpub_list($params, $empty_ok = true); $params['derivation'] = @$params['derivation'] ?: 'relative'; $params['include-unused'] = isset($params['include-unused']) ? true : false; $params['multisig'] = count($xpublist) > 1; // legacy copay used multisig even for 1 of 1 wallets. if ($params['derivation'] == 'copaylegacy') { $params['multisig'] = true; // if numsig is missing for 1of1 then we set it to 1. $params['numsig'] = @$params['numsig'] ?: (count($xpublist) == 1 ? 1 : null); } $params['gen-only'] = is_numeric(@$params['gen-only']) ? $params['gen-only'] : null; $types = array('receive', 'change', 'both'); $params['type'] = in_array(@$params['type'], $types) ? $params['type'] : 'both'; if (count($xpublist) > 1 && !@$params['numsig']) { throw new Exception("multisig requires --numsig"); } $params['gap-limit'] = @$params['gap-limit'] ?: 20; $params['batch-size'] = @$params['batch-size'] ?: 'auto'; $params['cols'] = get_cols($params); $params['min-receive'] = is_numeric(@$params['min-receive']) ? $params['min-receive'] : 0; $params['min-change'] = is_numeric(@$params['min-change']) ? @$params['min-change'] : 0; $params['api'] = @$params['api'] ?: 'blockchaindotinfo'; $params['insight'] = @$params['insight'] ?: 'https://insight.bitpay.com/api'; $params['blockchaindotinfo'] = @@$params['blockchaindotinfo'] ?: 'https://blockchain.info'; $params['toshi'] = @$params['toshi'] ?: 'https://bitcoin.toshi.io'; $params['blockr'] = @$params['blockr'] ?: 'https://btc.blockr.io'; $params['format'] = @$params['format'] ?: 'txt'; $params['cols'] = @$params['cols'] ?: 'all'; $params['oracle-raw'] = @$params['oracle-raw'] ?: null; $params['oracle-json'] = @$params['oracle-json'] ?: null; return [$params, $success]; }
function count_extra_cols($columns) { //counts the columns selected by the user to be shown $cols = get_cols($columns); if ($cols == null) { return 0; } else { return count($cols); } }
$a = $arr1[1]; /* count of cols in 1st array */ $b = $arr2[1]; /* count of cols in 2nd array */ if ($a == $b) { return 0; } return $a < $b ? -1 : 1; } prepare_conversion(); $table_names = array(); $tables = array(); $r = odbc_tables($conn); while ($t = odbc_fetch_array($r)) { // print_r($t); $type = $t['TABLE_TYPE'] == 'TABLE'; $owner = true; if (isset($t['TABLE_OWNER'])) { $owner = strtolower($t['TABLE_OWNER']) != 'information_schema'; } if ($type && $owner) { $table_names[] = $t['TABLE_NAME']; } } for ($i = 0; $i < count($table_names); $i++) { $cols = get_cols($conn, $table_names[$i]); $cnt = count($cols); $tables[] = array($cols, $cnt, $table_names[$i]); } usort($tables, "cmp"); generate_xml($tables);
function create_fusion_table($service, $taxon) { $cols = get_cols(); $postBody = new Google_Service_Fusiontables_Table(); $postBody->name = $taxon['concept_id']; //"eli_tbl4"; $postBody->isExportable = true; $postBody->columns = json_decode($cols); $postBody->kind = "fusiontables#table"; $results = $service->table->insert($postBody, array()); echo "\nNew table created OK: " . $results->tableId . "\n"; return $results; /* Google_Service_Fusiontables_Table Object ( [collection_key:protected] => columns [internal_gapi_mappings:protected] => Array() [attribution] => [attributionLink] => [baseTableIds] => [columnPropertiesJsonSchema] => [columnsType:protected] => Google_Service_Fusiontables_Column [columnsDataType:protected] => array [description] => [isExportable] => 1 [kind] => fusiontables#table [name] => 173 [sql] => [tableId] => 1_ceoW2ndzIEcgBVz5-zOMiDIHWM-AVE-KPY4mJty [tablePropertiesJson] => [tablePropertiesJsonSchema] => [modelData:protected] => Array ( [columns] => Array ( [0] => Array ( [kind] => fusiontables#column [columnId] => 0 [name] => catalogNumber [type] => STRING [formatPattern] => NONE [validateData] => ) [1] => Array ( [kind] => fusiontables#column [columnId] => 1 [name] => latitude [type] => LOCATION [formatPattern] => NONE [validateData] => ) ) ) [processed:protected] => Array() ) */ }