Back to index

php5  5.3.10
Functions | Variables
interbase.inc File Reference

Go to the source code of this file.

Functions

 init_db ()
 cleanup_db ()
 out_table ($table_name)
 out_result ($result, $table_name="")
 out_result_trap_error ($result, $table_name="")
 rand_datetime ()
 rand_binstr ($max_len)
 rand_str ($max_len)
 rand_number ($len, $prec=-1, $sign=1)

Variables

 $user = 'SYSDBA'
 $password = 'masterkey'

Function Documentation

Definition at line 28 of file interbase.inc.

{
       global $test_base;
    
       $r = ibase_connect($test_base);
       ibase_drop_db($r);
}
init_db ( )

Definition at line 13 of file interbase.inc.

{
       global $test_base, $user, $password;

       $test_db = ibase_query(IBASE_CREATE, 
              sprintf("CREATE SCHEMA '%s' USER '%s' PASSWORD '%s' DEFAULT CHARACTER SET %s",$test_base,
              $user, $password, ($charset = ini_get('ibase.default_charset')) ? $charset : 'NONE'));
       $tr = ibase_trans($test_db);
       ibase_query($tr,"create table test1 (i integer, c varchar(100))");
       ibase_commit_ret($tr);
       ibase_query($tr,"insert into test1(i, c) values(1, 'test table not created with isql')");
       ibase_commit($tr);
       ibase_close($test_db);
}
out_result ( result,
table_name = "" 
)

Definition at line 50 of file interbase.inc.

{
       echo "--- $table_name ---\n";
       while ($r = ibase_fetch_row($result)) {
              echo join("\t",$r)."\t\n";
       }
       echo "---\n";
}
out_result_trap_error ( result,
table_name = "" 
)

Definition at line 59 of file interbase.inc.

{
   echo "--- $table_name ---\n";
   while ($r = @ibase_fetch_row($result)) {
              echo join("\t",$r)."\t\n";
   }
   echo "errmsg [" . ibase_errmsg() . "]\t\n";
   echo "---\n";
}
out_table ( table_name)

Definition at line 39 of file interbase.inc.

{
       echo "--- $table_name ---\n";
       $res = ibase_query("select * from $table_name");
       while ($r = ibase_fetch_row($res)) {
              echo join("\t",$r)."\t\n";
       }
       ibase_free_result($res);
       echo "---\n";
}
rand_binstr ( max_len)

Definition at line 78 of file interbase.inc.

{
    $len = rand() % $max_len;
    $s = "";
    while($len--) {
        $s .= sprintf("%c", rand() % 256);
    }
    return $s;
}

Definition at line 70 of file interbase.inc.

{
    return sprintf("%02d/%02d/%4d %02d:%02d:%02d",
              rand()%12+1, rand()%28+1, rand()%100+1910,
              rand()%24,   rand()%60,  rand()%60);
}
rand_number ( len,
prec = -1,
sign = 1 
)

Definition at line 98 of file interbase.inc.

{
    if ($prec == -1) {
        $n = substr(rand() . rand(), 0, rand() % $len + 1);
        if (strlen($n) < $len) {
              $n .= "." . substr(rand(), 0, rand() % ($len - strlen($n)) + 1);
        }
    } else if ($prec == 0) {
        $n = substr(rand() . rand(), 0, rand() % $len + 1);
    } else if (($prec - $len) == 0) {
        $n = substr(rand() . rand(), 0, 1);
        $n .= "." . substr(rand(), 0, $prec);
    } else {
        $n = substr(rand() . rand(), 0, rand() % ($len - $prec) + 1);
        $n .= "." . substr(rand(), 0, $prec);
    }
    if ($sign && (rand() % 3 == 0)) {
        $n = "-" .$n;
    }
    return $n;
}
rand_str ( max_len)

Definition at line 88 of file interbase.inc.

{
    $len = rand() % $max_len;
    $s = "";
    while ($len--) {
        $s .= sprintf("%c", rand() % 26 + 65);
    }
    return $s;
}

Variable Documentation

$password = 'masterkey'

Definition at line 6 of file interbase.inc.

$user = 'SYSDBA'

Definition at line 5 of file interbase.inc.