Re: forum vs email

2014-12-12 Thread Lucio Chiappetti
True; and before that there was yahoo groups, and others. Those are not 
fora, however, merely web interfaces to mailing lists / newsgroups.


as a lurker on this list, I jump in. It is curious that newsgroups are 
mentioned only en passant, and NNTP is not mentioned at all.


Still vastly prefer email over fora, as interfaces go. Better 
read/unread views,


Personally I prefer the e-mail INTERFACE, and a good old(-fashioned) email 
client (I use alpine) allows to access with the same interface mail and 
NNTP newsgroups. I am in general not keen of forums because they are not 
interoperable with e-mail (one cannot save a message in a mail folder) 
and usually have each one its own interface ... I don't like to get lost 
in a maze of little forums all different (cit.)


of the (for me, at least) defining features of a forum, is that the 
subjects tend to be divided up into a tree structure, which has it's own 
benefits;


Threading is possible also with NNTP, and in the way and extent chosen by 
the user and the possibilities of the reading agent.


I do subscribe to mailing lists, but usually in MIME-digest mode whenever 
it is allowed. This way I receive a digest once per day, I skim through 
the subjects, and only if I see something interesting I expand the digest 
in a folder, and read the interesting messages. Rarely I could save a 
particularly interesting one in a folder, or reply and take part to a 
thread. I do not keep track of all (other) messages, usually there are the 
list archives.


I use nntp newsgroups, in a very simple threaded mode, I subscribe 
interesting groups and look at them once a day or sometimes more 
frequently. I skim through thread titles, expand the interesting ones, 
read the messages, then occasionally save an interesting one to a mail 
folder or reply and take part to a thread. When I exit I usually mark as 
deleted all posts except mine or a few I keep pending. Next time I enter 
I'll see only new posts and the few undeleted. Of course I can resurrect 
the deleted ones insofar they are still on the NNTP server.
I do not particularly care of the fact they expire from the server after 
some week/months. In the past there was dejanews, present google groups is 
not as good as a way to look for old stuff.


I do subscribe regularly only to two forums, and both use the PhpBB 
interface. I may have registered to other forums to ask a question, but 
may come back to them only if I have another one. On the forums I follows 
(and to which I take part), I keep the view of new (or recent) messages 
so I can see only the recent traffic and skim through interesting stuff. I 
regret there is no way to save interesting messages locally with one tick 
(but the topics of those forums do not deserve it ... eventually phpBB 
has an internal bookmarking mechanism)
Threads in forums tend to last forever or at least longer than they 
deserve and some forumers complain if one opens a new thread instead of 
posting in an existing one.


--

Lucio Chiappetti - INAF/IASF - via Bassini 15 - I-20133 Milano (Italy)
For more info : http://www.iasf-milano.inaf.it/~lucio/personal.html

Do not like Firefox =29 ?  Get Pale Moon !  http://www.palemoon.org

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: command is not allowed with this MySQL version

2014-12-12 Thread Johan De Meersman

- Original Message -
 From: yoku ts. yoku0...@gmail.com
 Subject: Re: command is not allowed with this MySQL version
 
 Christophe has already told,
  The used MySQL version is 5.5.40 from Debian Wheezy package.

No, that's the new version. It'd be fun to know what the OLD version was, too.

 Maybe you missed *mysql command-line client's --local-infile option*

Not particularly helpful, since Christophe already said it's a PHP application 
:-)


-- 
Unhappiness is discouraged and will be corrected with kitten pictures.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: Xml data import

2014-12-12 Thread Johan De Meersman

- Original Message -
 From: Sayth Renshaw flebber.c...@gmail.com
 Subject: Xml data import
 
 I have an xml data feed with xsd, it's complex in elements not size. Wray
 are the best way to get data into mysql, do I have to hack with xquery?

That's going to depend on the complexity of your XML and how much of that 
complexity you want preserved. There's definitely libraries out there that can 
map XML (tree) structures onto relational structures; although it's been so 
long since I played with XML that I really couldn't tell you which ones.

 My goal is to be able create queries and send csv files out for analysis in
 R and plots in ggplot2. Also render done other off the initial days to the
 Web usually xslt from xml.

I suppose that worstcase you could use XSLT to transform into a flatter 
structure, maybe even CSV?


-- 
Unhappiness is discouraged and will be corrected with kitten pictures.

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: Re: signal handling in mysql cli

2014-12-12 Thread rafal somla

Hello Sebastein,

On 2014-12-03 17:25, Sebastien FLAESCH wrote:

Hi all,

I have a similar question regarding KILL QUERY usage:

