Example.Full

// variables you'll want to change $source_file = $this->file('test/input/main.json'); $out_prefix = $this->file('test/input/main.out/test_sql'); $table_name = 'test_sql'; // max strlen() of the sql put into any one output file $max_sql_len = 1024*1024;

// a pdo instance for running the create & insert $pdo = new \PDO("sqlite::memory:");

// generate all the sql $jtm = new \Tlf\Jtm(); $schema_info = $jtm->generate_schema_info($source_file); $schema = $jtm->generate_schema($source_file, $schema_info); $create_sql = $jtm->generate_sql_create($table_name, $schema); $jtm->generate_sql_insert($source_file, $out_prefix, $table_name, $schema, $max_sql_len);

//execute the sql $pdo->exec($create_sql); $num_rows = $jtm->execute_insert_files($out_prefix, $pdo);

Example.ColumnData

[ 'name' => [

    'maxlen' => 4,
    'minlen' => 4,
    'count' => 2,
    'is_string' => 2,
    'is_numeric' => 0,
    'is_int' => 0,
    'is_float' => 0,
    'is_bool' => 0,
    'is_array' => 0,
    'is_date' => 0,
    'is_json' => 0,
    'sampleValue' => 'row2',
],

'index'=>[ 'maxlen' => 1, 'minlen' => 1, 'count' => 2, 'is_string' => 0, 'is_numeric' => 2, 'is_int' => 2, 'is_float' => 2, 'is_bool' => 0, 'is_array' => 0, 'is_date' => 0, 'is_json' => 0, 'sampleValue' => 1, ] ],