Are there any ways to check whether my Mysql database and PHP script are optimal? I want to figure it out and fix if it's possible till I publish it on internet for many users.
Thanks.
Here is the code below that would explain you the problem...
I create a table below with an xml column and declare a variable, initialize it and Insert the Value into the xml column,
create table CustomerInfo
(XmlConfigInfo xml)
declare @StrTemp nvarchar(2000)
set @StrTemp = '<Test></Test>'
insert into [CustomerInfo](XmlConfigInfo)
values (@StrTemp)
Then comes the part of the question,, if I write this...
update [CustomerInfo] set XmlConfigInfo.modify('insert <Info></Info> into (//Test)[1]')
-- Works Fine!!!
but when I try this,
set @StrTemp = 'insert <Info></Info> into (//Test)[1]'
update [CustomerInfo] set XmlConfigInfo.modify(@StrTemp)
-- Doesn't Work!!!
and throws an error
The argument 1 of the xml data type method "modify" must be a string literal.
is there a way around for this one?
I tried this, but it is not working :(
I would like to search for an image ID that contains a value AND a variable.
I need the below script to be something like $("[id*='MYVALUE'+x]") but that does not work.
for (x=0; x< imageList.length; x++)
{
var imageSRC = imageList[x];
//need this to be MYVALUE + the X val
//search for IDs that contain MYVALUE + X
$("[id*='MYVALUE']").attr('src', 'images/'+imageSRC);
};
<!-- These images are replaced with images from the array imageList-->
<img id="dkj958-MYVALUE0" src="images/imageplaceholder" />
<img id="mypage-MYVALUE1" src="images/imageplaceholder" />
<img id="onanotherpage-MYVALUE2-suffix" src="images/imageplaceholder" />
I've got a mysql dataset that contains 86 million rows.
I need to have a relatively fast search through this data.
The data I'll be searching through is all strings.
I also need to do partial matches.
Now, if I have 'foobar' and search for '%oob%' I know it'll be really slow - it has to look at every row to see if there is a match.
What methods can be used to speed queries like this up?
G-Man
I am looking for few global variable in mysql which are equivalent of sql server.
I want the whole list
eg.
Sql Server Equivalent
@@error ---
@@Identity ---
etc.
Basically right now I want to know what are the equivalent variable of @@error and @@identity.
But it will be helpfull if u could provide some other variable also
What could possibly go wrong with the following transaction if executed by concurrent users in the default isolation level of READ COMMITTED?
BEGIN TRANSACTION
SELECT * FROM t WHERE pid = 10 and r between 40 and 60
-- ... this returns tid = 1, 3, 5
-- ... process returned data ...
DELETE FROM t WHERE tid in (1, 3, 5)
INSERT INTO t (tid, pid, r) VALUES (77, 10, 35)
INSERT INTO t (tid, pid, r) VALUES (78, 10, 37)
INSERT INTO t (tid, pid, r) VALUES (79, 11, 39)
COMMIT
I am trying to run MySql 5.1 on Windows 7 Home Premium 64 bit. I have downloaded the MSI installer from the MYSql website and installed it. The installation is successful, but the service does not start.
If I try to run MySql manually using the mysqld executable, it crashes immediately on running (error: mysqld.exe has stopped working).
Earlier mysql was running on the machine, but I had some problem with it (wasn't executing big queries) and installed it again which somehow broke the program. I had installed it to work as a service which started giving me this isse, and now it won't work even if I don't install it as a service.
I have tried removing the mysql folder and re-installing. Is there somewhere else where Mysql saves configuration info or other data?
Has anyone else found this problem and solved it?
How can I find out why the process is failing to run?
I'm provisioning a Vagrant box with Ansible, and using Benno Joy's MySQL role to setup MySQL (including creating a database and users.) The database name and credentials are stored in a .env file in the project's root. What would be the idiomatic way to use these variables when provisioning MySQL?
Should I write a custom script that generates a YAML file from my .env, and then use the include_vars module? Or is there a simpler way?
How do I write the following in MYSQL?
SELECT SUBSTRING(value - (1 TRAILING CHARACTER)) FROM table;
Basically substring(value, 2) trims the first letters. But I need to trim the last letters. I can't use substring(value, -4, 3) because I don't know the length of the value.
Here's another example:
SELECT * FROM table WHERE SUBSTRING(value - (4 TRAILING CHARACTER)) in (SELECT SUBSTRING(value - (1 TRAILING CHARACTER)) FROM table);
I have a problem in my project that i am displaying a activity which would contain the details of the project which is previously added in Project Management System..
Now the fields in it are like:
Fields of the Activity
Name Of Project: ABC(EditText)
Name Of Developer : ________(Spinner)
Deadline : ________(Date Picker)
Created On : _______(TextView)
.
.
Now, the Spinner contains the Names of all developers working in the Company..I have used the ArrayAdapter with a array having the names of all the developers which is fetched from the database..
The problem is that when i update the Name Of Developer field, i get Only the Name of the Developer which is not enough to update the data as their can be multiple developers with the same name in the Company..So now I require the id of the developers to update it..
How to store that id of the developers with the Spinner so that i can achieve this..
Please help me to sort this out.
Actually what i want to do like is as that we do in html::
<select>
<option id="1">Developer1</option>
<option id="2">Developer2</option>
<option id="3">Developer2</option>
<option id="4">Developer2</option>
</select>
where the id attached would be the database id....I want to imitate this in our android....
This the code that i have used to store the names in the array::
String alldevelopers = null;
try {
ArrayList<NameValuePair> postP = new ArrayList<NameValuePair>();
alldevelopers = CustomHttpClient.executeHttpPost(
"/fetchdevelopers.php", postP);
String respcl = alldevelopers.toString();
alldevelopersParser dev = new alldevelopersParser();
ow = dev.parseByDOM(respcl);
} catch (Exception e) {
e.printStackTrace();
}
String developers[] = new String[ow.length]; //dev is a class object
for (int n = 0; n < ow.length; n++)
{
developers[n] = ow.developer[n][2];
}
This is the Spinner that would spin the array..
final Spinner devl = (Spinner) findViewById(R.id.towner);
devl.setOnItemSelectedListener(managetasks.this);
ArrayAdapter<String> b =
new ArrayAdapter<String>getApplicationContext(),
android.R.layout.simple_spinner_item,developers);
b.setDropDownViewResource(android.R.layout.simple_dropdown_item_1line);
devl.setAdapter(b);
I need to migrate my db from sqlite to mysql, and the various tools/scripts out there are too many for me to easily spot the safest and most elegant solution.
This seemed to me nice http://djangosnippets.org/snippets/14/ but appears to be 3 years since getting an update which is worrying..
Can you recommend a solution that is known to be reliable with Django 1.1.1 ?
Where can I find tutorials about creating a social network (like db structure, sql query samples eg.) using PHP & MySQL ? I do not need a ready script, I just want to learn how to do it..
I need to get the number of days contained within a couple of dates on mysql.
For example: Check in date 12-04-2010 Check out date 15-04-2010 and the day difference would be 3
I hope that was clear
Thanks
I have a mysql query:
$query = "SELECT * FROM movielist WHERE genre = 'comedy' ORDER BY dateadded DESC";
I need to change it so that it selects from movielist where genre contains 'comedy'.
(Note: that my genre field will often contain more than one genre example "comedy, action, drama".
Apart from blocking other threads reading from the cache what other problems should I be thinking about when locking the cache insert method for a public facing website.
The actual data retrieval and insert into the cache should take no more than 1 second, which we can live with. More importantly i don't want multiple thread potentially all hitting the Insert method at the same time.
The sample code looks something like:
public static readonly object _syncRoot = new object();
if (HttpContext.Current.Cache["key"] == null)
{
lock (_syncRoot)
{
HttpContext.Current.Cache.Insert("key", "DATA", null, DateTime.Now.AddMinutes(5), Cache.NoSlidingExpiration, CacheItemPriority.Normal, null);
}
}
Response.Write(HttpContext.Current.Cache["key"]);
Just wondering if there are any good tutorials on PHP/MySQL on the web that's free. I looked at youtube and the tutorials they have there are a bit too easy.
I am on a Linux ubuntu machine with MySQL installed.
My teacher gave out an assignment which mentioned "copy cars.dat to /data/tmp on the MySQL database server" without any explanations, I do not know what is the "/data/tmp on database server" means exactly?
Basically after that I need to execute SQL statement like
LOAD DATA INFILE '/data/tmp/cars.dat' INTO TABLE cars
So, what does copy cars.dat to /data/tmp on the database server means as there is no /data/tmp directory even?
Personally, I checked /etc/mysql/my.cnf file, inside which there are definitions of :
...
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
...
Does it mean to copy cars.dat to the tmpdir which is just /tmp under root directory??
I couldn't find anything about this in MySQL documentation.
SELECT accesion_id,
definition
FROM accesion_table
WHERE search_word @@ ? OFFSET ? LIMIT Const.MAX_DISP_COUNT;
I have a listing of names, that I want to store in mysql as a serialized array (for caching purposes). Some names contain apostrophes, and for some reason won't un-serliaze properly. There is no output.
I am looking for resources and references for a MySql equivalent to MSSql SMO. Also, is SMO the newest technology for programmatic management of Sql server?
While i'm sure i can write a CRON to do this and some how open the ports on a network hd in my house, to be honest i'd rather spend a bit of money on some good software with a nice visual interface!
are there any such all-in-one server backup systems?
nightly backups of the MYSQL db
weekly backups of entire site (images etc)
my server is a VPS hosted by https://www.memset.com.
I need to import a text file into a temporary table and from that select portions of it to insert in different tables. I wanted to use 'LOAD DATA INFILE'.
Is there any way, i can use 'Load data infile' in a stored procedure.
I am using mysql.
LOAD DATA LOCAL INFILE 'C:\\MyData.txt' INTO TABLE
tempprod fields terminated by ',' lines terminated by '\r\n';
SELECT * FROM product p;
Hi,
I want write these SQL Query:
CREATE VIEW `uniaverage` AS select `averagegrade`.`mjr`,`averagegrade`.`lev` , avg(`averagegrade`.`average`) AS `uniAVG` from `averagegrade` group by `averagegrade`.`lev`, `averagegrade`.`mjr`;
But MySQL Query Browser give this error:
Operand Should Contain 1 column(s)
I somewhere read can use group by on more than 1 column!!!
How can I solve this error? or how can I change the Query to get the same result?