diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3ed1868
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,4 @@
+# https://git-scm.com/docs/gitignore
+# https://help.github.com/articles/ignoring-files
+# Example .gitignore files: https://github.com/github/gitignore
+/nbproject
\ No newline at end of file
diff --git a/README.md b/README.md
index c7865d5..8f6a80b 100644
--- a/README.md
+++ b/README.md
@@ -13,6 +13,18 @@ WWW SQL Designer was created by [Ondrej Zara](http://ondras.zarovi.cz/) and is b
If you wish to support this project, at PayPal!
+## Shortcuts
+
+- **F2** = save local
+- **F4** = load local
+
+- **a** = New table
+- **e** = Edit table | Edit row
+- **f** = add field
+- **x** = create foreign key
+- **c** = connect foreign key
+- **+** / **-** = zoom in or out
+
# News
## Moved to GitHub
diff --git a/backend/asp-file/Default.aspx b/backend/asp-file/Default.aspx
index 5be09a7..d5384c3 100644
--- a/backend/asp-file/Default.aspx
+++ b/backend/asp-file/Default.aspx
@@ -1 +1 @@
-<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="backend_asp_file_Default" validateRequest="false" %>
+<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="backend_asp_file_Default" validateRequest="false" %>
diff --git a/backend/asp-file/Default.aspx.cs b/backend/asp-file/Default.aspx.cs
index 6bd232c..f05ba3b 100644
--- a/backend/asp-file/Default.aspx.cs
+++ b/backend/asp-file/Default.aspx.cs
@@ -1,70 +1,70 @@
-using System;
-using System.Collections.Generic;
-using System.Web;
-using System.Web.UI;
-using System.Web.UI.WebControls;
-using System.IO;
-
-public partial class backend_asp_file_Default : System.Web.UI.Page
-{
- protected void Page_Load(object sender, EventArgs e)
- {
- Response.Clear();
-
- string action = Request.Params["action"].ToLower();
-
- if (action.Equals("list"))
- {
- list();
- }
-
- if (action.Equals("load"))
- {
- load();
- }
-
- if (action.Equals("save"))
- {
- save();
- }
-
- Response.End();
- }
-
- private void list()
- {
- string[] filePaths = Directory.GetFiles(Server.MapPath("data"));
- foreach (string filePath in filePaths)
- {
- Response.Write(Path.GetFileName(filePath) + "\n");
- }
- }
-
- private void load()
- {
- string fNaam = "data/" + Request.Params["keyword"].ToLower();
- Response.ContentType = "text/xml";
- if (File.Exists(Server.MapPath(fNaam)))
- {
- Response.WriteFile(Server.MapPath(fNaam));
- }
- else
- {
- Response.StatusCode = 404;
- }
- }
-
- private void save()
- {
- string fNaam = "data/" + Request.Params["keyword"].ToLower();
- FileStream fs = new FileStream(Server.MapPath(fNaam), FileMode.Create);
-
- byte[] buffer = new byte[1024];
- int count;
- while ((count = Request.InputStream.Read(buffer, 0, buffer.Length)) != 0)
- fs.Write(buffer, 0, count);
-
- fs.Close();
-
- }
-}
+using System;
+using System.Collections.Generic;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+using System.IO;
+
+public partial class backend_asp_file_Default : System.Web.UI.Page
+{
+ protected void Page_Load(object sender, EventArgs e)
+ {
+ Response.Clear();
+
+ string action = Request.Params["action"].ToLower();
+
+ if (action.Equals("list"))
+ {
+ list();
+ }
+
+ if (action.Equals("load"))
+ {
+ load();
+ }
+
+ if (action.Equals("save"))
+ {
+ save();
+ }
+
+ Response.End();
+ }
+
+ private void list()
+ {
+ string[] filePaths = Directory.GetFiles(Server.MapPath("data"));
+ foreach (string filePath in filePaths)
+ {
+ Response.Write(Path.GetFileName(filePath) + "\n");
+ }
+ }
+
+ private void load()
+ {
+ string fNaam = "data/" + Request.Params["keyword"].ToLower();
+ Response.ContentType = "text/xml";
+ if (File.Exists(Server.MapPath(fNaam)))
+ {
+ Response.WriteFile(Server.MapPath(fNaam));
+ }
+ else
+ {
+ Response.StatusCode = 404;
+ }
+ }
+
+ private void save()
+ {
+ string fNaam = "data/" + Request.Params["keyword"].ToLower();
+ FileStream fs = new FileStream(Server.MapPath(fNaam), FileMode.Create);
+
+ byte[] buffer = new byte[1024];
+ int count;
+ while ((count = Request.InputStream.Read(buffer, 0, buffer.Length)) != 0)
+ fs.Write(buffer, 0, count);
+
+ fs.Close();
+
+ }
+}
diff --git a/backend/perl-file/index.pl b/backend/perl-file/index.pl
index cbdf5bb..5fff9b5 100644
--- a/backend/perl-file/index.pl
+++ b/backend/perl-file/index.pl
@@ -72,4 +72,4 @@
else {
print $query->header(-status => "501 Not Implemented");
}
-
\ No newline at end of file
+
diff --git a/backend/php-cubrid/cubrid_mysql_compat.php b/backend/php-cubrid/cubrid_mysql_compat.php
index 3ae2a8e..38b6139 100644
--- a/backend/php-cubrid/cubrid_mysql_compat.php
+++ b/backend/php-cubrid/cubrid_mysql_compat.php
@@ -1,399 +1,399 @@
- 0) {
- list($host, $port)=explode(":", $server, 2);
- } else {
- $host=$server;
- $port=$GLOBALS['cubrid_default_port']; // default port
- }
-
- // save database name
- $GLOBALS['cubrid_database']=$database;
-
- return cubrid_connect($host, $port, $database, $username, $password);
-}
-
-// MySQL syntax:
-// bool mysql_close ( [resource link_identifier] )
-function cubrid_mysql_close($link_identifier) {
- return cubrid_disconnect($link_identifier);
-}
-
-// MySQL syntax:
-function cubrid_mysql_errno($link_identifier = '') {
- // int mysql_errno ( [resource link_identifier] )
- return cubrid_error_code();
-}
-
-// MySQL syntax:
-function cubrid_mysql_error($link_identifier = '') {
- // string mysql_error ( [resource link_identifier] )
- return cubrid_error_msg();
-}
-
-// MySQL syntax:
-// resource mysql_query ( string query [, resource link_identifier] )
-function cubrid_mysql_query_native($query, $link_identifier) {
- $result=cubrid_execute($link_identifier, $query);
- // Cubrid does not do commit automatically by default (auto-commit is off by default)
- cubrid_commit ($link_identifier);
- return $result;
-}
-
-// MySQL syntax:
-// resource mysql_query ( string query [, resource link_identifier] )
-function cubrid_mysql_query($query, $link_identifier, $last_insert_id_column = '') {
- $cubrid_query=trim($query); // need to trim to make sure we are handling properly the ";" terminator
-
- if ($GLOBALS['calculate_last_insert_id']) {
- // HACK - Cubrid does not support yet INSERT_ID()
- // We need to alter the INSERT query to be able to get last_insert_id
- if (startsWith($cubrid_query, "insert", false)) {
- if ($cubrid_query[strlen($cubrid_query) - 1] == ";") { // remove the ";" last char
- $cubrid_query=substr($cubrid_query, 0, strlen($cubrid_query) - 1) . " INTO :xyz;";
- } else {
- $cubrid_query=$cubrid_query . " INTO :xyz;";
- }
- }
- }
-
- $result=cubrid_execute($link_identifier, $cubrid_query);
-
- if (!$result) {
- return false;
- }
-
- if ($GLOBALS['calculate_last_insert_id']) {
- if (startsWith($cubrid_query, "insert", false)) {
- // get the last_insert_id for the specified column (In Cubrid can be multiple auto_increment columns)
- if (strlen($last_insert_id_column) > 0) {
- $GLOBALS['cubrid_last_insert_id']=cubrid_get_value(cubrid_last_insert_id_query($last_insert_id_column),
- $link_identifier);
- }
- } else {
- $GLOBALS['cubrid_last_insert_id']=0; // (re)set to 0
- }
- }
- cubrid_commit ($link_identifier);
- return $result;
-}
-
-// MySQL syntax:
-// array mysql_free_result ( resource $link_identifier )
-function cubrid_mysql_free_result($link_identifier) {
- return cubrid_free_result($link_identifier);
-}
-
-// MySQL syntax:
-// array mysql_fetch_row ( resource result )
-function cubrid_mysql_fetch_row($result) {
- return cubrid_fetch_row($result);
-}
-
-// MySQL syntax:
-// array mysql_fetch_array ( resource result [, int result_type] )
-function cubrid_mysql_fetch_array($result, $result_type = 0) {
- return cubrid_fetch($result, $result_type);
-}
-
-// MySQL syntax:
-// object mysql_fetch_object ( resource result )
-function cubrid_mysql_fetch_object($result) {
- return cubrid_fetch_object($result);
-}
-
-// MySQL syntax:
-// bool mysql_data_seek ( resource result, int row_number )
-function cubrid_mysql_move_cursor($result, $offset) {
- return cubrid_move_cursor($result, $offset);
-}
-
-// MySQL syntax:
-// object mysql_fetch_field ( resource result [, int field_offset] )
-function cubrid_mysql_fetch_field($result) {
- return cubrid_fetch_field($result);
-}
-
-// MySQL syntax:
-// int mysql_insert_id ( [resource link_identifier] )
-function cubrid_mysql_insert_id($link_identifier = -1) {
- return $GLOBALS['cubrid_last_insert_id'];
-}
-
-// MySQL syntax:
-// int mysql_num_rows ( resource result )
-function cubrid_mysql_num_rows($resultSet) {
- return cubrid_num_rows($resultSet);
-}
-
-// MySQL syntax:
-// int mysql_num_fields ( resource result )
-function cubrid_mysql_num_fields($resultSet) {
- return cubrid_num_cols($resultSet);
-}
-
-// MySQL syntax:
-// bool mysql_data_seek ( resource result, int row_number )
-function cubrid_mysql_data_seek($result, $row_number) {
- return cubrid_data_seek($result, $row_number);
-}
-
-// MySQL syntax:
-// Zero if successful. Non-zero if an error occurred.
-function cubrid_mysql_commit($link_identifier) {
- return cubrid_commit($link_identifier);
-}
-
-// MySQL syntax:
-// Zero if successful. Non-zero if an error occurred.
-function cubrid_mysql_rollback($link_identifier) {
- return cubrid_rollback($link_identifier);
-}
-
-// MySQL syntax:
-// string mysql_real_escape_string ( string unescaped_string [, resource link_identifier] )
-function cubrid_mysql_real_escape_string($unescaped_string, $link_identifier = '') {
- return str_replace("'", "''", $unescaped_string);
-}
-
-// MySQL syntax:
-// string mysql_result ( resource $result , int $row [, mixed $field = 0 ] )
-function cubrid_mysql_result($result, $row, $field = 0) {
- return cubrid_result($result, $row, $field);
-}
-
-// MySQL syntax:
-// array mysql_fetch_assoc ( resource $result )
-function cubrid_mysql_fetch_assoc($result) {
- return cubrid_fetch_assoc($result);
-}
-
-// implements SHOW TABLES
-function cubrid_SHOW_TABLES($link_identifier) {
- return cubrid_mysql_query_native(get_SQL_SHOW_TABLES(), $link_identifier);
-}
-
-// implements DESCRIBE
-function cubrid_DESCRIBE($table, $link_identifier) {
- return cubrid_mysql_query_native(get_SQL_describeTableSQL($table), $link_identifier);
-}
-
-// implements SHOW INDEX
-function cubrid_SHOW_INDEX_FROM($table, $link_identifier) {
- return cubrid_mysql_query_native(get_SQL_SHOW_INDEX_FROM($table), $link_identifier);
-}
-
-// gets data type for a table
-function cubrid_ColumnDataType($identifier, $table, $column) {
- $id_result =cubrid_mysql_query_native(get_SQL_ColumnDataType($table, $column), $identifier);
- $id_row =cubrid_fetch_row($id_result);
- cubrid_free_result ($id_result);
- $calculated_value=$id_row[0];
- return $calculated_value;
-}
-
-// gets a single value as a query result
-function cubrid_get_value($query, $link_identifier) {
- $result=cubrid_execute($link_identifier, $query);
-
- if ($result) {
- $row =cubrid_fetch_row($result);
- $value=$row[0];
- } else {
- return -1;
- }
-
- return $value;
-}
-
-// returns the last_insert_id value
-function cubrid_last_insert_id_query($last_insert_id_column, $cubrid_var = "xyz") {
- return "SELECT :" . $cubrid_var . "." . $last_insert_id_column . " FROM db_root";
-}
-
-// returns the last_insert_id value
-function cubrid_last_insert_id($last_insert_id_column, $link_identifier, $cubrid_var = "xyz") {
- return cubrid_get_value(cubrid_last_insert_id_query($last_insert_id_column), $link_identifier);
-}
-
-// return the current Cubrid database name
-function cubrid_current_database() {
- return $GLOBALS['cubrid_database'];
-}
-
-// The following columns are returned:
-// Field, Type, Null (YES,NO), Key (PRI,MUL), Default, Extra
-function get_SQL_describeTableSQL($table) {
- $sql="";
- $sql=$sql . "SELECT a.attr_name as \"Field\"," . " ";
- $sql=$sql . "a.data_type || '(' || a.prec || ',' || a.scale || ')' as \"Type\"," . " ";
- $sql=$sql . "a.prec || ',' || a.scale as \"Size\"," . " ";
- $sql=$sql . "a.is_nullable as \"Null\"," . " ";
- $sql=$sql . "'*' as \"Key\"," . " ";
- $sql=$sql . "a.default_value as \"Default\"," . " ";
- $sql=$sql . "'' as \"Extra\"" . " ";
- $sql=$sql . "FROM db_attribute a" . " ";
- $sql=$sql . "WHERE a.class_name='" . $table . "'" . " ";
- $sql=$sql . "order by a.def_order ASC";
-
- return $sql;
-}
-
-// The column data type is returned
-function get_SQL_ColumnDataType($table, $column) {
- $sql="";
- $sql=$sql . "SELECT a.data_type" . " ";
- $sql=$sql . "FROM db_attribute a" . " ";
- $sql=$sql . "WHERE a.class_name='" . $table . "'" . " ";
- $sql=$sql . "AND a.attr_name='" . $column . "'" . " ";
- $sql=$sql . "order by a.def_order ASC";
-
- return $sql;
-}
-
-// The following columns are returned:
-// Table,Non_unique,Key_name,Seq_in_index,Column_name,Collation,Cardinality,Sub_part,Packed,Index_type,Comment
-function get_SQL_SHOW_INDEX_FROM($table) {
- $query="";
- $query=$query . "select distinct a.class_name as \"Table\"," . " ";
- $query=$query . "DECODE(a.is_unique, 'YES', 'True') as \"Non_unique\"," . " ";
- $query=$query . "a.index_name as \"Key_name\"," . " ";
- $query=$query . "b.key_order as \"Seq_in_index\"," . " ";
- $query=$query . "b.key_attr_name as \"Column_name\"," . " ";
- $query=$query . "'' as \"Collation\"," . " ";
- $query=$query . "'' as \"Cardinality\"," . " ";
- $query=$query . "'' as \"Sub_part\"," . " ";
- $query=$query . "'' as \"Packed\"," . " ";
- $query=$query . "'' as \"Index_type\"," . " ";
- $query=$query . "'' as \"Comment\"" . " ";
- $query=$query . "from \"db_index\" a, \"db_index_key\" b" . " ";
- $query=$query . "where a.index_name = b.index_name" . " ";
- $query=$query . "and b.key_attr_name in (select attr_name from db_attribute where class_name = '" . $table . "')" . " ";
- $query=$query . "and a.is_foreign_key = 'NO'" . " ";
- $query=$query . "and a.class_name = '" . $table . "'" . " ";
- $query=$query . "order by a.index_name, b.key_order,b.key_attr_name";
-
- return $query;
-}
-
-// returns the list of non-system tables
-function get_SQL_SHOW_TABLES($pattern = '') {
- if (strlen($pattern) > 0) {
- return "select class_name from db_class where class_type='CLASS' and is_system_class='NO' WHERE class_name LIKE '"
- . $pattern . "' order by class_name ASC";
- } else {
- return "select class_name from db_class where class_type='CLASS' and is_system_class='NO' order by class_name ASC";
- }
-}
-
-// gets Primary Keys information
-function columnIsPK($dbl, $table, $column) {
- $ret = false;
-
- $sql = "";
- $sql = $sql . "select db_index_key.key_attr_name" . " ";
- $sql = $sql . "from db_index, db_index_key" . " ";
- $sql = $sql . "where db_index.index_name = db_index_key.index_name" . " ";
- $sql = $sql . "and db_index.class_name='" . $table . "'" . " ";
- $sql = $sql . "and db_index_key.key_attr_name='" . $column . "'" . " ";
- $sql = $sql . "and db_index.is_primary_key='YES'";
-
- $tableSql = cubrid_execute($dbl, $sql);
-
- if (@cubrid_num_rows($tableSql) > 0) {
- $ret=true;
- }
-
- return $ret;
-}
-
-// emulates DROP TABLE IF EXISTS
-function DROP_TABLE_IF_EXISTS($tablename, $link_identifier) {
- $id_result
- =cubrid_mysql_query_native("SELECT class_name FROM db_class WHERE class_name='" . $tablename . "'",
- $link_identifier);
- $rows=cubrid_num_rows($id_result);
-
- if ($rows > 0) {
- cubrid_execute($link_identifier, "DROP TABLE " . $tablename);
- }
-}
-
-// The following columns are returned:
-// Field, Type, Null (YES,NO), Key (PRI,MUL), Default, Extra
-function get_SQL_SHOW_COLUMNS($table) {
- $sql="";
- $sql=$sql . "SELECT a.attr_name as \"Field\"," . " ";
- $sql=$sql . "a.data_type || '(' || a.prec || ',' || a.scale || ')' as \"Type\"," . " ";
- $sql=$sql . "a.prec || ',' || a.scale as \"Size\"," . " ";
- $sql=$sql . "a.is_nullable as \"Null\"," . " ";
- $sql=$sql . "'*' as \"Key\"," . " ";
- $sql=$sql . "a.default_value as \"Default\"," . " ";
- $sql=$sql . "'' as \"Extra\"" . " ";
- $sql=$sql . "FROM db_attribute a" . " ";
- $sql=$sql . "WHERE a.class_name='" . $table . "'" . " ";
- $sql=$sql . "order by a.def_order ASC";
-
- return $sql;
-}
-
-function startsWith($haystack, $needle, $case = true) {
- if ($case) {
- return strpos($haystack, $needle, 0) == 0;
- } else {
- return stripos($haystack, $needle, 0) == 0;
- }
-}
-
-function endsWith($haystack, $needle, $case = true) {
- $expectedPosition=strlen($haystack) - strlen($needle);
-
- if ($case) {
- return strrpos($haystack, $needle, 0) == $expectedPosition;
- } else {
- return strripos($haystack, $needle, 0) == $expectedPosition;
- }
-}
-
-?>
\ No newline at end of file
+ 0) {
+ list($host, $port)=explode(":", $server, 2);
+ } else {
+ $host=$server;
+ $port=$GLOBALS['cubrid_default_port']; // default port
+ }
+
+ // save database name
+ $GLOBALS['cubrid_database']=$database;
+
+ return cubrid_connect($host, $port, $database, $username, $password);
+}
+
+// MySQL syntax:
+// bool mysql_close ( [resource link_identifier] )
+function cubrid_mysql_close($link_identifier) {
+ return cubrid_disconnect($link_identifier);
+}
+
+// MySQL syntax:
+function cubrid_mysql_errno($link_identifier = '') {
+ // int mysql_errno ( [resource link_identifier] )
+ return cubrid_error_code();
+}
+
+// MySQL syntax:
+function cubrid_mysql_error($link_identifier = '') {
+ // string mysql_error ( [resource link_identifier] )
+ return cubrid_error_msg();
+}
+
+// MySQL syntax:
+// resource mysql_query ( string query [, resource link_identifier] )
+function cubrid_mysql_query_native($query, $link_identifier) {
+ $result=cubrid_execute($link_identifier, $query);
+ // Cubrid does not do commit automatically by default (auto-commit is off by default)
+ cubrid_commit ($link_identifier);
+ return $result;
+}
+
+// MySQL syntax:
+// resource mysql_query ( string query [, resource link_identifier] )
+function cubrid_mysql_query($query, $link_identifier, $last_insert_id_column = '') {
+ $cubrid_query=trim($query); // need to trim to make sure we are handling properly the ";" terminator
+
+ if ($GLOBALS['calculate_last_insert_id']) {
+ // HACK - Cubrid does not support yet INSERT_ID()
+ // We need to alter the INSERT query to be able to get last_insert_id
+ if (startsWith($cubrid_query, "insert", false)) {
+ if ($cubrid_query[strlen($cubrid_query) - 1] == ";") { // remove the ";" last char
+ $cubrid_query=substr($cubrid_query, 0, strlen($cubrid_query) - 1) . " INTO :xyz;";
+ } else {
+ $cubrid_query=$cubrid_query . " INTO :xyz;";
+ }
+ }
+ }
+
+ $result=cubrid_execute($link_identifier, $cubrid_query);
+
+ if (!$result) {
+ return false;
+ }
+
+ if ($GLOBALS['calculate_last_insert_id']) {
+ if (startsWith($cubrid_query, "insert", false)) {
+ // get the last_insert_id for the specified column (In Cubrid can be multiple auto_increment columns)
+ if (strlen($last_insert_id_column) > 0) {
+ $GLOBALS['cubrid_last_insert_id']=cubrid_get_value(cubrid_last_insert_id_query($last_insert_id_column),
+ $link_identifier);
+ }
+ } else {
+ $GLOBALS['cubrid_last_insert_id']=0; // (re)set to 0
+ }
+ }
+ cubrid_commit ($link_identifier);
+ return $result;
+}
+
+// MySQL syntax:
+// array mysql_free_result ( resource $link_identifier )
+function cubrid_mysql_free_result($link_identifier) {
+ return cubrid_free_result($link_identifier);
+}
+
+// MySQL syntax:
+// array mysql_fetch_row ( resource result )
+function cubrid_mysql_fetch_row($result) {
+ return cubrid_fetch_row($result);
+}
+
+// MySQL syntax:
+// array mysql_fetch_array ( resource result [, int result_type] )
+function cubrid_mysql_fetch_array($result, $result_type = 0) {
+ return cubrid_fetch($result, $result_type);
+}
+
+// MySQL syntax:
+// object mysql_fetch_object ( resource result )
+function cubrid_mysql_fetch_object($result) {
+ return cubrid_fetch_object($result);
+}
+
+// MySQL syntax:
+// bool mysql_data_seek ( resource result, int row_number )
+function cubrid_mysql_move_cursor($result, $offset) {
+ return cubrid_move_cursor($result, $offset);
+}
+
+// MySQL syntax:
+// object mysql_fetch_field ( resource result [, int field_offset] )
+function cubrid_mysql_fetch_field($result) {
+ return cubrid_fetch_field($result);
+}
+
+// MySQL syntax:
+// int mysql_insert_id ( [resource link_identifier] )
+function cubrid_mysql_insert_id($link_identifier = -1) {
+ return $GLOBALS['cubrid_last_insert_id'];
+}
+
+// MySQL syntax:
+// int mysql_num_rows ( resource result )
+function cubrid_mysql_num_rows($resultSet) {
+ return cubrid_num_rows($resultSet);
+}
+
+// MySQL syntax:
+// int mysql_num_fields ( resource result )
+function cubrid_mysql_num_fields($resultSet) {
+ return cubrid_num_cols($resultSet);
+}
+
+// MySQL syntax:
+// bool mysql_data_seek ( resource result, int row_number )
+function cubrid_mysql_data_seek($result, $row_number) {
+ return cubrid_data_seek($result, $row_number);
+}
+
+// MySQL syntax:
+// Zero if successful. Non-zero if an error occurred.
+function cubrid_mysql_commit($link_identifier) {
+ return cubrid_commit($link_identifier);
+}
+
+// MySQL syntax:
+// Zero if successful. Non-zero if an error occurred.
+function cubrid_mysql_rollback($link_identifier) {
+ return cubrid_rollback($link_identifier);
+}
+
+// MySQL syntax:
+// string mysql_real_escape_string ( string unescaped_string [, resource link_identifier] )
+function cubrid_mysql_real_escape_string($unescaped_string, $link_identifier = '') {
+ return str_replace("'", "''", $unescaped_string);
+}
+
+// MySQL syntax:
+// string mysql_result ( resource $result , int $row [, mixed $field = 0 ] )
+function cubrid_mysql_result($result, $row, $field = 0) {
+ return cubrid_result($result, $row, $field);
+}
+
+// MySQL syntax:
+// array mysql_fetch_assoc ( resource $result )
+function cubrid_mysql_fetch_assoc($result) {
+ return cubrid_fetch_assoc($result);
+}
+
+// implements SHOW TABLES
+function cubrid_SHOW_TABLES($link_identifier) {
+ return cubrid_mysql_query_native(get_SQL_SHOW_TABLES(), $link_identifier);
+}
+
+// implements DESCRIBE
+function cubrid_DESCRIBE($table, $link_identifier) {
+ return cubrid_mysql_query_native(get_SQL_describeTableSQL($table), $link_identifier);
+}
+
+// implements SHOW INDEX
+function cubrid_SHOW_INDEX_FROM($table, $link_identifier) {
+ return cubrid_mysql_query_native(get_SQL_SHOW_INDEX_FROM($table), $link_identifier);
+}
+
+// gets data type for a table
+function cubrid_ColumnDataType($identifier, $table, $column) {
+ $id_result =cubrid_mysql_query_native(get_SQL_ColumnDataType($table, $column), $identifier);
+ $id_row =cubrid_fetch_row($id_result);
+ cubrid_free_result ($id_result);
+ $calculated_value=$id_row[0];
+ return $calculated_value;
+}
+
+// gets a single value as a query result
+function cubrid_get_value($query, $link_identifier) {
+ $result=cubrid_execute($link_identifier, $query);
+
+ if ($result) {
+ $row =cubrid_fetch_row($result);
+ $value=$row[0];
+ } else {
+ return -1;
+ }
+
+ return $value;
+}
+
+// returns the last_insert_id value
+function cubrid_last_insert_id_query($last_insert_id_column, $cubrid_var = "xyz") {
+ return "SELECT :" . $cubrid_var . "." . $last_insert_id_column . " FROM db_root";
+}
+
+// returns the last_insert_id value
+function cubrid_last_insert_id($last_insert_id_column, $link_identifier, $cubrid_var = "xyz") {
+ return cubrid_get_value(cubrid_last_insert_id_query($last_insert_id_column), $link_identifier);
+}
+
+// return the current Cubrid database name
+function cubrid_current_database() {
+ return $GLOBALS['cubrid_database'];
+}
+
+// The following columns are returned:
+// Field, Type, Null (YES,NO), Key (PRI,MUL), Default, Extra
+function get_SQL_describeTableSQL($table) {
+ $sql="";
+ $sql=$sql . "SELECT a.attr_name as \"Field\"," . " ";
+ $sql=$sql . "a.data_type || '(' || a.prec || ',' || a.scale || ')' as \"Type\"," . " ";
+ $sql=$sql . "a.prec || ',' || a.scale as \"Size\"," . " ";
+ $sql=$sql . "a.is_nullable as \"Null\"," . " ";
+ $sql=$sql . "'*' as \"Key\"," . " ";
+ $sql=$sql . "a.default_value as \"Default\"," . " ";
+ $sql=$sql . "'' as \"Extra\"" . " ";
+ $sql=$sql . "FROM db_attribute a" . " ";
+ $sql=$sql . "WHERE a.class_name='" . $table . "'" . " ";
+ $sql=$sql . "order by a.def_order ASC";
+
+ return $sql;
+}
+
+// The column data type is returned
+function get_SQL_ColumnDataType($table, $column) {
+ $sql="";
+ $sql=$sql . "SELECT a.data_type" . " ";
+ $sql=$sql . "FROM db_attribute a" . " ";
+ $sql=$sql . "WHERE a.class_name='" . $table . "'" . " ";
+ $sql=$sql . "AND a.attr_name='" . $column . "'" . " ";
+ $sql=$sql . "order by a.def_order ASC";
+
+ return $sql;
+}
+
+// The following columns are returned:
+// Table,Non_unique,Key_name,Seq_in_index,Column_name,Collation,Cardinality,Sub_part,Packed,Index_type,Comment
+function get_SQL_SHOW_INDEX_FROM($table) {
+ $query="";
+ $query=$query . "select distinct a.class_name as \"Table\"," . " ";
+ $query=$query . "DECODE(a.is_unique, 'YES', 'True') as \"Non_unique\"," . " ";
+ $query=$query . "a.index_name as \"Key_name\"," . " ";
+ $query=$query . "b.key_order as \"Seq_in_index\"," . " ";
+ $query=$query . "b.key_attr_name as \"Column_name\"," . " ";
+ $query=$query . "'' as \"Collation\"," . " ";
+ $query=$query . "'' as \"Cardinality\"," . " ";
+ $query=$query . "'' as \"Sub_part\"," . " ";
+ $query=$query . "'' as \"Packed\"," . " ";
+ $query=$query . "'' as \"Index_type\"," . " ";
+ $query=$query . "'' as \"Comment\"" . " ";
+ $query=$query . "from \"db_index\" a, \"db_index_key\" b" . " ";
+ $query=$query . "where a.index_name = b.index_name" . " ";
+ $query=$query . "and b.key_attr_name in (select attr_name from db_attribute where class_name = '" . $table . "')" . " ";
+ $query=$query . "and a.is_foreign_key = 'NO'" . " ";
+ $query=$query . "and a.class_name = '" . $table . "'" . " ";
+ $query=$query . "order by a.index_name, b.key_order,b.key_attr_name";
+
+ return $query;
+}
+
+// returns the list of non-system tables
+function get_SQL_SHOW_TABLES($pattern = '') {
+ if (strlen($pattern) > 0) {
+ return "select class_name from db_class where class_type='CLASS' and is_system_class='NO' WHERE class_name LIKE '"
+ . $pattern . "' order by class_name ASC";
+ } else {
+ return "select class_name from db_class where class_type='CLASS' and is_system_class='NO' order by class_name ASC";
+ }
+}
+
+// gets Primary Keys information
+function columnIsPK($dbl, $table, $column) {
+ $ret = false;
+
+ $sql = "";
+ $sql = $sql . "select db_index_key.key_attr_name" . " ";
+ $sql = $sql . "from db_index, db_index_key" . " ";
+ $sql = $sql . "where db_index.index_name = db_index_key.index_name" . " ";
+ $sql = $sql . "and db_index.class_name='" . $table . "'" . " ";
+ $sql = $sql . "and db_index_key.key_attr_name='" . $column . "'" . " ";
+ $sql = $sql . "and db_index.is_primary_key='YES'";
+
+ $tableSql = cubrid_execute($dbl, $sql);
+
+ if (@cubrid_num_rows($tableSql) > 0) {
+ $ret=true;
+ }
+
+ return $ret;
+}
+
+// emulates DROP TABLE IF EXISTS
+function DROP_TABLE_IF_EXISTS($tablename, $link_identifier) {
+ $id_result
+ =cubrid_mysql_query_native("SELECT class_name FROM db_class WHERE class_name='" . $tablename . "'",
+ $link_identifier);
+ $rows=cubrid_num_rows($id_result);
+
+ if ($rows > 0) {
+ cubrid_execute($link_identifier, "DROP TABLE " . $tablename);
+ }
+}
+
+// The following columns are returned:
+// Field, Type, Null (YES,NO), Key (PRI,MUL), Default, Extra
+function get_SQL_SHOW_COLUMNS($table) {
+ $sql="";
+ $sql=$sql . "SELECT a.attr_name as \"Field\"," . " ";
+ $sql=$sql . "a.data_type || '(' || a.prec || ',' || a.scale || ')' as \"Type\"," . " ";
+ $sql=$sql . "a.prec || ',' || a.scale as \"Size\"," . " ";
+ $sql=$sql . "a.is_nullable as \"Null\"," . " ";
+ $sql=$sql . "'*' as \"Key\"," . " ";
+ $sql=$sql . "a.default_value as \"Default\"," . " ";
+ $sql=$sql . "'' as \"Extra\"" . " ";
+ $sql=$sql . "FROM db_attribute a" . " ";
+ $sql=$sql . "WHERE a.class_name='" . $table . "'" . " ";
+ $sql=$sql . "order by a.def_order ASC";
+
+ return $sql;
+}
+
+function startsWith($haystack, $needle, $case = true) {
+ if ($case) {
+ return strpos($haystack, $needle, 0) == 0;
+ } else {
+ return stripos($haystack, $needle, 0) == 0;
+ }
+}
+
+function endsWith($haystack, $needle, $case = true) {
+ $expectedPosition=strlen($haystack) - strlen($needle);
+
+ if ($case) {
+ return strrpos($haystack, $needle, 0) == $expectedPosition;
+ } else {
+ return strripos($haystack, $needle, 0) == $expectedPosition;
+ }
+}
+
+?>
diff --git a/backend/php-cubrid/index.php b/backend/php-cubrid/index.php
index f575585..362fe41 100644
--- a/backend/php-cubrid/index.php
+++ b/backend/php-cubrid/index.php
@@ -192,4 +192,4 @@ function import($conn) {
default: header("HTTP/1.0 501 Not Implemented");
}
-?>
\ No newline at end of file
+?>
diff --git a/backend/php-mysql+file/mysql_import.php b/backend/php-mysql+file/mysql_import.php
index 8d399e0..796d684 100644
--- a/backend/php-mysql+file/mysql_import.php
+++ b/backend/php-mysql+file/mysql_import.php
@@ -92,4 +92,4 @@ function import() {
$arr[] = '';
return implode("\n",$arr);
}
-?>
\ No newline at end of file
+?>
diff --git a/backend/php-mysql/index.php b/backend/php-mysql/index.php
index 2227eb9..e8f0903 100644
--- a/backend/php-mysql/index.php
+++ b/backend/php-mysql/index.php
@@ -217,4 +217,4 @@ function import() {
save: 501/201
import: 501/200
*/
-?>
\ No newline at end of file
+?>
diff --git a/db/mssql/output.xsl b/db/mssql/output.xsl
index 1474fcf..8fb73da 100644
--- a/db/mssql/output.xsl
+++ b/db/mssql/output.xsl
@@ -130,4 +130,4 @@ GO
-
\ No newline at end of file
+
diff --git a/db/sqlalchemy/datatypes.xml b/db/sqlalchemy/datatypes.xml
index 75cee55..f572f07 100644
--- a/db/sqlalchemy/datatypes.xml
+++ b/db/sqlalchemy/datatypes.xml
@@ -24,4 +24,4 @@
Please close this window.