We have a C client program using libmysqlclient.so, it is a
single-threaded program.

When running a long query, how can I send the KILL QUERY command when a
SIGINT (CTRL-C)
is caught? (of course we implement a signal handler, so we keep the
control)

= Is is safe to establish a new connection to the server in the signal
handler, using
mysql_init() + mysql_real_connect(), and execute the KILL QUERY with the
mysql thread
id I got from the initial mysql_init() / mysql_real_connect()?

I made some tests, and it seems to work fine, the long query returns SQL
error -1317:
Query execution was interrupted (which is expected)

We want to support SQL interruption properly, so please someone from the
dev team,
give me a clear answer... I don't want to use a side effect or
undocumented feature.


Issuing KILL QUERY from a separate connection is the way to do it. We do 
not currently have any CAPI abort function - introducing such 
functionality would require changes on the protocol level.




Doing all this stuff in a signal handler is certainly risky... no?


Whether it is safe to do I/O extensive work inside a signal handler is 
another topic, not related to MySQL client library. Depends on your 
particular case and how careful you are about writing handler code which 
can be executed at any time. One safe option is that signal handler only 
sets a flag informing about the signal and then either the main logic of 
your application detects the flag and performs KILL operation, or you 
have a separate dedicated thread to do this job.


Rafal (from Connectors/C team @ MySQL)



I could not find the information in the documentation (mysql_real_connect).

I wish there would be an API like mysql_cancel_query(), similar to
Oracle's OCI
OCIBreak().

Thanks!
Seb



On 12/02/2014 05:13 PM, walter harms wrote:

hi list,

when i use CTRL-C to break a query that works fine in interactive mode.

mysql select sleep(10) ;
^CCtrl-C -- sending KILL QUERY 24289 to server ...
Ctrl-C -- query aborted.
+---+
| sleep(10) |
+---+
+---+
1 row in set (0.86 sec)

but when i use the noninteractive mode
   timeout 5 mysql -BAN -e select now(); select sleep (100) ; select
now() 

i looks like that  but show full processlist; shows otherwise and
that is true
as a list of long running querys showed.

Is there a way to make it behave like the interactive version ?
Now it is a bit confusing for everyone.

re,
  wh






--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



[Solved] Re: command is not allowed with this MySQL version

2014-12-12 Thread Christophe

Hi,

Le 12/12/2014 11:51, Johan De Meersman a écrit :


- Original Message -

From: yoku ts. yoku0...@gmail.com
Subject: Re: command is not allowed with this MySQL version

Christophe has already told,

The used MySQL version is 5.5.40 from Debian Wheezy package.


No, that's the new version. It'd be fun to know what the OLD version was, too.



Absolutely no idea : The app was running on a shared hosting, and don't 
have access to it ...






Maybe you missed *mysql command-line client's --local-infile option*


Not particularly helpful, since Christophe already said it's a PHP application 
:-)




Right :) and the solve was in PHP behavior (all seems fine now ...) .

The configuration was fine, but to take care of 'local-infile' parameter 
in PHP configuration (and on Debian) the php5-mysqlnd package must be 
installed instead of php5-mysql.


Hoping this can help someone in the future.

Regards.

Christophe.


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: signal handling in mysql cli

2014-12-12 Thread Sebastien FLAESCH

Thank you Rafal for your answer!

We do not use threads, it's a single threaded program. So we cannot set
a flag to exec the KILL QUERY later on in another thread.

The only flag I use is to avoid subsequent KILL QUERY attempts when one
has already been sent...

The code in the sigint handler is quite simple, basic mysql_ calls and
debug messages (fprintfs):

if (currConn  currConn-canInterrupt) {
char cmd[50];
MYSQL *h;
currConn-canInterrupt = 0;
h = mysql_init(NULL);
if (!mysql_real_connect(h, currConn-c_host, currConn-c_user,
currConn-c_auth, currConn-c_dbnm,
currConn-c_port, currConn-c_sock,
CLIENT_FOUND_ROWS)) {
DBGMSGINT(2, Interrupt: Could not connect to database: %d.,
  mysql_errno(h));
return 0;
}
sprintf(cmd, KILL QUERY %ld, currConn-threadId);
if (mysql_query(h, cmd) != 0) {
DBGMSGSTR(2, Could not execute %s., cmd);
}
mysql_close(h);
}


Should do the job...

Thanks.
Seb

On 12/12/2014 12:12 PM, rafal somla wrote:

Hello Sebastein,

On 2014-12-03 17:25, Sebastien FLAESCH wrote:

Hi all,

