Returns TRUE on success.
Returns FALSE on failure. Use pbms_errno() and pbms_error() to retrieve error details.
char buffer[80], *theBLOB; char blob_ref1[MS_BLOB_URL_SIZE]; char blob_ref2[MS_BLOB_URL_SIZE]; char blob_ref3[MS_BLOB_URL_SIZE]; size_t size; pbms = pbms_connect("localhost", 8080, "aDatabase"); // Assuming the names are already in the pbms_metadata_header table. pbms_add_metadata(pbms, "Header1", "PHPTest"); pbms_add_metadata(pbms, "Blob Name", "Little BLOB"); // Add a BLOB with our metadata theBLOB = "A tiny BLOB"; pbms_put_data(pbms, NULL, blob_ref1, strlen(theBLOB), theBLOB); // Change the metadata value for "Blob Name" pbms_clear_metadata(pbms, "Blob Name"); pbms_add_metadata(pbms, "Blob Name", "A bigger BLOB"); // Add a BLOB with our new metadata theBLOB = "A tiny bit larger BLOB"; pbms_put_data(pbms, NULL, blob_ref1, strlen(theBLOB), theBLOB); //----------- // Clear all our custom metadata pbms_clear_metadata(pbms, NULL); // Add a BLOB without any custom metadata theBLOB = "A BLOB with no name."; pbms_put_data(pbms, NULL, blob_ref3, strlen(theBLOB), theBLOB); /////////////////////////////////////////////////////////////// // Get the meta data back from the PDBS daemon and check it. // /////////////////////////////////////////////////////////////// //----------- // Get the metadat for our first BLOB pbms_get_info(pbms, blob_ref1); // Get the BLOB info. size = 80; pbms_get_metadata_value(pbms, "Header1", buffer, &size); printf("Header1: %s, expect \"PHPTest\"\n", buffer); size = 80; pbms_get_metadata_value(pbms, "Blob Name", buffer, &size); printf("Blob Name: %s, expect \"Little BLOB\"\n", buffer); //----------- // Get the metadat for our second BLOB. // The value for "Header1" should not have canged. pbms_get_info(pbms, blob_ref2); // Get the BLOB info. size = 80; pbms_get_metadata_value(pbms, "Header1", buffer, &size); printf("Header1: %s, expect \"PHPTest\"\n", buffer); size = 80; pbms_get_metadata_value(pbms, "Blob Name", buffer, &size); printf("Blob Name: %s, expect \"A bigger BLOB\"\n", buffer); //----------- //----------- // Get the metadat for our third BLOB. // There should be no custom metadata with this BLOB . pbms_get_info(pbms, blob_ref3); // Get the BLOB info. size = 80; if (pbms_get_metadata_value(pbms, "Header1", buffer, &size)) printf("Unexpected Header1: %s\n", buffer); else printf("As expected no Header1 metadata\n", buffer); size = 80; if (pbms_get_metadata_value(pbms, "Blob Name", buffer, &size)) printf("Unexpected Blob Name: %s\n", buffer); else printf("As expected no Blob Name\n", buffer); pbms_close(pbms);