Showing entries 31 to 40 of 72
« 10 Newer Entries | 10 Older Entries »
Displaying posts with tag: stored procedure (reset)
How to generate Insert Statement in MySQL

A lot of places I saw people asking for ways to generate Insert statements. We do have GUI Tool which can extract insert statements for us readily. Some of the…

The post How to generate Insert Statement in MySQL first appeared on Change Is Inevitable.

One last bit of evil….

You can store things for later! drizzle> select libtcc("#include <string.h>\n#include <stdlib.h>\nint foo(char* s) { char *a= malloc(1000); return snprintf(s, 100, \"%p\", a); }") as RESULT;

+-----------+
| RESULT    |
+-----------+
| 0x199c610 |
+-----------+
1 row in set (0 sec)

drizzle> select libtcc("#include <string.h>\n#include <stdlib.h>\nint foo(char* s) { char *a= 0x199c610; strcpy(a, \"Hello World!\"); strcpy(s,\"done\"); return strlen(s); }") as result;

+--------+
| result |
+--------+
| done   |
+--------+
1 row in set (0.01 sec)

drizzle> select libtcc("#include <string.h>\n#include <stdlib.h>\nint foo(char* s) { char *a= 0x199c610; strcpy(s, a); return strlen(s); }") as result;

+--------------+
| result       |
+--------------+
| Hello World! |
+--------------+
1 …
[Read more]
Stored Procedures/Functions for Drizzle

Previously, in “Thoughts on Thoughts on Drizzle” I theorized that one of the major reasons why we did not see lots of people jumping at stored procedures in MySQL was that it wasn’t in their native language (for lack of a better term). We’ve seen External Language Stored Procedures for MySQL that let you write stored procedures in some other languages…. but I felt something was missing.

Firstly, I wanted a language I was really familiar with and comfortable writing complex things in.

Secondly, it should be compiled so that it runs as fast as possible.

Thirdly, it shouldn’t just be linking to a pre-compiled library (drizzle function plugins do that …

[Read more]
Ideas for select all columns but one mysql stored procedure

Assume we’ve a table with 100 rows and we need to select all columns but one.The problem is headache of actually typing out all 99 required columns!! In this blog…

The post Ideas for select all columns but one mysql stored procedure first appeared on Change Is Inevitable.

How to bulk rename table MySQL

Are you tired of manually renaming MySQL tables, one by one, especially when dealing with a large number of them? In this guide, we’ll introduce you to a MySQL stored…

The post How to bulk rename table MySQL first appeared on Change Is Inevitable.

Stored Procedure For Finding Columns In MySQL

Looking for instances particular column in a large schema can be a pain. Fortunately the information schema makes this pretty easy, if your columns have a consistent naming convention.

SELECT table_schema, table_name, column_name
FROM information_schema.columns
WHERE column_name LIKE '%some_name%';

Now, if we want to wrap this up into an easy to use stored procedure, we can do something like this:

drop procedure find_column;
delimiter //
CREATE PROCEDURE find_column(c varchar(255))
begin
        SET @a = CONCAT("%", c, "%");
        SELECT table_schema, table_name, column_name, column_type
                FROM information_schema.columns
                WHERE column_name LIKE @a;
end
//
delimiter ;

We need to use the concat statement in order to properly get the quotes in there without using the literal string “c” in the LIKE statement.

You can do a search as follows:

CALL …
[Read more]
MySQL Stored procedure – Split Delimited string into Rows

This procedure will split  a “;” separated column in to new fields preserving ids. This is very specific problem, lets check it with example. Consider a sample table test: And…

The post MySQL Stored procedure – Split Delimited string into Rows first appeared on Change Is Inevitable.

MySQL Stored procedure – Execute query if table or Column exists

Well procedures mainly carried out working with information schema and it’s usage in stored procedure. Procedures are fairly simple and easy to understand. 1. Edit_table – following procedure executes queries to…

The post MySQL Stored procedure – Execute query if table or Column exists first appeared on Change Is Inevitable.

Stored procedure to Find database objects

This procedure lists available database objects under passed database name. It lists present Tables, Views, Stored Procedures, Functions and Triggers under particular database. It also lists storage engine of tables.…

The post Stored procedure to Find database objects first appeared on Change Is Inevitable.

Calculate MySQL Memory Usage – Quick Stored Procedure

In this post we will look into the MySQL memory utilization estimation or calculation based on the global variables. Using a simple stored procedure call you can get the memory…

The post Calculate MySQL Memory Usage – Quick Stored Procedure first appeared on Change Is Inevitable.

Showing entries 31 to 40 of 72
« 10 Newer Entries | 10 Older Entries »