~pbms-core/pbms/5.11-beta

« back to all changes in this revision

Viewing changes to php/ext/tests/007MD5Insert.phpt

  • Committer: Barry.Leslie at PrimeBase
  • Date: 2010-02-25 17:15:10 UTC
  • Revision ID: barry.leslie@primebase.com-20100225171510-ztd2hnjosu40ci34
Pulled the BLOB alias support out of the  daemon. This was done because
supporting it in a transactional environment would have been complicated and
since it is not part of the core objectives of the PBMS daemon I felt that it was
not worth the effort it would take.

Show diffs side-by-side

added added

removed removed

Lines of Context:
8
8
<?php 
9
9
        // Functions tested:
10
10
        // pbms_connect() 
11
 
        // pbms_read_stream() with alias
12
 
        // pbms_write_stream() with alias
 
11
        // pbms_read_stream()
 
12
        // pbms_write_stream()
13
13
        // pbms_get_md5_digest()
14
14
        // pbms_close()
15
15
 
44
44
                $fh = fopen($val, "r")
45
45
                        or die("fopen() error\n");
46
46
                
47
 
                // Use the file name as an alias
48
 
                $blob_ref = pbms_read_stream($fh, filesize($val), "test1", $val, md5_file($val, true))
 
47
                // Stream the file data to the PBMS daemon.
 
48
                $blob_ref = pbms_read_stream($fh, filesize($val), "test1", md5_file($val, true))
49
49
                        or pbms_error_and_die("pbms_read_stream($val) error\n");
50
50
 
51
51
                fclose($fh);
55
55
                mysql_query($query)
56
56
                        or mysql_error_and_die("Query Failed: $query");
57
57
                        
 
58
                $blob_refs[$cnt] = $blob_ref;   
58
59
                $cnt++;
59
60
        }
60
61
 
 
62
        $cnt = 1;
61
63
        foreach ($blob_file as $val) {
62
64
                // Test stream access:
63
65
                $fh = fopen("phptest.blob", "w+")
64
66
                        or die("fopen() error");
65
67
                
66
 
                // Get the BLOB back using the alias    
67
 
                pbms_write_stream($fh, $val)
 
68
                // Get the BLOB back    
 
69
                pbms_write_stream($fh, $blob_refs[$cnt])
68
70
                        or pbms_error_and_die("pbms_write_stream($val) error");
69
71
                
70
72
                $pbms_checksum = pbms_get_md5_digest();
79
81
                
80
82
                compare_blob_files("phptest.blob", $val);
81
83
                unlink("phptest.blob");
 
84
                $cnt++;
82
85
        }
83
86
        
84
87
        foreach ($blob_file as $val)