bug report: Embedded MySQL v4.04b

2002-11-15 Thread Matt Solnit
===
Bug report -- MySQL v4.04b, source distribution
===


Machine specs (build machine and test machine are same machine):

Dell Inspiron 8200 laptop
Windows XP Professional SP1
.NET Framework SP2

--
Build description:
--
libmysqld.dll was built using Microsoft Visual C++ 6.0 SP5 and Microsoft
Visual C++ Processor Pack SP5 (used for ASM files).  We build our own
version because we need to make a change so that the DLL will work with
C# clients (see below for more info).


Problem description:

A C# client was built using Microsoft Visual Studio.NET.  The client
calls mysql_server_init(), mysql_server_end(), and mysql_server_init()
again.  On second call to mysql_server_init(), the exception
System.NullReferenceException is thrown.

From an equivalent C++ program, an access violation occurs at the same
point.

Behavior is identical using debug and release builds of libmysqld.dll.


C# code:


using System;
using System.Runtime.InteropServices;
using System.Security;

namespace Reproduce_Embedded_MySQL_crash
{

  class Class1
{

[STAThread]
static void Main(string[] args)
{
  MySqlAPI.ServerInit(0, null, null);
  MySqlAPI.ServerEnd();
  MySqlAPI.ServerInit(0, null, null);
  MySqlAPI.ServerEnd();
}
}

  class MySqlAPI
  {

[SuppressUnmanagedCodeSecurity]
[DllImport(libmysqld.dll,
   CharSet=System.Runtime.InteropServices.CharSet.Ansi,
   EntryPoint=mysql_server_init, ExactSpelling=true)]
public static extern int ServerInit(int icArgs, string [] strArgs,
string [] strGroups);


[DllImport(libmysqld.dll,
   EntryPoint=mysql_server_end, ExactSpelling=true)]
public static extern void ServerEnd();

  }
}

-
C++ code:
-

//
/* modified from test_dll.cpp that ships with MySQL */
//

#include stdafx.h
#include winsock.h
#include mysql.h
#include stdarg.h
#include stdio.h
#include stdlib.h

const char *server_groups[] = {
  test_libmysqld_SERVER, embedded, server, NULL
};

int main(int argc, char* argv[])
{
  mysql_server_init(argc, argv, (char **)server_groups);
  mysql_server_end();
  mysql_server_init(argc, argv, (char **)server_groups);
  mysql_server_end();

  return 0;
}


---
MySQL binaries:
---
Upon request, I can supply our debug and release builds of
libmysqld.dll.

---
Source code change description:
---
There is only one change we make to the MySQL 4.04b source distribution.
We define USE_TLS for the mysys project.  The reason is that it's
required for clients that use LoadLibrary(), which includes all C#
clients.  More information can be found in the VC++ documentation
article Rules and Limitations for TLS.

---
My contact information:
---
Matt Solnit [EMAIL PROTECTED]

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Bug report: Embedded MySQL v4.04b

2002-11-27 Thread Matt Solnit
:
---
There is only one change we make to the MySQL 4.04b source distribution.
We define USE_TLS for the mysys project.  The reason is that it's
required for clients that use LoadLibrary(), which includes all C#
clients.  More information can be found in the VC++ documentation
article Rules and Limitations for TLS.

---
My contact information:
---
Matt Solnit [EMAIL PROTECTED]


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




RE: Bug report: Embedded MySQL v4.04b

2002-11-27 Thread Matt Solnit
I am looking into USE_TLS.  But yes, I see that mysql_real_data_home is
not corrupted, only mysql_data_home is.

Thanks for your response.

-- Matt

-Original Message-
From: Heikki Tuuri [mailto:[EMAIL PROTECTED]] 
Sent: Wednesday, November 27, 2002 11:40 AM
To: Matt Solnit; [EMAIL PROTECTED]
Cc: Henry Bequet
Subject: Re: Bug report: Embedded MySQL v4.04b 

Matt,

thank you for the bug report.

I do not have C# in my computer. Did I understand correctly the bug does
not
appear if you use the Embedded Server Library inside C++?

My first note is that you should define USE_TLS in all MySQL modules,
like
Monty instructed a week ago. But I guess that cannot cause the
corruption of
mysql_data_home.

I looked at the source code, and it looks like mysql_data_home should be
a
pointer to a 512-character buffer called mysql_real_data_home, if you
define
a datadir, and that is not the default dir (that is, .\) of the running
program. Could it be that mysql_data_home starts to point into some
random
location?

I am forwarding this bug report to MySQL developers who know the mysqld
option processing best.

Best regards,

Heikki Tuuri
Innobase Oy
---
InnoDB - transactions, hot backup, and foreign key support for MySQL
See http://www.innodb.com, download MySQL-Max from http://www.mysql.com

sql query

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Bug report: Embedded MySQL version 4.05a

