mysql

MySQL Connector for .NET - Is it REALLY mature?

After spending a miserable month with MySQL/.NET/EntityFramework, my findings: Support for Entity Framework is VERY primitive, please use it for student-subjects type of database. Kindly do not consider it using for serious development as they ARE STILL unable to sort out VERY BASIC things like: it DOES NOT support unsigned stuff it D...

How to avoid nested SQL query in this case?

I have an SQL question, related to this and this question (but different). Basically I want to know how I can avoid a nested query. Let's say I have a huge table of jobs (jobs) executed by a company in their history. These jobs are characterized by year, month, location and the code belonging to the tool used for the job. Additionally I...

PHP & mySQL: Simple code to implement Transaction - Commit & Rollback

Hi all, MY PLATFORM: PHP & mySQL MY SITUATION: I am trying to implement transactions within my code. I tried to follow examples, but it's not much help. I am running 3 queries and I wanted to write a transaction in such a way so that if any of the query(ies) fail, the whole transaction should roll back. I would really appreciate a si...

Importing bulk CSV data in UTF-8 into MySQL

Hi, I'm trying to import about 10K rows of UTF-8 encoded data into a new MySQL table. I can do so successfully with LOAD DATA INFILE via MySQL Workbench but it the UTF-8 characters get mangled. I've tested the database otherwise via PHP and it accepts stores UTF-8 charaters fine. The problem seems to be with LOAD DATA INFILE, and I've ...

SQL: Get list of non-coupled items using MySQL 4

I'm not that good in SQL and I've come across a problem I don't know how to solve. I've read and re-read parts of a book about SQL (O'Reilly's Learning SQL) which I hoped would contain the information I needed but I haven't found it. My problem is the following. I'll use a simplified example to make it easier to discuss. I've got three...

mysql - a SELECT that returns the highest 'views' and a specific id's 'views'

Is it possible to write a single query that can return two rows, one specified in a WHERE clause and the other the highest in the table. For example. Table_1 -row_id -views -content Is there a query which can combine the following: SELECT views FROM Table_1 WHERE row_id = 10 SELECT MAX(views) FROM Table_1 or is two queries my onl...

sqlite & mysql field types?

Hi I'm working on my first sqlite project and I was just wondering if sqlite supports all the same field type that MYsql does e.g - DATETIME, TINYINT, VARCHAR ect. If sqlite supports limited field type it would be a big help if someone could provide me with them. thanks! ...

using group_concat in PHPMYADMIN will show the result as [BLOB - 3B]

I have a query which uses the GROUP_CONCAT of mysql on an integer field. I am using PHPMYADMIN to develop this query. My problem that instead of showing 1,2 which is the result of the concatenated field, I get [BLOB - 3B]. Query is SELECT rec_id,GROUP_CONCAT(user_id) FROM t1 GROUP BY rec_id (both fields are unsigned int, both are n...

Does 1 always equal '1' in SQL?

I am trying to determine that standard SQL behaviour for comparing a number to a character or string version of the same number. Does SELECT 1 = '1' (or the like) always return some sort of "truthy" value (true, 1, 't', etc.)? I have confirmed as much on PostgreSQL and MySQL, but I cannot find a resource for SQL as a whole. Update: The ...

PHP Class problem

I'm working with the following code, and when run I get nothing displayed on the screen. class ModelBase { public $db_server; public $db_user; public $db_password; static $db_conn; public static $DBSERVER="localhost"; public static $DBUSER="user"; public static $DBPASSWORD="password"; public static $...

How can I download and extract a zipped CSV and get the contents of CSV file into a MySQL table.

I'm trying to write a PHP script to download a zip file from a web server that contains a single CSV file and then load the contents of the extracted CSV file into an existing MySQL database table. $targetFile = 'data-' . md5(microtime()) . '.zip'; $url = 'http://www.address.com/data.zip'; $out = fopen('/path/to/zip/save/folder/' . $ta...

Relational databse, photos, votes and warnings

Hi, I'm designing a relational database, but I'm not too much experienced, so I'd like to ask a suggestion about the relational tables with photos. I thought to use a table to store photos, and one or more tables for user data and subject links, so the photos can be linked to different subjects, for example to houses, or trees, in this ...

List of list of named parameters in EJBQL/HQL

I'm trying to execute a long 'INSERT ON DUPLICATE KEY UPDATE' with up to a few thousand rows in a MySQL+JBoss+Hibernate application. It looks something like: INSERT INTO Table (field1, field2, field3) VALUES (value1_1, value2_1, value3_1), (value1_2, value2_2, value3_2), (value1_3, value2_3, value3_3), ... ON DUPLICATE KEY UPDATE ... ...

DBD::mysql: How can I write with "SELECT * INTO file" to my home-directory?

Hello, is there a way to make this work? (write the out_file to my home-directory) #!/usr/bin/perl use warnings; use strict; use File::Spec::Functions; use File::HomeDir; use DBI; my $database = 'my_db'; my $table = 'my_table'; my $user = 'user'; my $passwd = 'password'; my $dbh = DBI->connect( "DBI:mysql:$database;", $user, $passwd,...

Load Balancing of PHP/MYSQL script without big code changes

Sorry for my Dummy Question, but... I am making a script on php/mysql (codeigniter) and I am extremally interested in knowing if there is a way without big architectural changes of the script make a load balancing. I mean, that for example now I will rent a medium dedicated server with 2GB ram, 200GB memory and good processor, and this...

PHP What information need to be store/maintained to ensure website quality and keep it safe?

Hi all, MY PLATFORM: PHP & mySQL MY SITUATION: I am building an app. where users can sign up for an account for the services that I provide. I want to restrict a user from signing up for multiple accounts and users from all over the world can create an account of their own. That being said: What can I do to prevent multiple accounts...

Can this Postgresql table be converted to a MySql table?

Given a Postgresql table schema: create table thing ( id serial primary key, key text, type int references thing, latest_revision int default 1, created timestamp default(current_timestamp at time zone 'utc'), last_modified timestamp default(current_timestamp at time zone 'utc') ); $for name in ['key', 'type',...

[MySQL]: table view or actual table. (tracing a primary key)

Hi, I have a Database that has the following relations: Transaction->Purchase->Item->Schedule Transaction - self explanitory Purchase - any purchase info that relates to the item being purchased (quantity, if the user purchases more than one item). A given Transaction can have more than one Purchase_ID tied to it. Item - Stores Item ...

jQuery Form Input Suggestion

Hello, I'm designing a web app, and need a way to pull strings out of a MySQL database and display them as drop down suggestions as the user types data in a form. For example if the user has entered: "stac" the app should search the DB and provide suggestions like: "stack" "stackoverflow". I'm looking for something simalar to how a l...

mysql insert query not responding

i try to insert data to mysql with php code or phpmyadmin but the server waiting for a long and finally prints "not responding error". i can add value to db with logging in mysql using ssh connection. PHP Version 5.1.6 Mysql Client API version 5.0.77 i see error in the log Version: '5.0.77' socket: '/var/lib/mysql/mysql.sock' port: ...