This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Create the base tables | |
CREATE TABLE products( | |
product_id NUMBER GENERATED ALWAYS AS IDENTITY CONSTRAINT products_product_id_pk PRIMARY KEY, | |
name VARCHAR2(50), | |
description CLOB, | |
price NUMBER(9, 2), | |
location MDSYS.SDO_GEOMETRY | |
) | |
CREATE TABLE images( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE | |
-- This variable will hold our query string | |
l_query VARCHAR2(4000); | |
-- The lat/long values of the postcode input | |
l_lat VARCHAR2(100); | |
l_lng VARCHAR2(100); | |
BEGIN | |
-- Work out lat/long of input using Brian's procedure | |
IF :P1_POSTCODE IS NOT NULL THEN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# nvidia-xconfig: X configuration file generated by nvidia-xconfig | |
# nvidia-xconfig: version 343.22 (buildmeister@swio-display-x86-rhel47-05) Thu Sep 11 16:49:51 PDT 2014 | |
Section "ServerLayout" | |
Identifier "Layout0" | |
Screen 0 "Screen0" | |
InputDevice "Keyboard0" "CoreKeyboard" | |
InputDevice "Mouse0" "CorePointer" | |
EndSection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE PROCEDURE upload_new_image (p_filename IN VARCHAR2, p_product_id IN NUMBER) IS | |
l_upload_size INTEGER; | |
l_upload_blob BLOB; | |
l_image_id NUMBER; | |
l_image ORDSYS.ORDImage; | |
BEGIN | |
-- Get the length, MIME type and the BLOB of the new image from the | |
-- upload table | |
-- apex_application_files is a synonym for WWV_FLOW_FILES | |
SELECT doc_size, blob_content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE PROCEDURE create_blob_thumbnail (p_image_id IN INTEGER) IS | |
l_orig ORDSYS.ORDImage; | |
l_thumb ORDSYS.ORDImage; | |
l_blob_thumb BLOB; | |
BEGIN | |
-- lock row | |
SELECT image | |
INTO l_orig | |
FROM images | |
WHERE image_id = p_image_id FOR UPDATE; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE OR REPLACE TRIGGER trg_products_location | |
BEFORE INSERT OR UPDATE OF postcode ON products FOR EACH ROW | |
DECLARE | |
l_lat VARCHAR2(100); | |
l_lng VARCHAR2(100); | |
BEGIN | |
brian.POSTCODE_TO_LAT_LNG_GM_API(:NEW.POSTCODE, l_lat, l_lng); | |
:NEW.LOCATION := SDO_GEOMETRY(2001, -- SDO_GTYPE | |
8307, -- SDO_SRID |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UPDATE products | |
SET archived = 'Y' | |
WHERE product_id = :P2_PRODUCT_ID; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT NAME, P.PRODUCT_ID FROM PRODUCTS P | |
LEFT JOIN IMAGES I ON P.PRODUCT_ID = I.PRODUCT_ID | |
WHERE I.PRODUCT_ID IS NULL | |
AND ARCHIVED = 'N' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Create URL to download the blob file | |
var url = URL.createObjectURL(blob); | |
// Create hidden anchor and click it to initiate the download | |
a = document.createElement('a'); | |
document.body.appendChild(a); | |
a.style = 'display: none'; | |
a.href = url; | |
a.download = conn.metadata.filename; | |
a.click(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CarbonTrait { | |
public function __get($property) { | |
if (in_array($property, $this->accessMutateDates)) { | |
return new Carbon(parent::__get($property)); | |
} | |
return parent::__get($property); | |
} |
OlderNewer