2002-12-10 Thread Matt Solnit
===
Bug report -- MySQL v4.05a, binary distribution
===

--
Machine specs:
--
Compaq Presario desktop
Windows XP Professional SP1
.NET Framework SP2


Problem description:

The security features of MySQL do not seem to work with Embedded MySQL.
Instead, every user is given full permissions.

-
Setup script:
-
USE mysql
DELETE FROM user WHERE user='';
DELETE FROM user WHERE user='root' AND host!='localhost';

USE test
CREATE TABLE mytable (a int);
GRANT SELECT ON mytable TO joe@localhost;
GRANT USAGE ON mytable TO jay@localhost;

FLUSH PRIVILEGES;

--
Observed behavior:
--
Running the mysql.exe client, anonymous users cannot connect to the
database, user 'joe' has read-only access to the table test.mytable, and
user 'jay' as no privileges.

Running the mysql-server.exe host, all users have full privileges.

Additionally, the GRANT statement in mysql-server.exe returns error 1047
(Unknown command).

---
Possible cause:
---
The function acl_init() which loads the ACL's for each user on startup,
includes a parameter, dont_read_acl_tables, that can be set to true to
skip this step.  The purpose of this parameter according to the comments
is to support the --skip-grant command-line option.  However, the
mysql_server_init() function hard-codes this parameter value to 1, so
the ACL's never get loaded and every access succeeds.

---
My contact information:
---
Matt Solnit [EMAIL PROTECTED]

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Bug report: MySQL Embedded Server v4.0.10

2003-03-05 Thread Matt Solnit


Bug report -- MySQL Embedded Server v4.0.10, binary distribution for
Windows




Machine specs:

Compaq Presario desktop
Windows XP Professional SP1


Problem description:

There are two bugs:
The SHOW PROCESSLIST and KILL statements do not function as documented
when using the MySQL Embedded Server.

The SHOW PROCESSLIST statement returns an empty set.
The KILL statement causes an error 1094.

-
To reproduce:
-
Run the mysql-server.exe included with the MySQL binary distribution.

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.0.10-gamma-embedded

mysql SHOW PROCESSLIST;
Empty set (0.00 sec)

mysql KILL 1;
ERROR 1094: Unknown thread id: 1

---
My contact information:
---
Matt Solnit [EMAIL PROTECTED]



-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php



Maximum precision for DECIMAL column in MySQL

2003-05-31 Thread Matt Solnit
It looks like the maximum precision for a DECIMAL column is 17 in MySQL.
Is this documented anywhere?  I get the following results:

mysql CREATE TABLE `scale_test6` (`a_dec` decimal(30,23) default NULL)
TYPE=MyISAM;

mysql INSERT INTO scale_test6 (a_dec) VALUES
(12345678.123456789012345678901234);

mysql SELECT * FROM scale_test6;
+--+
| a_dec|
+--+
| 12345678.12345678900 |
+--+
1 row in set (0.00 sec)

Am I doing everything correctly?  I would have expected to see the
entire decimal stored correctly in the table.

-- Matt Solnit [EMAIL PROTECTED]



InnoDB exits process when files are read-only

2002-12-16 Thread Matt Solnit
Hi all,

I'm testing the fail-safety of InnoDB with MySQL, and I find that when
the data files are read-only, the process exits early instead of
returning an error code.

In the file innobase\os\os0file.c, the function os_file_handle_error()
does not recognize the error code 5, and so it terminates the process.

We are using Embedded MySQL, so when the process terminates, our EXE
goes down.  It would be ideal if the function could return an error code
so that we could continue.  Is there anything we can do?

Sincerely,
Matt Solnit [EMAIL PROTECTED]

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Bug report: UNIQUE KEY and DESCRIBE TABLE

2002-12-27 Thread Matt Solnit
===
Bug report -- MySQL v4.06, binary distribution
===

--
Machine specs:
--
Compaq Presario desktop
512 MB RAM
Windows XP Professional SP1


Problem description:

MySQL does not return key information about any column after the first
in a unique multi-column key.  Also, the MUL flag seems to indicate
that the key is non-unique, when in fact it is.

There is an equivalent symptom in the MySQL C API.  In the flags field
of the MYSQL_FIELD structure returned by mysql_fetch_field(), the
MULTIPLE_KEY_FLAG will only be present in the first column. 

-
Test script:
-
mysqlUSE test
mysqlCREATE TABLE mytable (a INT NOT NULL, b INT NOT NULL, c INT NOT
NULL, d INT NOT NULL, PRIMARY KEY (a), UNIQUE KEY (b, c));
mysqlDESCRIBE TABLE mytable;

--
Results:
--
+---+-+--+-+-+---+
| Field | Type| Null | Key | Default | Extra |
+---+-+--+-+-+---+
| a | int(11) |  | PRI | 0   |   |
| b | int(11) |  | MUL | 0   |   |
| c | int(11) |  | | 0   |   |
| d | int(11) |  | | 0   |   |
+---+-+--+-+-+---+