I have a similar question regarding KILL QUERY usage:

We have a C client program using libmysqlclient.so, it is a
single-threaded program.

When running a long query, how can I send the KILL QUERY command when a
SIGINT (CTRL-C)
is caught? (of course we implement a signal handler, so we keep the
control)

= Is is safe to establish a new connection to the server in the signal
handler, using
mysql_init() + mysql_real_connect(), and execute the KILL QUERY with the
mysql thread
id I got from the initial mysql_init() / mysql_real_connect()?

I made some tests, and it seems to work fine, the long query returns SQL
error -1317:
Query execution was interrupted (which is expected)

We want to support SQL interruption properly, so please someone from the
dev team,
give me a clear answer... I don't want to use a side effect or
undocumented feature.


Issuing KILL QUERY from a separate connection is the way to do it. We do not currently 
have any CAPI abort function - introducing such functionality
would require changes on the protocol level.



Doing all this stuff in a signal handler is certainly risky... no?


Whether it is safe to do I/O extensive work inside a signal handler is another 
topic, not related to MySQL client library. Depends on your particular
case and how careful you are about writing handler code which can be executed 
at any time. One safe option is that signal handler only sets a flag
informing about the signal and then either the main logic of your application 
detects the flag and performs KILL operation, or you have a separate
dedicated thread to do this job.

Rafal (from Connectors/C team @ MySQL)



I could not find the information in the documentation (mysql_real_connect).

I wish there would be an API like mysql_cancel_query(), similar to
Oracle's OCI
OCIBreak().

Thanks!
Seb



On 12/02/2014 05:13 PM, walter harms wrote:

hi list,

when i use CTRL-C to break a query that works fine in interactive mode.

mysql select sleep(10) ;
^CCtrl-C -- sending KILL QUERY 24289 to server ...
Ctrl-C -- query aborted.
+---+
| sleep(10) |
+---+
+---+
1 row in set (0.86 sec)

but when i use the noninteractive mode
   timeout 5 mysql -BAN -e select now(); select sleep (100) ; select
now() 

i looks like that  but show full processlist; shows otherwise and
that is true
as a list of long running querys showed.

Is there a way to make it behave like the interactive version ?
Now it is a bit confusing for everyone.

re,
  wh









--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: How to retrieve next record?

2014-12-12 Thread Trianon 33

Thanks Martin,

But loading ALL the records sums up to (now) 10 mio records and further 
on in future up to 100 mio records.

H, don't think that's wise.

Nevertheless, thanks for thinking alog.

BR, Hans.





Martin Gainty schreef op 11-12-14 om 23:33:

If you *dont* mind implementing your fetch in PHP:
Get ALL of the records into a resultset
then fetch each record one a time from the resultset e.g.
if($con != null)
{   //start $con!=null
$res = mysqli_query($con, SELECT *FROM Table); //we have all 
records in $res
if ($res != null)
{ //check to make sure resultset != null
   $rowcount = 0;
   $row=mysqli_fetch_array($res,MYSQLI_ASSOC); //get the first 
record from the resultset $res
   while($rowcount  $res-num_rows)
   { // start while
  $row = mysqli_fetch_array($res); //get the NEXT 
record from the resultset $res
 $rowcount = $rowcount + 1;
}
   } //end res!=null
   } //end $con!=null

Martin Gainty

 




Date: Thu, 11 Dec 2014 14:07:33 -0800
Subject: Re: How to retrieve next record?
From: mussa...@csz.com
To: larry.mart...@gmail.com
CC: mysql@lists.mysql.com

On Thu, December 11, 2014 13:43, Larry Martell wrote:

On Thu, Dec 11, 2014 at 4:34 PM, Trianon 33 triano...@gmail.com wrote:

Hi all,

It seems like a simple question, however I'm not able to find the
answer.

Let me explain. I have a DB with lots of columns, one is labeled as
'kenteken' and it is also the primary key in the DB. I poke into this DB
with the command

$sDBQuery1 = SELECT * FROM kentekenlogtest WHERE kenteken =
'$sActueelkenteken';

This is ok and gives me the correct result. However, then I want the
next
row (according to the primary key), but with what command?

That's were I'm stuck.

Didn't find anything like NEXT, so... what to look for?


What do you mean by 'next' row? Since you're querying by primary key
you will only get one row, right?


Related what is the form of the prmary key.  If its numeric something like
  $sDBQuery1 = SELECT * FROM kentekenlogtest WHERE kenteken 
'$sActueelkenteken' limit 1
might work.

--
William R. Mussatto
Systems Engineer
http://www.csz.com
909-920-9154


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql






