What is annoying about this is that if you use mysqlimport to put this data into the table, I get:


testdb.testtable: Records: 3 Deleted: 0 Skipped: 0 Warnings: 2

So, where are the warnings coming from? Is there some public API, below the C API layer, that one can use to obtain this information?

If I do an insert and lose information, and get absolutely no warning about the problem, and no way to determine that there was an information loss, then I could call that a bug.

I keep looking for a mysql_warnings function, or maybe a mysql_really_info, and I am not seeing anything else to work with.

One can do the data validation at the application level by re-fetching the data, but isn't this the most complicated and ugly way to deal with the problem?

The database obviously has the facts. Hence the warning from mysqlimport. Is there a reason it must keep the information to itself?

- ray

On Saturday, August 2, 2003, at 5:24AM, Adam Fortuno wrote:

Actually, MySQL doesn't normally give overrun cut-off information (best I know). Use MySQL 4.0.x on 10.2.6, and MySQL has always performed that way.


Regards,
A$

On Friday, August 1, 2003, at 05:37 PM, Ray Kiddy wrote:


I am trying to insert data using the C API.


Particulars:
OS: Mac OS X 10.3 (7A179)
MySQL: MySQL 4.1.0-alpha
table type: tried both MyISAM and InnoDB

I have a table:

mysql> describe testtable;
+--------+---------+-------------------+------+-----+--------- +-------+
| Field | Type | Collation | Null | Key | Default | Extra |
+--------+---------+-------------------+------+-----+--------- +-------+
| _PK | int(11) | binary | | PRI | 0 | |
| first | char(3) | latin1_swedish_ci | YES | | NULL | |
| second | char(3) | latin1_swedish_ci | YES | | NULL | |
| third | char(3) | latin1_swedish_ci | YES | | NULL | |
+--------+---------+-------------------+------+-----+--------- +-------+
4 rows in set (0.00 sec)


Note that the first, second, and third columns have 3 characters of space.

When I do:

        printf("insert: %s\n", insert);
        int result = mysql_query(one, insert);
        printf("info: %s\n", mysql_info(one));


I get:


insert: INSERT INTO testtable (_PK,first,second,third) VALUES (1,'AAAXXX','BBB','CCC')
info: (null)
insert: INSERT INTO testtable (_PK,first,second,third) VALUES (2,'DDD','EEE','FFF')
info: (null)
insert: INSERT INTO testtable (_PK,first,second,third) VALUES (3,'GGG','HHHXXX','III')
info: (null)


Note that the value in the first insert, 'AAAXXX', is too long to fit. As is 'HHHXXX' in the third insert. And indeed, I see:

mysql> select * from testtable;
+-----+-------+--------+-------+
| _PK | first | second | third |
+-----+-------+--------+-------+
|   1 | AAA   | BBB    | CCC   |
|   2 | DDD   | EEE    | FFF   |
|   3 | GGG   | HHH    | III   |
+-----+-------+--------+-------+
3 rows in set (0.00 sec)

So, why is mysql_info not giving me any information about the data loss that is going on here? Is that not information that might be of interest?

Is there some other call I have to make that will "prepare" for the mysql_info call? The doc does not seem to indicate this, but one never knows.

thanx - ray


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





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



Reply via email to