C test program:


/***
Expected output (according to manual section 8.4.1):

Column `a`: primary=1, unique=0, multiple=0
Column `b`: primary=0, unique=1, multiple=0
Column `c`: primary=0, unique=1, multiple=0
Column `d`: primary=0, unique=0, multiple=0

Actual output:

Column `a`: primary=1, unique=0, multiple=0
Column `b`: primary=0, unique=0, multiple=1
Column `c`: primary=0, unique=0, multiple=0
Column `d`: primary=0, unique=0, multiple=0
***/

#include stdafx.h
#include winsock.h
#include mysql.h
#include stdarg.h
#include stdio.h
#include stdlib.h

MYSQL *db_connect(const char *dbname);
void db_disconnect(MYSQL *db);
void db_do_query(MYSQL *db, const char *query);

const char *server_groups[] = {
  test_libmysqld_SERVER, embedded, server, NULL
};

int main(int argc, char* argv[])
{
  MYSQL *one;

  mysql_server_init(argc, argv, (char **)server_groups);
  one = db_connect(test);

  const char* query = SELECT * FROM mytable;
  mysql_query(one, query);
  MYSQL_RES* res = mysql_store_result(one);
  int numFields = mysql_num_fields(res);
  for (int i = 0; i  numFields; i++)
  {
MYSQL_FIELD* fld = mysql_fetch_field(res);
char* name = strdup(fld-name);
bool isPrimary = ((fld-flags  PRI_KEY_FLAG)  0);
bool isUnique = ((fld-flags  UNIQUE_KEY_FLAG)  0);
bool isMulti = ((fld-flags  MULTIPLE_KEY_FLAG)  0);
printf(column `%s`: primary=%d, unique=%d, multiple=%d\n, name,
isPrimary, isUnique, isMulti);
  }

  mysql_close(one);
  mysql_server_end();

  return 0;
}

static void
die(MYSQL *db, char *fmt, ...)
{
  va_list ap;
  va_start(ap, fmt);
  vfprintf(stderr, fmt, ap);
  va_end(ap);
  (void)putc('\n', stderr);
  if (db)
db_disconnect(db);
  exit(EXIT_FAILURE);
}

MYSQL *
db_connect(const char *dbname)
{
  MYSQL *db = mysql_init(NULL);
  if (!db)
die(db, mysql_init failed: no memory);
  /*
   * Notice that the client and server use separate group names.
   * This is critical, because the server will not accept the
   * client's options, and vice versa.
   */
  mysql_options(db, MYSQL_READ_DEFAULT_GROUP, test_libmysqld_CLIENT);
  if (!mysql_real_connect(db, NULL, NULL, NULL, dbname, 0, NULL, 0))
die(db, mysql_real_connect failed: %s, mysql_error(db));

  return db;
}

void
db_disconnect(MYSQL *db)
{
  mysql_close(db);
} 

---
My contact information:
---
Matt Solnit [EMAIL PROTECTED]

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Calculating innodb_additional_mem_pool_size?

2003-01-07 Thread Matt Solnit
Is there a good way of calculating the size for
innodb_additional_mem_pool_size?  I would like to calculate based on the
number of tables, rows, or whatever else I can use to pre-determine a
value so that the warning message allocating memory from the OS does
not appear.

-- Matt Solnit
[EMAIL PROTECTED]

P.S.  This is just here to satisfy the spam filter:  MySQL

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Disable log messages for Embedded Server?

2003-01-13 Thread Matt Solnit
Is there any way to disable log messages being written to the standard
output using Embedded Server?  Using mysqld, they are automatically
redirected to mysql.err (under Windows, at least), but there seems to be
no way to do this in Embedded.

We would like to be able to display our own output to the user, but not
MySQL's.  Ideally we would be able to turn off MySQL output, but at
least we would like to be able to redirect it.

-- Matt Solnit [EMAIL PROTECTED]

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Bug: MYSQL_FIELD-flags indicates NOT NULL with aggregates

2003-01-24 Thread Matt Solnit
This looks like it was generated using mysqlbug, but actually I took
another post and pasted in the values.

Description:
The mysql_fetch_field() function returns a MYSQL_FIELD structure with
the flags field set to a value including NOT_NULL_FLAG even if the field
is an aggregate, if that aggregate is on the primary key.

If there are no rows in the table, then MAX(pri_key_column) will return
NULL.  However, the MYSQL_FIELD structure will indicate that the
MAX(pri_key_column) field does not allow NULL.

If the column is not a primary key, but is NOT NULL, then the
MYSQL_FIELD flags will correctly indicate that the aggregate can allow
NULL.

