Articles Comments

{ Berbagi, Menulis, Dan Mengajar } Ilmu… » 7. Operating System

Replace Function MYSQL STRING

Basic usage The REPLACE() function takes three parameters: the string or column name to do the replacement on what to look for and what to replace it with The following example replaces the ‘aaa’ part of ‘aaa bbb ccc’ with ‘xyz’ and the column returned from the SQL query will contain ‘xyz bbb ccc': SELECT REPLACE('aaa bbb ccc', 'aaa', 'xyz'); If you were doing this against the column “foo” you would do this instead: SELECT REPLACE(foo, 'aaa', 'xyz'); My example In my case I had a column called ‘image_small’ and ‘image_large’ with example data like so: +------------+--------------+-------------+ | content_id | image_small | image_large | +------------+--------------+-------------+ | 1 | small1.jpg | big1.jpg | | 26 | small26.jpg | big26.jpg … Read entire article »

Filed under: 7. Operating System

Trigger Check MYSQL CHANGES

Setting constraints and rules in the database is better than writing special code to handle the same task since it will prevent another developer from writing a different query that bypasses all of the special code and could leave your database with poor data integrity.   For a long time I was copying info to another table using a script since MySQL didn’t support triggers at the time. I have now found this trigger to be more effective at keeping track of everything. This trigger will copy an old value to a history table if it is changed when someone edits a row. Editor ID and last mod are stored in the original table every time someone edits that row; the time corresponds to when it was … Read entire article »

Filed under: 7. Operating System

Trigger MYSQL –> Change NEW value in a before insert trigger

mysql> mysql> mysql> CREATE TABLE Employee( ->     id            int, ->     first_name    VARCHAR(15), ->     last_name     VARCHAR(15), ->     start_date    DATE, ->     end_date      DATE, ->     salary        FLOAT(8,2), ->     city          VARCHAR(10), ->     description   VARCHAR(15) -> ); Query OK, 0 rows affected (0.02 sec) mysql> mysql> mysql> delimiter $$ mysql> mysql> CREATE TRIGGER myTrigger ->   BEFORE INSERT ON employee ->   FOR EACH ROW -> BEGIN ->   DECLARE row_count INTEGER; -> -> SELECT COUNT(*) ->     INTO row_count -> FROM employee -> WHERE id=NEW.id; -> ->   IF row_count > 0 THEN -> UPDATE employee ->        SET salary = salary+NEW.salary -> WHERE id=NEW.id; ->   ELSE -> INSERT INTO employee (id,salary) VALUES(NEW.id,NEW.salary); -> END IF; -> -> END$$ Query OK, 0 rows affected (0.00 sec) mysql> mysql> delimiter ; mysql> insert into Employee(id,first_name, last_name, start_date, end_Date,   salary,  City,       Description) ->              values (1,'Jason',    'Martin',  '19960725',  '20060725', 1234.56, 'Toronto',  'Programmer'); ERROR 1442 (HY000): Can't update table 'employee' in stored function/trigger because it is already used by statement which invoked this stored function/trigger. mysql> mysql> insert into Employee(id,first_name, last_name, start_date, end_Date,   salary,  City,       Description) ->               values(2,'Alison',   'Mathews',  '19760321', '19860221', 6661.78, 'Vancouver','Tester'); ERROR 1442 (HY000): Can't update table 'employee' in stored function/trigger because it is already used by statement which invoked this stored function/trigger. mysql> mysql> insert into Employee(id,first_name, last_name, start_date, end_Date,   salary,  City,       Description) ->               values(3,'James',    'Smith',    '19781212', '19900315', 6544.78, 'Vancouver','Tester'); ERROR 1442 (HY000): Can't update table 'employee' in stored function/trigger because it is already used by statement which invoked this stored function/trigger. mysql> mysql> insert into Employee(id,first_name, last_name, start_date, end_Date,   salary,  City,       Description) ->               values(4,'Celia',    'Rice',     '19821024', '19990421', 2344.78, 'Vancouver','Manager'); ERROR 1442 (HY000): Can't update table 'employee' in stored function/trigger because it is already used by statement which invoked this stored function/trigger. mysql> mysql> insert into Employee(id,first_name, last_name, start_date, end_Date,   salary,  City,       Description) ->               values(5,'Robert',   'Black',    '19840115', '19980808', 2334.78, 'Vancouver','Tester'); ERROR 1442 (HY000): Can't update table 'employee' in stored … Read entire article »

