mysql

How established are ORMs (object relational mapping) in the world of databases

I'm not a database admin or architect, so I have to ask those who do it 24/7. How established is the concept of an ORM (object relational mapping) in the world of database administration and architecture? Is it still happening, widely approved but still in its early stages, or is generally disapproved? I'm learning this area and would li...

Checking an external list for duplicates in MySQL table?

I have a MySQL table and an Excel file. I would like to update the MySQL table to include the information from the Excel file, which is simple -- just write a quick formula for each line that creates the appropriate SQL statement. But first I'd like to check that all of the data matches properly. So if a given line has WidgetID 1001, ...

Insert/update helper function using PDO

I have a very simple helper function to produce SET statement for traditional plain mysql driver usage: function dbSet($fields) { $set=''; foreach ($fields as $field) { if (isset($_POST[$field])) { $set.="`$field`='".mysql_real_escape_string($_POST[$field])."', "; } } return substr($set, 0, -2); } used like this...

Full text search with InnoDB tables

I need to use full text search but the tables that I am using in my web application use the INNODB engine, from what I read JDBC does not have support for Mysql triggers and I am supposed to deploy the project on the course server so installing tools such as sphinxs is not possible, could someone please suggest a method to perform a full...

How do I Alter Table Column datatype on more than 1 column?

For example: ALTER TABLE webstore.Store MODIFY COLUMN ( ShortName VARCHAR(100), UrlShort VARCHAR(100) ); The above however does not work. I am using MySql 5.x ...

Better query for joins

Ok so I have three tables like so Students Name StudendId ---------------------- John 1 Jane 2 Bob 3 Betty 4 Class StudentId TeacherId ---------------------- 1 1 2 2 3 1 4 2 1 3 4 3 Teacher Name Teacher...

Order rows in mysql query by mixed columns

Hi! I have a content site in wich each content item has create date and number of views. I want to display content in such order: mixed date and views, that in details each view must have some weight and date parameter also has weight, so some content item with max sum of "weights" must be first. Is there standart solution for my problem...

need help with SQL MAX() in multiple query string

I have a string of 3 queries that are designed to find which messages have other messages with the same id which represents replies find which messages of the results from the first query have the specified user as entering the first message of that string of messages (min timestamp) find the latest message of that string of messages ...

MySQL IN Operator

hi friends, http://pastebin.ca/1946913 When i write "IN(1,2,4,5,6,7,8,9,10)" inside of the procedure, i get correct result but when i add the id variable in the "IN", the results are incorrect. I made a function on mysql but its still not working, what can i do? ...

SQL Server Standard Vs MYSQL?

I know this is very subjective, But I would like to know expert opinions about : Pros and Cons for both? the server language is C#. ...

is it possible to have a datagridview automatically update when the database it is bound to gets updated?

I have a C# winforms application that has a single datagridview to display the contents of a table in a mySQL database. Is it possible to have the datagridview reflect changes to the database in real time? i.e. when i make a change to the table directly, it will show that change in the datagridview ...

Is it possible to increase a varchar's max size in MySQL without it being converted?

I have a MyISAM table containing ~20 million rows, and need to increase the maximum size of a varchar. No matter how I phrase the ALTER TABLE query, it takes forever as MySQL copies all the data to a temporary table, reindexes it, etc - it seems to think that the data needs to be converted. Since it's a varchar already, I'd have though...

Foreign Key Constriant error.

Hi, {MySql.Data.MySqlClient.MySqlException: Cannot delete or update a parent row: a foreign key constraint fails When i try to run; delete from childtable where column=100; cmd.executnonquery(); delete from parenttable where column=100; cmd.executnonquery(); Am trying to delete child entry first before parent. Any thoughts. T...

Can the same column have primary key & foreign key constraint to another column

Can the same column have primary key & foreign key constraint to another column? Table1: ID - Primary column, foreign key constraint for Table2 ID Table2: ID - Primary column, Name Will this be an issue if i try to delete table1 data? Delete from table1 where ID=1000; Thanks. ...

Mysql to SQL Server: is there something similar to query cache?

Hi, I'm trying to optimize a SQL Server. I have some experience with Mysql and one of the things that usually help is to enable query cache, that will basically cache query results as long as you are running the same query. Is there something similar to this on SQL Server? Could you please point what is the name of this feature? Thank...

PHP MySQL Query doesn't work, but works from terminal

Here's my code: $gid = (int) stripslashes($_POST['id']); echo $gid; $db = dbConnect(); $test = $db->query('update games set played = played + 1 where id = "$gid"'); echo $db->error; echo $db->errno; die(); } It works fine from the terminal, and it correctly prints out $gid, and no errors are returned. Am I missing something really obvi...

Can you replicate data from MS SQL Server 2005 to MySQL 5.1 one-way?

I need to set up a one-way transactional replication from a SQL Server 2005 database to MySQL 5.1 Database. I have installed the ODBC driver and started to work on creating the publication, but I am getting an error that I have not found a solution for. The error is Failed to set publication parameter @enabled_for_het_sub because...

What are the best practices for preventing SQL creep?

I have a webapp written in PHP using a MySQL database backend. This question could just as easily apply to any language and application trying to use an SQL database and MVC OOP design. How do you keep your SQL code restricted to the Model? There's a rather longer story specific to my case behind the question. As previously mentioned ...

How to use reverse engineering in my eclipse

i am using MySql workbench and My Eclipse 8.6. and making a Hibernate-spring program. Is it possible to use reverse engineering feature in my eclipse with MySql workbench in so that DAO and hbm files can be generate like Derby. How can i do this with MySql workbench. this is a URL of using reverse engineering in my eclipse. http://www.my...

Insert xml document to mysql in php

I want to insert a xml file as a string as a entry into mysql. However, because of the presence of special characters, I am not able to do. Is there any function in PHP that converts the xml into a format compatible with mysql query. Thanks ...