--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: How to retrieve next record?

2014-12-12 Thread Trianon 33

Thanks Johan,

You're partly right in your interpretation, but not in total :-)

Later on in time  I'll lift a tip.

I need some time to process your answer and do my homework.

Nevertheless I've got already something that works, but maybe isn't the 
most efficient.


Nevertheless a good start, thanks.

BR, Hans.


Johan De Meersman schreef op 11-12-14 om 23:44:

- Original Message -

From: Wm Mussatto mussa...@csz.com
Subject: Re: How to retrieve next record?
Related what is the form of the prmary key.  If its numeric something like
$sDBQuery1 = SELECT * FROM kentekenlogtest WHERE kenteken 
'$sActueelkenteken' limit 1
might work.

No, kenteken is dutch for license plate. If so, not numeric, although 
greater/less comparisons do work on strings, too. My guess, from the sample 
queries, would be that this is processing for some form of automated number 
plate recognition system :-)

Now, Hans, besides pointing you in the right direction, I'm going to be whining 
a bit about some pet peeves of mine. I'm waiting for the start of a midnight 
intervention, anyway :-p

That query, as pointed out already, is only asking for a single kenteken. I'll 
stick to the dutch column names for clarity for other readers, btw - although 
one of the aforementioned pet peeves is nonenglish variable names. Makes code 
an absolute bitch to maintain for someone who doesn't speak that language. 
That's from experience; I've had to debug crap in french and spanish, among 
other languages.

Your code (or, more precisely, the DB driver) is only going to make those 
records available to your program that you have explicitly asked for, so that 
query will only ever make the one record available. You will need to build a 
query that returns all the records you want to access, or, alternatively, make 
repeated queries. The former is more efficient by far; the latter is useful if 
the next set depends on what you find in the previous set.

Another pet peeve: don't use select *. Explicitly select the columns you're 
looking for. It a) saves network bandwith; b) guards against later table 
structure changes; c) potentially allows the use of covering indexes and d) 
reduces the server memory footprint required for sorting etc.

Once you built the correct query, you'll need to have a cursor to loop through it. 
Your DB driver will probably refer to it as a resultset or a similar denomination. 
The typical buildup for a database connection (bar advanced abstraction layers) is 
db_connect (returns a database handle); dbh-execute(sql) (returns a resultset 
handle); loop using rs-fetch_next (probably returns an array or hash with the 
data). See your language's db class documentation for the gritty details there. You 
may also find a fetch_all or similar which returns you the entire resultset in a 
single call. Can be useful, but remember that that means allocating memory clientside 
for the entire dataset in one go, instead of reusing the same variables row for row.

A further pet peeve: don't just dump variables into your sql string, use bind variables. 
The easy method opens you up for little Bobby Tables. Google that, if you're 
unfamiliar with it. Then weep in despair :-p

The idea of bind variables is fairly simple: you stick placeholders in your sql 
string where you would otherwise use string interpolation; then tell the 
statement handle the variables that should go in there. The database is 
actually aware of this method, so there is no chance that the variables might 
get interpreted as part of the SQL - it KNOWS they're variables, not keywords.

Additionally, if you're going to be executing the same statement repeatedly, 
use prepared statements instead of regular executes. On MySQL the benefit is 
marginal (but still noticeable), on other databases it might be considerable - 
sometimes orders of magnitude faster. Oracle, for instance, has an execution 
plan cache; so if you use prepared statements, it can skip the whole parse - 
analyze - pick plan bit and skip straight to the next execution round with the 
new values you provided. On fast statements (like primary key lookups) that can 
sometimes save 80% and more of the roundtrip time.

The abovementioned where-clause with limit is probably also going to work; but 
then you'll need to re-query time after time; and limit does not always work 
quite intuitively - although in this simple case, it does. If you *must* 
re-query time after time, do a speed comparison with and without prepared 
statements; otherwise do go for the fetch_next loop.


Now, you've got documentation to read, I believe. Off you go :-)

/johan




--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: command is not allowed with this MySQL version

2014-12-12 Thread hsv
 2014/12/12 02:10 +0100, Christophe 
When the app tries to do this, it raises an error :

'The used command is not allowed with this MySQL version'

The used MySQL version is 5.5.40 from Debian Wheezy package.

I found that some parameters or variables (local_infile for instance) can be 
used to get rid of this error, but can't really find the right configuration. 

Well, yes, if local_infile is 0 or FALSE then 'LOCAL' is forbidden. If 'LOCAL' 
is not used then the MySQL user needs privilege 'FILE' to read from the server 
s own disk.
What else have you tryed, with what outcome? because the statement as it stands 
is good MySQL.


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Function