How-To-Repeat:
In MySQL: CREATE TABLE foo (bar int PRIMARY KEY);

In C:
  MYSQL *cnn = mysql_init(NULL);
  mysql_real_connect(cnn, NULL, NULL, NULL, test, 0, NULL, 0);

  const char* select_query = SELECT MAX(bar) FROM foo;
  mysql_query(cnn, select_query);
  MYSQL_RES* res = mysql_store_result(cnn);

  MYSQL_FIELD* fld = mysql_fetch_field(res);
  char* name = strdup(fld-name);
  bool isNotNull = ((fld-flags  NOT_NULL_FLAG)  0);
  printf(column `%s`: notnull=%d\n, name, isNotNull);

  MYSQL_ROW row = mysql_fetch_row(res);
  printf(value: %s, row[0] ? row[0] : NULL);

  mysql_close(cnn);


Fix:

None.

Originator:Matt Solnit
Organization: Iteration Software, Inc. http://www.iteration.com
Release:   mysql-4.0.9-gamma (Binary distribution) 
Environment:

System: Windows XP Professional
Architecture: Pentium IV

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: SHOW INNODB STATUS

2004-07-26 Thread Matt Solnit
Mark,

How is it possible to have a hit rate of 1000/1000?  Doesn't the buffer
get initialized by cache misses?

-- Matt [EMAIL PROTECTED]


Re: INNODB SHOW STATUS 
From: Marc Slemko (marcsznep.com)
Date: Wed Apr 21 2004 - 10:29:44 CDT 

On Tue, 20 Apr 2004, Emmett Bishop wrote: 
 Howdy all, 
 
 Quick question about what I'm seeing in the BUFFER 
 POOL AND MEMORY section... 
 
 I've configured the innodb_buffer_pool_size to be 128M 
 and when I do a show variables like 'innodb%' I see 
 
 | innodb_buffer_pool_size | 134217728 | 
 
 So that looks good. However, I see the following in 
 the BUFFER POOL AND MEMORY section of the output from 
 the innodb monitor: 
 
 -- 
 BUFFER POOL AND MEMORY 
 -- 
 Total memory allocated 152389988; in additional pool 
 allocated 1048576 
 Buffer pool size 8192 
 Free buffers 0 
 Database pages 7947 
 Modified db pages 0 
 Pending reads 0 
 Pending writes: LRU 0, flush list 0, single page 0 
 Pages read 20345325, created 9857, written 763089 
 0.00 reads/s, 0.00 creates/s, 0.00 writes/s 
 Buffer pool hit rate 1000 / 1000 
 
 Why does it say the buffer pool size is only 8M? 
 Shouldn't it be 128M? Also, could someone explain the 
 hit rate? I remember seeing in someone's recent post 
 that the 1000/1000 is good, but I don't know what that 
 means. Can someone suggest a good resouce that 
 explains the contents of Innodb show status in detail. 
 The page on www.mysql.com gives a very cursory 
 overview of the output. 
Buffer pool size, free buffers, database pages, and modified database 
pages are in 16k pages. 
The buffer pool hit rate simply says the fraction of page reads
satisfied 
from the innodb buffer cache, in this case 1000/1000 == 100%. 
Unfortunately, I'm not really aware of a better reference. Perhaps some 
of this is explained in High Performance MySQL, but I don't have a 
copy yet. 


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



Building MySQL with Visual Studio .NET 2003

2004-03-02 Thread Matt Solnit
Hi everyone.  Has anyone tried building MySQL with Visual Studio .NET
2003?  I find two problems:

1) The files /strings/Strings.asm and /strings/Strxmov.asm do not
compile due to a command-line parameter in the custom-build call to
ml.exe.  It seems the upgrade from the .dsp file shipped with the MySQL
source to the .vcproj file produced by Visual Studio .NET adds two extra
quote marks, so that:

ml /Cx /nologo /DDOS386 /DM_I386 /Zm /coff /c /Fo
$(Outdir)\$(InputName).obj $(InputPath)

becomes:
ml /Cx /nologo /DDOS386 /DM_I386 /Zm /coff /c /Fo
$(Outdir)\$(InputName).obj $(InputPath)

These extra quote marks cause the problem.  I was able to fix it by
removing them.  This is a bug in Visual Studio .NET and not in the MySQL
source.

2) The bdb source code includes iostream.h, which no longer exists in
Visual Studio .NET 2003 for the purpose of C++ standards compatibility.
I was able to fix this by replacing the line:

#include iostream.h

with:

#include iostream
using namespace std;

in the files /bdb/include/db_cxx.h and /bdb/build_win32/db_config.h.

I will post this information to the MySQL documentation (comments) at
http://www.mysql.com/doc/en/Windows_VC++_Build.html.

My apologies if this message should only have gone to the Win32 list.

Sincerely,
Matt Solnit [EMAIL PROTECTED]


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