Filed under: 7. Operating System

Trigger Example

SQL> -- create demo table SQL> create table Employee( 2 ID                 VARCHAR2(4 BYTE) NOT NULL, 3 First_Name         VARCHAR2(10 BYTE), 4 Last_Name          VARCHAR2(10 BYTE), 5 Start_Date         DATE, 6 End_Date           DATE, 7 Salary             Number(8,2), 8 City               VARCHAR2(10 BYTE), 9 Description        VARCHAR2(15 BYTE) 10 ) 11 / Table created. SQL> SQL> create table employee_audit ( 2 id VARCHAR2(4 BYTE), 3 salary Number(8,2), 4 delete_date Date, 5 deleted_by VARCHAR2(15 BYTE) 6 ) 7 / Table created. SQL> SQL> SQL> -- prepare data SQL> insert into Employee(ID,  First_Name, Last_Name, Start_Date,                     End_Date,                       Salary,  City,       Description) 2 values ('01','Jason',    'Martin', to_date('19960725','YYYYMMDD'), to_date('20060725','YYYYMMDD'), 1234.56, 'Toronto',  'Programmer') 3 / 1 row created. … Read entire article »

Filed under: 7. Operating System

Trigger DELETE DATA

DELIMITER $$ USE `sms2`$$ DROP TRIGGER /*!50032 IF EXISTS */ `DeletePbk`$$ CREATE /*!50017 DEFINER = ‘dimas’@’%’ */ TRIGGER `DeletePbk` AFTER DELETE ON `pbk` FOR EACH ROW BEGIN DELETE FROM pbk_copy WHERE pbk_copy.id_pbk=OLD.id_pbk; END; $$ DELIMITER ; … Read entire article »

Filed under: 7. Operating System

Trigger Mysql CopyPbk

DELIMITER $$ USE `sms2`$$ DROP TRIGGER /*!50032 IF EXISTS */ `CopyPbk`$$ CREATE /*!50017 DEFINER = ‘dimas’@’%’ */ TRIGGER `CopyPbk` AFTER INSERT ON `pbk` FOR EACH ROW BEGIN INSERT INTO sms2.pbk_copy (GroupID,NAME,SenderNumber,DestinationNumber,id_pbk) VALUE ( NEW.GroupID,NEW.NAME,NEW.Number,NEW.Number,NEW.id_pbk); END; $$ DELIMITER ; … Read entire article »

Filed under: 7. Operating System

PANDUAN SMSKITA

TATA CARA INSTALLASI PROGRAM SMS CENTER … Read entire article »

Filed under: 7. Operating System

QMAIL TUTORIAL

Qmailrocks friendyogi … Read entire article »

Filed under: 7. Operating System

SITUS SAKTI, POLSAS.AC.ID

Nek 1.) mwn username :   noorman_rinanto@yahoo.com 2.) pandi username:  nman1976 –> Pass sama semua: sakti2010 —   Informasi Pengguna Update Informasi Pengguna Update Kata Sandi Update bahasa   Nama Awal * Dimas Nama Akhir * Adityo E-mail * dms@ikc.co.id Nama Organisasi * POLSAS Negara * Indonesia Kode Pos * 60185 Provinsi * Jawa Timur Kota * Surabaya Jalan1 * PERUMDOS ITS / N-1 Jalan2 Jalan3 Telepon * +62.8123006030 … Read entire article »

Filed under: 7. Operating System

Referensi AT+COMMAND

http://www.sendsms.cn/download/ … Read entire article »

Filed under: 7. Operating System