Search
 
SCRIPT & CODE EXAMPLE
 

SQL

ring MySQL presents the usage of MySQL_Autocommit(), MySQL_Commit() & MySQL_RollBack() functions.

func main

        con = mysql_init()

        see "Connect" + nl
        if mysql_connect(con, "localhost", "root", "root","mahdb") = 0
                system_error(con) ok

        see "Drop table" + nl
        if mysql_query(con, "DROP TABLE IF EXISTS Employee2")
                system_error(con) ok

        see "Create table" + nl
        if mysql_query(con, "CREATE TABLE Employee2(Id INT, Name TEXT, Salary INT)")
                system_error(con) ok

        see "Insert data" + nl
        if mysql_query(con, "INSERT INTO Employee2 VALUES(1,'Mahmoud',15000)")
                system_error(con) ok

        if mysql_query(con, "INSERT INTO Employee2 VALUES(2,'Samir',16000)")
                system_error(con) ok

        if mysql_query(con, "INSERT INTO Employee2 VALUES(3,'Fayed',17000)")
                system_error(con) ok

        mysql_autocommit(con,False)
        mysql_query(con, "INSERT INTO Employee2 VALUES(4,'Ahmed',5000)")
        mysql_query(con, "INSERT INTO Employee2 VALUES(5,'Ibrahim',50000)")
        mysql_query(con, "INSERT INTO Employee2 VALUES(6,'Mohammed',50000)")
        See "Save transaction (y/n) " give nChoice
        if upper(nChoice) = "Y"
                mysql_commit(con)
        else
                mysql_rollback(con)
        ok

        see "Close connection" + nl
        mysql_close(con)

func system_error con

        see mysql_error(con)
        mysql_close(con)
        bye
Comment

PREVIOUS NEXT
Code Example
Sql :: create query in where clasue 
Sql :: distinct data types in a table sql query 
Sql :: Laravel SQLSTATE[HY093] with array query 
Sql :: comma seperated join mssql 
Sql :: conditionla silme SQL 
Sql :: suse start MySQL 
Sql :: codeigniter 3 get best-selling products 
Sql :: for each row trigger postgresql 
Sql :: select from diffrent tables 
Sql :: MySQL can’t specify target table for update in FROM clause (Updating same table from same select inner join table) 
Sql :: plsql listagg 
Sql :: pastashoppen 
Sql :: add alternate add column sql 
Sql :: %ORACLE_HOME%database 
Sql :: mysql auto increment jumping 
Sql :: mysql create schgema 
Sql :: SQL Server INSERT INTO SELECT By Complete Examples - NAYCode.com 
Sql :: compare strings lexicographically in sql 
Sql :: Table aliases 
Sql :: mysql grant user privileges to database that has suffix and prefix 
Sql :: why mssql rds is using more than 95 memory pool 
Sql :: android sqlite query con join 
Sql :: Object Information 
Sql :: sql bild in function 
Sql :: normalization in database 2nd normal form 
Sql :: create table in dbms cmds 
Sql :: How to query data in many to many relationship in flask sql alchemy 
Sql :: sqlite rename table 
Sql :: sql trim 
Sql :: sql select data from one database and insert into a different database 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =