[sqlite] 'no such table' error code XXX should be propagated up to the client instead of generic error code 1

2019-01-23 Thread Anton Sukhin
sqlite3LocateTable returns generic error code 1 (SQLITE_ERROR) and error
message 'no such table'. This makes it difficult to distinguish this error
from others as in order to find that the table is missing, string parsing
of error message for 'no such table' is required.

the same applies to 'no such table column' error.

___
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] [EXTERNAL] Create table - Error code: 21

2017-09-21 Thread Hick Gunter
My guess is that you are not connecting to any database file, i.e. calling the 
constructor without a file name AND not calling the openCreateDatabase method 
before attemting to create a table.

BTW:

Your data model assumes a "Name" may have only 1 street address, but up to 4 
telephone numbers and up to 2 email addresses.

This is most certainly inefficient (it duplicates shared information) and -if 
applied to real people - inadequate. Street addresses, phone numbers, and email 
addresses should go into their own tables and be linked via assignment tables.

-Ursprüngliche Nachricht-
Von: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] Im 
Auftrag von Papa
Gesendet: Donnerstag, 21. September 2017 10:08
An: SQLite Mailing List <sqlite-users@mailinglists.sqlite.org>
Betreff: [EXTERNAL] [sqlite] Create table - Error code: 21

void myClass::CreateTable() {
 try {
 // Name's data
 wapstr = L"CREATE TABLE ";
 wapstr += table_name;
 wapstr += L"(";
 wapstr += L"id INT PRIMARY KEY NOT NULL, ";
 wapstr += L"title_name TEXT, ";
 wapstr += L"first_name TEXT, ";
 wapstr += L"middle_name TEXT, ";
 wapstr += L"last_name TEXT, ";
 // Address data
 wapstr += L"unit_number TEXT, ";
 wapstr += L"street_name TEXT, ";
 wapstr += L"city TEXT, ";
 wapstr += L"province TEXT, ";
 wapstr += L"postal_code TEXT, ";
 wapstr += L"country TEXT, ";
 // Phone1 data
 wapstr += L"country_code1 TEXT, ";
 wapstr += L"area_code1 TEXT, ";
 wapstr += L"region_code1 TEXT, ";
 wapstr += L"number1 TEXT, ";
 // Phone2 data
 wapstr += L"country_code2 TEXT, ";
 wapstr += L"area_code2 TEXT, ";
 wapstr += L"region_code2 TEXT, ";
 wapstr += L"number2 TEXT, ";
 // Phone3 data
 wapstr += L"country_code3 TEXT, ";
 wapstr += L"area_code3 TEXT, ";
 wapstr += L"region_code3 TEXT, ";
 wapstr += L"number3 TEXT, ";
 // Phone4 data
 wapstr += L"country_code4 TEXT, ";
 wapstr += L"area_code4 TEXT, ";
 wapstr += L"region_code4 TEXT, ";
 wapstr += L"number4 TEXT, ";
 // Email1 data
 wapstr += L"email1 TEXT, ";
 // Email2 data
 wapstr += L"email2 TEXT";
 wapstr += L");";
/*
Test shows:
CREATE TABLE Name(id INT PRIMARY KEY NOT NULL, title_name TEXT, first_name 
TEXT, middle_name TEXT, last_name TEXT, unit_number TEXT, street_name TEXT, 
city TEXT, province TEXT, postal_code TEXT, country TEXT, country_code1 TEXT, 
area_code1 TEXT, region_code1 TEXT, number1 TEXT, country_code2 TEXT, 
area_code2 TEXT, region_code2 TEXT, number2 TEXT, country_code3 TEXT, 
area_code3 TEXT, region_code3 TEXT, number3 TEXT, country_code4 TEXT, 
area_code4 TEXT, region_code4 TEXT, number4 TEXT, email1 TEXT, email2 TEXT); */

 db->createTable(wapstr);

 } catch (std::shared_ptr& e) {
 throw e;
 }
}

void jme::SQLite3_RDB::createTable(const std::wstring& stm) {
 // 1) Assign function value to class value
 this->sql_statement_request = stm;
/*
Test shows that sql_statement_request is :
CREATE TABLE Name(id INT PRIMARY KEY NOT NULL, title_name TEXT, first_name 
TEXT, middle_name TEXT, last_name TEXT, unit_number TEXT, street_name TEXT, 
city TEXT, province TEXT, postal_code TEXT, country TEXT, country_code1 TEXT, 
area_code1 TEXT, region_code1 TEXT, number1 TEXT, country_code2 TEXT, 
area_code2 TEXT, region_code2 TEXT, number2 TEXT, country_code3 TEXT, 
area_code3 TEXT, region_code3 TEXT, number3 TEXT, country_code4 TEXT, 
area_code4 TEXT, region_code4 TEXT, number4 TEXT, email1 TEXT, email2 TEXT); */
 // *** THE ERROR IS HERE 
 this->rc = ::sqlite3_prepare_v2(db,
convert->toString(sql_statement_request).c_str(), -1,
_sql_statement, NULL);
 if (this->rc != SQLITE_OK) {
 this->apstr = "Error message from SQLite3 ";
 this->apstr += ::sqlite3_errmsg(db);
 this->apstr += "\nError code: ";
 this->apstr += jme::core::to_string(this->rc);
 this->wapex->setException(this->apstr, JMEFILE, JMEMETHOD, JMELINE);

 this->finalize();

 throw this->wapex;
 }
 try {
 this->runStep(this->binary_sql_statement);
 } catch (std::shared_ptr& we) {
 throw we;
 }

 // Call finalize to terminate the transaction - The constructor closes the 
db connection.
 this->finalize();
}