2014-12-12 Thread Alexander Syvak
Hello!

How is actually a function done internally in MySQL after CREATE FUNCTION
statement?

Why can't there be a dynamic SQL inside a function?


Re: Xml data import

2014-12-12 Thread Sayth Renshaw
So it is definitely achievable, I see other db's converting xml2json etc to
get it in.

Sends odd that xml had done great document qualities but as a data format
it seems rather hard to work with.

Sayth

On Fri, 12 Dec 2014 9:55 PM Johan De Meersman vegiv...@tuxera.be wrote:


 - Original Message -
  From: Sayth Renshaw flebber.c...@gmail.com
  Subject: Xml data import
 
  I have an xml data feed with xsd, it's complex in elements not size. Wray
  are the best way to get data into mysql, do I have to hack with xquery?

 That's going to depend on the complexity of your XML and how much of that
 complexity you want preserved. There's definitely libraries out there that
 can map XML (tree) structures onto relational structures; although it's
 been so long since I played with XML that I really couldn't tell you which
 ones.

  My goal is to be able create queries and send csv files out for analysis
 in
  R and plots in ggplot2. Also render done other off the initial days to
 the
  Web usually xslt from xml.

 I suppose that worstcase you could use XSLT to transform into a flatter
 structure, maybe even CSV?


 --
 Unhappiness is discouraged and will be corrected with kitten pictures.



Re: Xml data import

2014-12-12 Thread Larry Martell
On Fri, Dec 12, 2014 at 4:52 PM, Sayth Renshaw flebber.c...@gmail.com wrote:
 So it is definitely achievable, I see other db's converting xml2json etc to
 get it in.

I use this https://github.com/hay/xml2json

 Sends odd that xml had done great document qualities but as a data format
 it seems rather hard to work with.

Indeed.


 On Fri, 12 Dec 2014 9:55 PM Johan De Meersman vegiv...@tuxera.be wrote:


 - Original Message -
  From: Sayth Renshaw flebber.c...@gmail.com
  Subject: Xml data import
 
  I have an xml data feed with xsd, it's complex in elements not size. Wray
  are the best way to get data into mysql, do I have to hack with xquery?

 That's going to depend on the complexity of your XML and how much of that
 complexity you want preserved. There's definitely libraries out there that
 can map XML (tree) structures onto relational structures; although it's
 been so long since I played with XML that I really couldn't tell you which
 ones.

  My goal is to be able create queries and send csv files out for analysis
 in
  R and plots in ggplot2. Also render done other off the initial days to
 the
  Web usually xslt from xml.

 I suppose that worstcase you could use XSLT to transform into a flatter
 structure, maybe even CSV?


 --
 Unhappiness is discouraged and will be corrected with kitten pictures.


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



Re: Xml data import

2014-12-12 Thread Sayth Renshaw
And does that then lead you to use Fabric?

http://de.slideshare.net/mobile/nixnutz/mysql-57-fabric-high-availability-and-sharding

Sayth

On Sat, 13 Dec 2014 9:06 AM Larry Martell larry.mart...@gmail.com wrote:

 On Fri, Dec 12, 2014 at 4:52 PM, Sayth Renshaw flebber.c...@gmail.com
 wrote:
  So it is definitely achievable, I see other db's converting xml2json etc
 to
  get it in.

 I use this https://github.com/hay/xml2json

  Sends odd that xml had done great document qualities but as a data format
  it seems rather hard to work with.

 Indeed.


  On Fri, 12 Dec 2014 9:55 PM Johan De Meersman vegiv...@tuxera.be
 wrote:
 
 
  - Original Message -
   From: Sayth Renshaw flebber.c...@gmail.com
   Subject: Xml data import
  
   I have an xml data feed with xsd, it's complex in elements not size.
 Wray
   are the best way to get data into mysql, do I have to hack with
 xquery?
 
  That's going to depend on the complexity of your XML and how much of
 that
  complexity you want preserved. There's definitely libraries out there
 that
  can map XML (tree) structures onto relational structures; although it's
  been so long since I played with XML that I really couldn't tell you
 which
  ones.
 
   My goal is to be able create queries and send csv files out for
 analysis
  in
   R and plots in ggplot2. Also render done other off the initial days to
  the
   Web usually xslt from xml.
 
  I suppose that worstcase you could use XSLT to transform into a flatter
  structure, maybe even CSV?
 
 
  --
  Unhappiness is discouraged and will be corrected with kitten pictures.
 

 --
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/mysql