The code

[sqlite] no such table error!

2014-03-25 Thread forestganbo
hello,i'm a new sqlite  study,
i have problem in system.data.sqlite of C#
the data source has connected ,
but sqlcom.ExecuteReader() there has error : no such table:dsz_insured; but
i have this table in the test.db
the code is :
  public SQLiteConnection GetCon()
{
string strFilePath = @"Data Source=E:\sqlite3\test.db";
string strCon = strFilePath +
";Pooling=true;FailIfMissing=false";
SQLiteConnection sqliteCon = new SQLiteConnection(strCon);
return sqliteCon;
}
private void button1_Click(object sender, EventArgs e)
{
SQLiteConnection conn = GetCon();  
conn.Open();   
string sqlc = "select  clausetype from  dsz_insured where
amount='5'";
SQLiteCommand sqlcom = new SQLiteCommand(sqlc, conn);
//System.Data.SQLite.SQLiteDataReader reader =
sqlcom.ExecuteReader();
SQLiteDataReader reader = sqlcom.ExecuteReader();
label1.Text = reader.ToString();
}
 

sorry i'm poor in english.



--
View this message in context: 
http://sqlite.1065341.n5.nabble.com/no-such-table-error-tp74698.html
Sent from the SQLite mailing list archive at Nabble.com.
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] no such table error.

2010-06-14 Thread Tom Lynn
Yes, that's it!  Thanks.


On Mon, Jun 14, 2010 at 3:56 PM, P Kishor  wrote:

> On Mon, Jun 14, 2010 at 5:53 PM, Tom Lynn  wrote:
> > I'm fairly new to sqlite and generally use databases with single tables
> for
> > use with my PERL scripts.  I've encountered a problem where I've tried to
> > insert data into a table named trunks and get the error "No such table:
> > main.atd_data"
> >
> > atd_data is a table that I use in a different script.  The insert
> statement
> > does not reference it whatsoever (shown below).  This error occurs
> whether I
> > execute the statement from my script or from the sqlite3 command shell.
>  I
> > cannot imagine sqlite "remembering" my other table.  Should I suspect
> some
> > kind of file corruption?
> >
> > INSERT INTO trunks ( store, trk_date, grp_num, grp_size, grp_type,
> grp_dir,
> > meas_hour, usage, seizures, inc_seizures, grp_overflow, queue_size,
> queued,
> > que_overflow, que_abandoned, out_service, percent_atb, out_block ) VALUES
> (
> > 001, '6/04/2010', 12, 24, 'tie', 'two', 1300, 0, 1, 0, 0, 0, 0, 0, 0, 0,
> 0,
> > 0);
> >
>
>
> Do you have a TRIGGER that is firing on INSERT INTO trunks, a TRIGGER
> that is trying to fiddle with main.atd_data?
>
>
> --
> Puneet Kishor
> ___
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] no such table error.

2010-06-14 Thread P Kishor
On Mon, Jun 14, 2010 at 5:53 PM, Tom Lynn  wrote:
> I'm fairly new to sqlite and generally use databases with single tables for
> use with my PERL scripts.  I've encountered a problem where I've tried to
> insert data into a table named trunks and get the error "No such table:
> main.atd_data"
>
> atd_data is a table that I use in a different script.  The insert statement
> does not reference it whatsoever (shown below).  This error occurs whether I
> execute the statement from my script or from the sqlite3 command shell.  I
> cannot imagine sqlite "remembering" my other table.  Should I suspect some
> kind of file corruption?
>
> INSERT INTO trunks ( store, trk_date, grp_num, grp_size, grp_type, grp_dir,
> meas_hour, usage, seizures, inc_seizures, grp_overflow, queue_size, queued,
> que_overflow, que_abandoned, out_service, percent_atb, out_block ) VALUES (
> 001, '6/04/2010', 12, 24, 'tie', 'two', 1300, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
> 0);
>


Do you have a TRIGGER that is firing on INSERT INTO trunks, a TRIGGER
that is trying to fiddle with main.atd_data?


-- 
Puneet Kishor
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] no such table error.

2010-06-14 Thread Tom Lynn
I'm fairly new to sqlite and generally use databases with single tables for
use with my PERL scripts.  I've encountered a problem where I've tried to
insert data into a table named trunks and get the error "No such table:
main.atd_data"

atd_data is a table that I use in a different script.  The insert statement
does not reference it whatsoever (shown below).  This error occurs whether I
execute the statement from my script or from the sqlite3 command shell.  I
cannot imagine sqlite "remembering" my other table.  Should I suspect some
kind of file corruption?

INSERT INTO trunks ( store, trk_date, grp_num, grp_size, grp_type, grp_dir,
meas_hour, usage, seizures, inc_seizures, grp_overflow, queue_size, queued,
que_overflow, que_abandoned, out_service, percent_atb, out_block ) VALUES (
001, '6/04/2010', 12, 24, 'tie', 'two', 1300, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,
0);

Best regards,
Tom
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users